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

Method CreateAIProvider

codersdk/aiproviders.go:440–451  ·  view source on GitHub ↗

CreateAIProvider creates a new AI provider.

(ctx context.Context, req CreateAIProviderRequest)

Source from the content-addressed store, hash-verified

438
439// CreateAIProvider creates a new AI provider.
440func (c *Client) CreateAIProvider(ctx context.Context, req CreateAIProviderRequest) (AIProvider, error) {
441 res, err := c.Request(ctx, http.MethodPost, "/api/v2/ai/providers", req)
442 if err != nil {
443 return AIProvider{}, err
444 }
445 defer res.Body.Close()
446 if res.StatusCode != http.StatusCreated {
447 return AIProvider{}, ReadBodyAsError(res)
448 }
449 var provider AIProvider
450 return provider, json.NewDecoder(res.Body).Decode(&provider)
451}
452
453// UpdateAIProvider partially updates an AI provider identified by
454// ID or name.

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 12

TestUserAIProviderKeysFunction · 0.64
createAIProviderForTestFunction · 0.64
TestAIProvidersCRUDFunction · 0.64
TestAIProviderAuditDiffFunction · 0.64