Skip to main content
By default, Mesh API routes inference through shared system credentials managed by us. With BYOK, you register your own provider API keys. Requests from your account then use your keys — giving you direct billing, quota control, negotiated rates, data-residency control, and access to provider-side features tied to your own account.
BYOK is opt-in and optional. Running on Mesh’s provider credentials is the right choice for most accounts.

Supported providers

Every provider has a matching test endpoint — POST /v1/provider-keys/test/{provider} validates credentials without saving them, and POST /v1/provider-keys/test/{pk_id}/{provider} re-tests one you already registered. Validate before you rely on a key.

Platform fee

BYOK traffic carries a platform fee of 5% of upstream cost. The first 1,000,000 tokens each month are fee-free.

Adding a provider key

Via Dashboard

Open the Dashboard and select BYOK from the sidebar. The page lists each supported provider — select the one you want to configure. Inside the provider page, use the Add button to register a key. You can add multiple keys per provider, but only one can be active at a time — enable the one you want to use.

Via API

Use the provider-specific registration endpoints. For example, to add an AWS Bedrock key using IAM credentials:
Credentials are stored encrypted in GCP Secret Manager — plaintext is never written to the database.

Using a provider key

Once registered, requests for that provider automatically use your key based on the team associated with your API key. No changes to your API call are required — the routing is transparent.

Fallback behavior

By default, if your key fails due to an auth error or rate limit, the request transparently retries using the shared system credentials. To disable this, set allow_fallback: false when registering the key:
This is useful for compliance scenarios where requests must not leave your account. A response served by the fallback carries the X-BYOK-Fallback-Triggered header. Don’t confuse it with X-Mesh-Routing-Fallback, which is about providers and models rather than credentials — see Retry & Fallback. Both can appear on the same response.

Key management

Deleting a provider key is a soft delete — the record is retained for billing history but excluded from future routing. Provider UUIDs are preserved for foreign key integrity.

Credential format by provider

Ensure the IAM user or role has bedrock:InvokeModel, bedrock:InvokeModelWithResponseStream, and bedrock:ListFoundationModels permissions on the models you intend to use.
Bedrock API keys are region-locked — the region must match the AWS region where the key was created and cannot be changed after creation.
Provide the service account key fields directly (as downloaded from the GCP console or gcloud iam service-accounts keys create):
The service account needs the roles/aiplatform.user role and aiplatform.endpoints.predict permission on your GCP project. Omit region or set it to "global" to allow requests to run in any available region.

Troubleshooting

Common BYOK failures and their causes:
BYOK errors surface with the provider’s HTTP status, not Mesh’s. A 401 here means your provider key was rejected — not your rsk_ key.
For a symptom-by-symptom walkthrough, see Troubleshooting → BYOK.