Customer provider keys
Let a customer run its requests on its own OpenAI, Anthropic or other provider key.
Some customers want to use their own provider account: their negotiated prices, their data agreement, their quota. With bring-your-own-key (BYOK), you store a customer's provider key with Hixel, and that customer's requests run on it. You still get the usage record, the limits and the model controls; the customer's wallet is not charged.
Turn it on#
BYOK is off by default. In the dashboard, under Gateway → Providers & BYOK, turn on “Let
customers bring their own keys” and choose the providers customers may bring keys for; or from
code, send {"byok": {"enabled": true, "providers": ["openai"]}} to PATCH /v1/gateway with a project key. GET /v1/gateway
reads the current setting (byok.enabled, byok.providers).
There is one more switch there, “Use Hixel's keys when the customer's key fails”
(byok.fallback_to_platform_key).
Off, the default, a request on a customer's key never moves to the environment's keys: if the
customer's key fails, the request fails. On, a request that the customer's key cannot serve
continues on your own provider key (or Hixel's, where
allowed) and is paid as any other request.
Store a customer's key#
curl -X PUT https://api.hixel.dev/v1/customers/org_42/provider_keys/openai \
-H "Authorization: Bearer $HIXEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "api_key": "sk-proj-…" }'const providerKey = await hixel.customers.putProviderKey("org_42", "openai", {
api_key: "sk-proj-…",
});
console.log(providerKey.last_four);{
"id": "pcred_…",
"customer": "org_42",
"provider": "openai",
"form": "api_key",
"last_four": "Xy7Q",
"label": null,
"base_url": null,
"created_at": "2026-11-25T10:00:00.000Z",
"updated_at": "2026-11-25T10:00:00.000Z"
}The key is encrypted at rest and never returned by any read: you see only its last four
characters. Sending PUT again for the same provider replaces it.
| Provider value | Notes |
|---|---|
openai, anthropic, google, groq, mistral, together, fireworks, deepseek, xai, openrouter, perplexity, cerebras, cohere | api_key is the provider's API key |
azure, custom | Need base_url too: an https:// URL on a public host name |
bedrock | api_key is a Bedrock API key, or AWS access keys as JSON text: {"access_key_id","secret_access_key","session_token"?} |
vertex | api_key is the service account's JSON key file, as Google issues it |
base_url (optional for the others) sends the key to that URL instead of the provider's
default. It must be https:// on a public host name, without user information, query or
fragment; an IP address or a private name such as localhost is refused.
Other calls:
GET /v1/customers/{external_id}/provider_keyslists the customer's keys (never the keys themselves).DELETE /v1/customers/{external_id}/provider_keys/{provider}removes one.
Which requests use it#
A request uses the customer's key when the environment allows BYOK for the provider, the request names the customer, and the customer holds a key for the provider of the requested model. Then:
- the request runs on the customer's key only (and on your own key after it only with fallback on);
- the usage record says
"payer": "byok"and"credential": "customer", withbilled_micros"0";cost_microsis the provider cost at catalog prices, for your information; - the customer's wallet is not charged, but its spend limits count that cost, and its rate limits and model allowlist apply as usual;
- errors from the provider are returned as the provider sent them, and the provider's own rate-limit headers are passed through.
Failures#
| Status | code | When |
|---|---|---|
409 | byok_disabled | Storing a key when the environment does not allow BYOK |
409 | byok_provider_not_allowed | Storing a key for a provider the environment does not allow |
400 | invalid_request | A base_url that is not allowed, or a key in the wrong form |
403 | provider_key_required | A request for a model only a customer's key can serve, without one |