MCPcopy Index your code
hub / github.com/coder/coder / AIProviders

Method AIProviders

codersdk/aiproviders.go:412–423  ·  view source on GitHub ↗

AIProviders lists all (non-deleted) AI providers.

(ctx context.Context)

Source from the content-addressed store, hash-verified

410
411// AIProviders lists all (non-deleted) AI providers.
412func (c *Client) AIProviders(ctx context.Context) ([]AIProvider, error) {
413 res, err := c.Request(ctx, http.MethodGet, "/api/v2/ai/providers", nil)
414 if err != nil {
415 return nil, err
416 }
417 defer res.Body.Close()
418 if res.StatusCode != http.StatusOK {
419 return nil, ReadBodyAsError(res)
420 }
421 var providers []AIProvider
422 return providers, json.NewDecoder(res.Body).Decode(&providers)
423}
424
425// AIProvider fetches a single AI provider by ID or name.
426func (c *Client) AIProvider(ctx context.Context, idOrName string) (AIProvider, error) {

Callers 2

TestAIProvidersCRUDFunction · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 2

TestAIProvidersCRUDFunction · 0.64