Launch Week 02 wrapped — explore all five launches

Set Credentials

PUThttps://api.confident-ai.com/v2/projects/{projectId}/model-credentials

Sets, replaces, or clears a project's stored credential for a single model provider. While the project is still inheriting your organization's credentials, the first write creates a standalone credential set for the project and severs that inheritance rather than writing to the organization's record — so the project then holds only the provider you just sent, and any other provider it was relying on has to be set again here.

This is a write-only surface: there is no read endpoint, and the response returns every credential masked. Send apiKey for an API-key provider or modelConfig for a configuration provider, and null in either to clear what is stored. A provider your organization's model provider policy does not allow cannot have a credential set (403), though clearing one is always permitted.

PUT/v2/projects/{projectId}/model-credentials
curl -X PUT "https://api.confident-ai.com/v2/projects/{projectId}/model-credentials" \
  -H "CONFIDENT_API_KEY: <ORGANIZATION-API-KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "provider": "OPEN_AI",
  "apiKey": "sk-proj-a1B2c3D4e5F6g7H8i9J0kLmN",
  "modelConfig": {
    "azureApiBase": "https://acme.openai.azure.com",
    "azureDeploymentName": "gpt-4o",
    "azureApiVersion": "2024-06-01",
    "azureApiKey": "b7f3c9d1e5a24f8090c6d4b2a1e8f37c"
  }
}'
200
{
  "success": true,
  "data": {
    "id": "<MODEL-CREDENTIALS-ID>",
    "openAiApiKey": "***************Yz7Kq2",
    "anthropicApiKey": null,
    "geminiApiKey": null,
    "xAiApiKey": null,
    "deepSeekApiKey": null,
    "mistralApiKey": null,
    "perplexityApiKey": null,
    "bedrockModelConfig": null,
    "vertexAiModelConfig": null,
    "azureModelConfig": {
      "azureApiBase": "https://acme.openai.azure.com",
      "azureDeploymentName": "gpt-4o",
      "azureApiVersion": "2024-06-01",
      "azureApiKey": "***************Yz7Kq2"
    },
    "portKeyConfig": null,
    "openRouterConfig": null,
    "trueFoundryConfig": null,
    "liteLlmConfig": null,
    "huggingFaceConfig": null,
    "organizationId": "<ORGANIZATION-ID>"
  },
  "deprecated": false
}

Headers

  • CONFIDENT_API_KEYstringRequired

    The organization API key for your Confident AI organization.

Path parameters

  • projectIdstringRequired

    The id of the project, which must belong to the organization your API key is scoped to.

Request body

  • providerenumRequired

    This is the provider of the model.

    Show 18 enum valuesHide 18 enum values
    • OPEN_AI
    • CUSTOM
    • CONFIDENT_AI
    • BEDROCK
    • ANTHROPIC
    • GEMINI
    • X_AI
    • DEEPSEEK
    • MOONSHOT_AI
    • VERTEX_AI
    • AZURE
    • MISTRAL
    • PERPLEXITY
    • OPEN_ROUTER
    • PORTKEY
    • LITE_LLM
    • TRUE_FOUNDRY
    • HUGGING_FACE
  • apiKeystring | null

    The provider's API key, for the API-key providers only. Send the raw secret to set it, or null to clear it; a masked value read back from a response is rejected. Sending it for a configuration provider is rejected.

  • modelConfigobject | null

    The provider's configuration, for the configuration providers only — for example azureApiBase, azureDeploymentName, azureApiVersion and azureApiKey for AZURE. It replaces the stored configuration wholesale rather than merging into it, so send every key the provider needs; send null to clear it. It must not be empty and must not carry masked values read back from a response. Sending it for an API-key provider is rejected.

    For BEDROCK, always send regionName and modelId, then authenticate with either ACCESS_KEYS (awsAccessKeyId and awsSecretAccessKey) or, when calling the OpenAI-compatible Mantle API by setting api to MANTLE, an authType of API_KEY together with apiKey, an optional apiBase, and an optional projectId (sent as the OpenAI-Project header so AWS attributes usage and cost to that Mantle project; letters, numbers, hyphens and underscores only). An API key only works with the Mantle API, and assume-role Bedrock configurations can only be managed on the Confident AI platform.

Response

Set Credentials succeeded.

  • successboolean

    Indicates if the request was successful.

  • dataobject

    One provider credential per field, for the whole organization or for a single project. Every secret comes back masked — fifteen asterisks followed by its last six characters, and the same treatment for the secret leaves inside a configuration object — so a stored credential can never be read back in full once it is set. A field is null when no credential is stored for that provider.

    Show 17 propertiesHide 17 properties
    • idstring

      The id of the credentials record, generated by Confident AI. A project that inherits the organization's credentials shares this id with it.

    • openAiApiKeystring | null

      The stored OpenAI API key, masked, or null when none is stored.

    • anthropicApiKeystring | null

      The stored Anthropic API key, masked, or null when none is stored.

    • geminiApiKeystring | null

      The stored Gemini API key, masked, or null when none is stored.

    • xAiApiKeystring | null

      The stored xAI API key, masked, or null when none is stored.

    • deepSeekApiKeystring | null

      The stored DeepSeek API key, masked, or null when none is stored.

    • mistralApiKeystring | null

      The stored Mistral API key, masked, or null when none is stored.

    • perplexityApiKeystring | null

      The stored Perplexity API key, masked, or null when none is stored.

    • bedrockModelConfigobject | null

    • vertexAiModelConfigobject | null

    • azureModelConfigobject | null

    • portKeyConfigobject | null

    • openRouterConfigobject | null

    • trueFoundryConfigobject | null

    • liteLlmConfigobject | null

    • huggingFaceConfigobject | null

    • organizationIdstring | null

      The id of the organization these credentials belong to, or null when they belong to a single project.

  • deprecatedboolean

    Indicates if this endpoint is deprecated.

Built byConfident AI