Skip to content
kenari.

BYOK

BYOK (bring your own key) lets you register keys from your own provider accounts and use them through the same kenari endpoint and kn- key. Your provider bills you for the tokens, your kenari balance is not charged, and usage still appears in your analytics at Rp 0. Per-search fees for Server tools such as web search still apply.

  1. Open BYOK & Routes in the dashboard, then the BYOK tab.
  2. Click Add API Key.
  3. Pick a Provider, paste your key, optionally add a Label (optional), and click Save.

kenari checks the key right after you save it and shows the result on the key’s row.

Choose Custom (your own endpoint) and fill in:

  • Provider name: a unique name such as my-proxy. kenari lowercases it and replaces spaces with hyphens. You use this name in byok/ model ids and when you build routes.
  • Base URL: the base URL of your endpoint.
  • API type: OpenAI compatible or Anthropic.

Each provider you use appears as a card, with its keys listed in priority order.

ControlWhat it does
CheckRuns a fresh check of the key against the provider.
Browse modelsLists the models this key can reach, with Copy ID for each.
Row menuEdit API Key, Disable or Enable, Delete API Key. With two or more keys on a provider, also Raise priority and Lower priority.

Every row shows one status.

StatusMeaning
ActiveThe key passed the check, or the check could not tell but the key served a request in the last 7 days. The row may add “used 2 h ago” or “never used”.
Cooldown N minThe provider rate-limited the key, had a temporary issue, or the key ran out of quota. It can be used again when the countdown ends.
FailingThe provider rejected the key. No requests go through it until you fix it.
Status unknownThe provider cannot be checked automatically, for example a custom endpoint with no models list. The key becomes Active after a request succeeds through it.
Not checked yetA new key waiting for its first check.
DisabledYou turned the key off. It serves no requests until you click Enable.

Each provider card has a kenari balance backup toggle. When it is on and every key you have for that provider fails or hits a limit, kenari finishes the request on its own capacity and charges your balance at PAYG rates. If all your keys fail and backup is off, the request fails.

If the toggle is on and your balance is too low, the card warns you and shows a Top up link. The backup cannot cover requests until you add balance. See How billing works.

kenari tries the keys on a card from top to bottom, and moves to the next one when a key fails or hits a limit. The balance backup, when on, is always last. Use Raise priority and Lower priority to change the order.

For different models at each step, build a named route. See Routing and routes.

You do not change any code. Send requests with your kn- key as usual. When the model you ask for is served by a provider you have a key for, kenari tries your key first.

Terminal window
curl https://kenari.id/v1/chat/completions \
-H "Authorization: Bearer $KENARI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"messages": [{"role": "user", "content": "Hello!"}]
}'

To reach any model your provider serves, including ones that are not in the kenari catalog, send its id with a byok/ prefix:

byok/<provider>/<model-id-at-your-provider>
PartRule
byokLiteral, lowercase.
<provider>The provider of your key, or the Provider name of a custom endpoint. Matching ignores case.
RestSent to your provider as written, including slashes and colons. Case is kept.
Terminal window
curl https://kenari.id/v1/chat/completions \
-H "Authorization: Bearer $KENARI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "byok/deepseek/deepseek-v4-flash",
"messages": [{"role": "user", "content": "Hello!"}]
}'

The built-in providers are openai, anthropic, deepseek, xai, groq, mistral and opencode. A custom endpoint is addressed by the Provider name you gave it when you added the key. For example, a custom endpoint named my-proxy takes byok/my-proxy/<model-id-at-your-provider>.

To find the exact id, click Browse models on the key’s row and use Copy ID. This path never uses your balance. If you hold several keys for the provider, kenari tries them in priority order.

StatusCodeWhen
400byok_malformed_model_idThe id after byok/ is missing the provider or the model.
400byok_provider_not_foundYou have no key for that provider.
403byok_credential_unavailableYou have keys for that provider, but none can serve now because they are disabled or cooling down.
403byok_spend_capped_keyThe kn- key you sent has a spend cap.

See Errors for the full list.

A key with a Spend cap, Rp (optional) cannot use byok/ models. For why, and how to limit BYOK usage instead, see Authentication and API keys.