Skip to main content
Opik Documentation

Search documentation

Type to search this documentation.

Store LLM Provider's ApiKey

POST/v1/private/llm-provider-keyStore LLM Provider's ApiKey

Store LLM Provider's ApiKey

Request body

application/json
objectProviderApiKey_Write
api_keystring
auth_configobject

Dynamic token auth recipe. When set, Opik fetches a short-lived bearer from the configured auth service instead of using a static api_key. Only supported for custom providers. Secret credential values read back masked.

Show child attributes
credentialsarray of object

Fields sent to the token URL. Values flagged as secret are write-only: they read back as the '__SECRET__' sentinel

maxItems 20 · minItems 0

Show child attributes

maxItems 20 · minItems 0

Show array items

Fields sent to the token URL. Values flagged as secret are write-only: they read back as the '__SECRET__' sentinel

keystringrequired

maxLength 250 · minLength 0

secretboolean

Secret values are encrypted at rest and never read back; once true it cannot be unset

valuestring

maxLength 2000 · minLength 0

expires_fieldstring

Field holding the token lifetime in seconds in the reply; dot-path for nested replies

maxLength 250 · minLength 0

fallback_ttl_secondsinteger · int64

Lifetime in seconds assumed when the reply doesn't state one, capped at one year; 0 disables caching for such replies. A reply-stated lifetime always wins

maximum 31536000 · minimum 0

send_asstring

How credentials are sent: form body (default), JSON body, or basic auth (id/secret in an HTTP Basic header, remaining fields in the form body)

one of "form", "json", "basic"

token_fieldstring

Field holding the token in the reply; dot-path for nested replies

maxLength 250 · minLength 0

token_urlstring

Auth service URL the credentials are sent to

base_urlstring

pattern (?s)^\s*(\S.*\S|\S)\s*$

configurationobject
headersobject
namestring

maxLength 150 · minLength 0

providerstringrequired

one of "openai", "anthropic", "gemini", "openrouter", "vertex-ai", "bedrock", "ollama", "custom-llm", "opik-free"

provider_namestring

Provider name - required for custom LLM and Bedrock providers to uniquely identify them (e.g., 'ollama', 'vllm', 'Bedrock us-east-1'). Must not be blank for custom and Bedrock providers. Should not be set for standard providers (OpenAI, Anthropic, etc.). This requirement is conditional and validation is enforced programmatically.

maxLength 150 · minLength 0

Example request
{
  "api_key": "",
  "auth_config": {
    "credentials": [
      {
        "key": "string",
        "secret": "",
        "value": "string"
      }
    ],
    "expires_field": "expires_in",
    "fallback_ttl_seconds": 0,
    "send_as": "basic",
    "token_field": "access_token",
    "token_url": "https://developer.api.example.com/authentication/v1/token"
  },
  "base_url": "string",
  "configuration": {
    "additionalProp1": "string"
  },
  "headers": {
    "additionalProp1": "string"
  },
  "name": "string",
  "provider": "anthropic",
  "provider_name": "ollama"
}

Responses

201Created

Headers

Location
401Bad Requestapplication/json
objectErrorMessage
codeinteger · int32
detailsstring
messagestring
Example response
{
  "code": 0,
  "details": "string",
  "message": "string"
}
403Access forbiddenapplication/json
objectErrorMessage
codeinteger · int32
detailsstring
messagestring
Example response
{
  "code": 0,
  "details": "string",
  "message": "string"
}
Documentation menu