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.
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"
}
}'{
"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_KEYstringRequiredThe organization API key for your Confident AI organization.
Path parameters
projectIdstringRequiredThe id of the project, which must belong to the organization your API key is scoped to.
Request body
providerenumRequiredThis is the provider of the model.
Show 18 enum valuesHide 18 enum values
OPEN_AICUSTOMCONFIDENT_AIBEDROCKANTHROPICGEMINIX_AIDEEPSEEKMOONSHOT_AIVERTEX_AIAZUREMISTRALPERPLEXITYOPEN_ROUTERPORTKEYLITE_LLMTRUE_FOUNDRYHUGGING_FACE
apiKeystring | nullThe 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 | nullThe provider's configuration, for the configuration providers only — for example
azureApiBase,azureDeploymentName,azureApiVersionandazureApiKeyforAZURE. 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 sendregionNameandmodelId, then authenticate with eitherACCESS_KEYS(awsAccessKeyIdandawsSecretAccessKey) or, when calling the OpenAI-compatible Mantle API by settingapitoMANTLE, anauthTypeofAPI_KEYtogether withapiKey, an optionalapiBase, and an optionalprojectId(sent as theOpenAI-Projectheader 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.
successbooleanIndicates if the request was successful.
dataobjectOne 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
idstringThe id of the credentials record, generated by Confident AI. A project that inherits the organization's credentials shares this id with it.
openAiApiKeystring | nullThe stored OpenAI API key, masked, or null when none is stored.
anthropicApiKeystring | nullThe stored Anthropic API key, masked, or null when none is stored.
geminiApiKeystring | nullThe stored Gemini API key, masked, or null when none is stored.
xAiApiKeystring | nullThe stored xAI API key, masked, or null when none is stored.
deepSeekApiKeystring | nullThe stored DeepSeek API key, masked, or null when none is stored.
mistralApiKeystring | nullThe stored Mistral API key, masked, or null when none is stored.
perplexityApiKeystring | nullThe stored Perplexity API key, masked, or null when none is stored.
bedrockModelConfigobject | nullvertexAiModelConfigobject | nullazureModelConfigobject | nullportKeyConfigobject | nullopenRouterConfigobject | nulltrueFoundryConfigobject | nullliteLlmConfigobject | nullhuggingFaceConfigobject | nullorganizationIdstring | nullThe id of the organization these credentials belong to, or null when they belong to a single project.
deprecatedbooleanIndicates if this endpoint is deprecated.