Skip to content

Bring your own key (BYOK)

Add your own provider key to a project so requests go out with it and the provider bills you directly; how the key is stored, validated, ordered and billed.

Markdown
On this page

BYOK (bring your own key) means adding one of your own provider keys to a project, for instance the key of your company's OpenAI or Anthropic account. Requests for that provider's models then go out with your key, and the provider bills you for inference directly. Nothing changes in your code: you keep sending requests to the same address with your Lykia API key.

BYOK is useful when you:

  • have an existing agreement, discount or quota with a provider and want to keep using it;
  • want the spending to show up in your own provider account;
  • want to use capacity a provider has set aside for you;
  • want to use image, video or speech models whose provider is not offered on Lykia credits yet.

Adding a provider key

Provider keys are added under Provider keys in a project, by the company owner, company managers or the project managers assigned to the project. Keys cannot be added to an archived project.

You can add keys for the providers Lykia connects to directly, for example OpenAI, Anthropic, Google AI Studio, xAI, DeepSeek, Mistral and Groq, and the image, video and speech providers such as Recraft, ElevenLabs, ByteDance, Black Forest Labs, Kling, Alibaba (Wan), MiniMax and fal.ai. The full list, with what each provider offers, appears when you add a key.

Most providers take a single API key. Some ask for more than one field, and the form shows exactly the fields the provider needs: Kling, for instance, takes either an API key or an access key with a secret key, and OpenAI takes optional organization and project ids next to the key. Secret fields are masked as you type and are never shown again; after saving, the dashboard lists only which fields are stored.

Paying with Lykia credits depends on the provider being enabled on Lykia; a request on credits to a provider that is not returns 403 with platform_sales_disabled. With your own key, every model of a supported provider works.

Each provider key has these settings:

  • Name: you can add several keys for the same provider; names tell them apart.
  • Enabled: a disabled key is not used but keeps its settings. A key you no longer need can be deleted; deleting is permanent.
  • Order: when you have more than one key for a provider, which one is tried first.
  • Always use: when on, requests to this provider's models never move on to Lykia's key at the same provider (details below).

How the key is stored and checked

  • The key is encrypted with AES-256-GCM before it is stored.
  • Once saved, the full key never appears in a response, a dashboard screen or a request log. Only a masked label made of its first and last four characters is shown.
  • When you save the key, Lykia calls a read-only endpoint at the provider with it (usually the model list). If the provider rejects the key, it is not saved and you see the reason. If the provider cannot be reached at that moment, the key is saved and the error is shown next to it. Press Validate in the dashboard to check the key again at any time.

Which key a request uses

For each model, Lykia lines up the candidates in this order:

  1. The project's own keys for providers that serve the model (in their configured order)
  2. Lykia's own key at those providers (the direct connection; only for models that have a price in the catalog)

There are no other candidates; Lykia does not send requests on to another place through an intermediary.

If an attempt with your key fails, the request moves on to the next candidate: your next key for that provider if you have one, otherwise Lykia's key, paid with credits. That happens on a connection error or timeout, a rate limit (429), a server error (5xx), when the provider rejects your key (401, 402 or 403, for example because the key was revoked or its account has no balance), and when the provider does not offer the model (404). If you would rather it did not:

  • turn on Always use for the key: Lykia's key at that provider is then left out for models that provider serves; or
  • turn on BYOK only in the project's routing settings: the project then never uses Lykia's keys at all. See Projects.

With Always use, another provider that serves the same model directly can still answer with Lykia's key. Use BYOK only if no request may be paid with credits.

Billing

  • For requests sent with your key, the provider bills you for inference directly. Lykia takes no inference charge from your credits, and the response's usage.cost is 0 and usage.is_byok is true.
  • Lykia still calculates the list-price equivalent of each request and records it, so usage and what it would have cost are visible in one place.
  • Your plan includes a monthly BYOK allowance per company, measured at list price over the calendar month in UTC. Once the company's BYOK total for the month passes the allowance, a fee at your plan's BYOK rate is charged on the list-price value of the excess. The fee is worked out for each request and shown in its record as byok_fee, but it is taken from your credits once a day, in one entry per project for the previous day. Current allowances and rates are on the pricing page.
  • Requests sent with your own key are accepted even when your credit balance is zero, as long as the company's BYOK usage this month is within the allowance. BYOK fees are deducted from the balance, so they can take it below zero. Once the balance is at or below zero and the month's allowance is used up, requests with your own keys return 402 until you top up, so that fees do not keep piling up as debt.

BYOK spending does not count toward key limits or project budgets by default; you can switch it on separately for each. When it counts, Lykia reserves the list-price equivalent of each BYOK request against that limit or budget before sending it, the same way it does for credits, and may lower the output limit to fit (Reservations). See Limits.

What is sent to the provider

With your own key, Lykia sends the request body to an OpenAI-compatible provider as it is, including fields Lykia does not know. Requests paid with credits are stricter: only a fixed list of fields is passed on (see POST /chat/completions). Audio input to a model that has an audio price also only works with your own key.

Checking that a request used your key

The provider field in the response tells you which provider served the request, and usage.is_byok whether your key was used. The request's record has the details: fetch it with the id from the response. A usage_type of byok means it went out with your key:

Request
curl "https://api.getlykia.com/v1/generation?id=gen-1795373726-0jZ1yhkSiujzuOfr" \
  -H "Authorization: Bearer $LYKIA_API_KEY"
Response200
{
  "data": {
    "id": "gen-1795373726-0jZ1yhkSiujzuOfr",
    "created_at": "2026-11-22T18:55:26.875Z",
    "model": "anthropic/claude-sonnet-4.5",
    "model_resolved": "anthropic/claude-sonnet-4.5",
    "provider": "anthropic",
    "streamed": false,
    "usage_type": "byok",
    "status": "ok",
    "finish_reason": "stop",
    "tokens": {
      "prompt": 1200,
      "completion": 350,
      "reasoning": 0,
      "cache_read": 0,
      "cache_write": 0
    },
    "cost": 0,
    "list_cost": 0.00885,
    "byok_fee": 0,
    "latency_ms": 4247,
    "ttft_ms": null,
    "attempts": [
      {
        "provider": "anthropic",
        "status": "ok",
        "latency_ms": 4203,
        "error": null
      }
    ],
    "app": {
      "referer": "https://example.com",
      "title": "Example App"
    },
    "user": null,
    "endpoint": "chat.completions",
    "preset": null,
    "metadata": {},
    "cost_details": {
      "upstream_cost": 0.00885,
      "platform_fee": 0,
      "is_byok": true
    },
    "kind": "chat"
  }
}

Here cost is zero, while list_cost is what the same request would have cost on credits. byok_fee stays 0 while the company's BYOK usage is within the month's allowance. All fields: GET /generation.