Providers

Create a key for a provider

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.

POST
/api/providers/{provider}/keys
AuthorizationBearer <token>

Bearer token authentication. Use your MPilot virtual-key JWT or admin JWT. Virtual keys (prefixed with sk-bf-) can also be passed here.

In: header

Path Parameters

providerstring

Provider name

id?string

Unique identifier for the key

name?string

Name of the key

value?object

API key value (redacted in responses)

models?array<string>

List of models this key can access (whitelist)

blacklisted_models?array<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.)

Empty Object

azure_key_config?object

Azure-specific key configuration

vertex_key_config?object

Vertex-specific key configuration

bedrock_key_config?object

AWS Bedrock-specific key configuration

vllm_key_config?object

VLLM-specific key configuration

ollama_key_config?object

Ollama-specific key configuration

sgl_key_config?object

SGLang-specific key configuration

replicate_key_config?object

Replicate-specific key configuration

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 Body

curl -X POST "https://loading/{AI_GATEWAY_URL}/api/providers/string/keys" \  -H "Content-Type: application/json" \  -d '{}'
{
  "id": "string",
  "name": "string",
  "value": {
    "value": "string",
    "env_var": "string",
    "from_env": true
  },
  "models": [
    "string"
  ],
  "blacklisted_models": [
    "string"
  ],
  "weight": 0,
  "aliases": {
    "property1": "string",
    "property2": "string"
  },
  "azure_key_config": {
    "endpoint": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "api_version": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "client_id": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "client_secret": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "tenant_id": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "scopes": [
      "string"
    ]
  },
  "vertex_key_config": {
    "project_id": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "project_number": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "region": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "auth_credentials": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    }
  },
  "bedrock_key_config": {
    "access_key": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "secret_key": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "session_token": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "region": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "arn": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "batch_s3_config": {
      "buckets": [
        {
          "bucket_name": "string",
          "prefix": "string",
          "is_default": true
        }
      ]
    }
  },
  "vllm_key_config": {
    "url": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    },
    "model_name": "string"
  },
  "ollama_key_config": {
    "url": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    }
  },
  "sgl_key_config": {
    "url": {
      "value": "string",
      "env_var": "string",
      "from_env": true
    }
  },
  "replicate_key_config": {
    "use_deployments_endpoint": true
  },
  "enabled": true,
  "use_for_batch_api": true,
  "config_hash": "string",
  "status": "string",
  "description": "string"
}
{
  "event_id": "string",
  "type": "string",
  "is_bifrost_error": true,
  "status_code": 0,
  "error": {
    "type": "string",
    "code": "string",
    "message": "string",
    "param": "string",
    "event_id": "string"
  },
  "extra_fields": {
    "provider": "openai",
    "model_requested": "string",
    "request_type": "string"
  }
}
{
  "event_id": "string",
  "type": "string",
  "is_bifrost_error": true,
  "status_code": 0,
  "error": {
    "type": "string",
    "code": "string",
    "message": "string",
    "param": "string",
    "event_id": "string"
  },
  "extra_fields": {
    "provider": "openai",
    "model_requested": "string",
    "request_type": "string"
  }
}
{
  "event_id": "string",
  "type": "string",
  "is_bifrost_error": true,
  "status_code": 0,
  "error": {
    "type": "string",
    "code": "string",
    "message": "string",
    "param": "string",
    "event_id": "string"
  },
  "extra_fields": {
    "provider": "openai",
    "model_requested": "string",
    "request_type": "string"
  }
}
{
  "event_id": "string",
  "type": "string",
  "is_bifrost_error": true,
  "status_code": 0,
  "error": {
    "type": "string",
    "code": "string",
    "message": "string",
    "param": "string",
    "event_id": "string"
  },
  "extra_fields": {
    "provider": "openai",
    "model_requested": "string",
    "request_type": "string"
  }
}
On this page

On this page

No Headings