---
title: "Create a key for a provider"
method: POST
path: "/api/providers/{provider}/keys"
tags: ["Providers"]
---

# Create a key for a provider

`POST /api/providers/{provider}/keys`

Creates a new API key for the specified provider. The key `id` is auto-generated
if omitted. `enabled` defaults to `true` if omitted. `value` is required and must
not be empty. Keys cannot be created on keyless providers.

## Path parameters

- `provider` string, required

## Request body

- Key — API key configuration
  - `id` string — Unique identifier for the key
  - `name` string — Name of the key
  - `value` object — API key value (redacted in responses)
    - `value` string
    - `env_var` string
    - `from_env` boolean
  - `models` string[] — List of models this key can access (whitelist)
  - `blacklisted_models` string[] — List of models this key cannot access (blacklist)
  - `weight` number — Weight for load balancing
  - `aliases` object — Model alias mappings - maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)
  - `azure_key_config` object — Azure-specific key configuration
    - `endpoint` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `api_version` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `client_id` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `client_secret` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `tenant_id` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `scopes` string[] — List of scopes to use for authentication
  - `vertex_key_config` object — Vertex-specific key configuration
    - `project_id` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `project_number` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `region` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `auth_credentials` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
  - `bedrock_key_config` object — AWS Bedrock-specific key configuration
    - `access_key` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `secret_key` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `session_token` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `region` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `arn` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `batch_s3_config` object
      - `buckets` object[]
        - `bucket_name` string
        - `prefix` string
        - `is_default` boolean
  - `vllm_key_config` object — VLLM-specific key configuration
    - `url` object, required — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `model_name` string
  - `ollama_key_config` object — Ollama-specific key configuration
    - `url` object, required — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
  - `sgl_key_config` object — SGLang-specific key configuration
    - `url` object, required — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
  - `replicate_key_config` object — Replicate-specific key configuration
    - `use_deployments_endpoint` boolean — Whether to use the deployments endpoint instead of the models endpoint
  - `enabled` boolean — Whether the key is active (defaults to true)
  - `use_for_batch_api` boolean — Whether this key can be used for batch API operations
  - `config_hash` string — Hash of config.json version, used for change detection
  - `status` string — Status of key (e.g., success, list_models_failed)
  - `description` string — Error or status description for the key

## Response `200`

Key created successfully

- Key — API key configuration
  - `id` string — Unique identifier for the key
  - `name` string — Name of the key
  - `value` object — API key value (redacted in responses)
    - `value` string
    - `env_var` string
    - `from_env` boolean
  - `models` string[] — List of models this key can access (whitelist)
  - `blacklisted_models` string[] — List of models this key cannot access (blacklist)
  - `weight` number — Weight for load balancing
  - `aliases` object — Model alias mappings - maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)
  - `azure_key_config` object — Azure-specific key configuration
    - `endpoint` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `api_version` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `client_id` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `client_secret` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `tenant_id` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `scopes` string[] — List of scopes to use for authentication
  - `vertex_key_config` object — Vertex-specific key configuration
    - `project_id` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `project_number` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `region` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `auth_credentials` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
  - `bedrock_key_config` object — AWS Bedrock-specific key configuration
    - `access_key` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `secret_key` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `session_token` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `region` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `arn` object — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `batch_s3_config` object
      - `buckets` object[]
        - `bucket_name` string
        - `prefix` string
        - `is_default` boolean
  - `vllm_key_config` object — VLLM-specific key configuration
    - `url` object, required — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
    - `model_name` string
  - `ollama_key_config` object — Ollama-specific key configuration
    - `url` object, required — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
  - `sgl_key_config` object — SGLang-specific key configuration
    - `url` object, required — Environment variable configuration
      - `value` string
      - `env_var` string
      - `from_env` boolean
  - `replicate_key_config` object — Replicate-specific key configuration
    - `use_deployments_endpoint` boolean — Whether to use the deployments endpoint instead of the models endpoint
  - `enabled` boolean — Whether the key is active (defaults to true)
  - `use_for_batch_api` boolean — Whether this key can be used for batch API operations
  - `config_hash` string — Hash of config.json version, used for change detection
  - `status` string — Status of key (e.g., success, list_models_failed)
  - `description` string — Error or status description for the key

## Other responses

- `400` — Bad request
- `404` — Provider not found
- `409` — Key ID already exists
- `500` — Internal server error

---

[API](https://skmtc.net/getbifrost/apis/bifrost-api.md) · [All operations](https://skmtc.net/getbifrost/apis/bifrost-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/getbifrost/bifrost-api/versions/f8cab88f64ea/schema)
