BYOK
Definition
BYOK (bring your own key) means the gateway forwards inference requests to an upstream provider with a provider API key that the customer supplies, rather than a key that the operator manages.
Function
BYOK lets a tenant use its own provider contract and billing relationship while the gateway still applies routing, guardrails and logging. The provider bills a call on the tenant's own key directly: Myra charges nothing for it, and it counts against neither the wallet nor the budget limits (the per-agent monthly spend cap excepted). Only Myra's own work on the same request, such as a step on a Myra-hosted model, is charged. Applications never hold the provider key; they use a gateway authentication token.
Rules and facts
- Provider keys are stored encrypted at rest with an integrity check. The encryption passphrase is held outside the database. The gateway never returns a stored key value; admin responses show only the alias and metadata.
- The gateway decrypts a key only for the matching gateway at request time. Deleting a key takes effect on the next request on the gateway instance that handled the delete; another instance can keep using its cached copy for up to the key cache lifetime, 60 s by default (see Deleting a BYOK key).
- A key is rotated by adding the new key and removing the old one. No restart is needed.
Scope
A BYOK key has one of two scopes:
- Gateway-level — used for inference requests routed through one gateway.
- Tenant-level — used by administrative and usage-synchronisation tasks.
On the inference path the gateway reads only the gateway-level key. If a required key is absent, the request fails with 424 provider_key_missing; there is no fall-through to a tenant-level key.
If the provider rejects your own key (HTTP 401, or a 403 authentication refusal, not a model-entitlement refusal), the request fails with 424 provider_key_rejected. The gateway never retries it on Myra's key, even for a model Myra also provides, and charges nothing. Replace the key in the provider settings.
Two exceptions use a Myra-managed key instead of a stored one:
- Managed (keyless) models — when the tenant enables a Myra-provided managed model and the gateway has no own key, the gateway injects Myra's pool key, charged to the tenant's wallet. The pool key is never sent to a custom provider base URL.
- Self-serve plans — the Anthropic credential of a self-serve tenant is always the managed pool key. The gateway verifies the workspace's allowance before each use and refuses an unverifiable or exhausted balance.
Keyless first-party providers (the Myra EU fleet) never need a stored key.
See also
- Provider key management (BYOK) — adding, rotating and deleting keys.
- Managed (keyless) models — the Myra pool key.
- Error codes —
provider_key_missing,provider_key_rejected,spend_unverified,quota_exceeded.