Bring your own provider key
Use your own provider accounts through RouterPlus.
Bring your own key (BYOK) routes inference through your organization's own OpenAI, Anthropic or Azure API keys, or an AWS Bedrock workload role. You still call the gateway with a RouterPlus key. RouterPlus stores the provider credential encrypted, and the provider bills you directly. RouterPlus charges nothing for BYOK inference.
In the console, open Access > Provider connections, or use the API below.
Set up in the console
- 01Sign in, open
/console/byokand select your organization. - 02Click Add connection. Name it, choose a provider, enter its credential and add exact model IDs.
- Azure also needs a resource and a deployment mapping.
- You can select Bedrock only when RouterPlus has approved a role for your organization.
- You cannot change the provider or model list after you save. Create a new connection instead.
- 03Click Save and validate. If validation fails, the connection stays pending. Rotate its credential or retry validation. Do not create a duplicate.
- 04Choose the limits of an existing provider account, or enter RPM, TPM, concurrency and headroom for a new account. Credentials for the same account should share one pool or parent. A connection with no pool cannot serve requests.
- 05Create a new RouterPlus key or select an existing one.
- RouterPlus creates and binds a new BYOK key in one transaction before it returns it.
- The page warns before it replaces an existing key's connection or key-level policy. An organization or workspace policy still applies.
- 06Copy the new key once and use the generated request example. The optional Send test request sends "Reply OK" with at most 8 output tokens. It uses provider quota and can cost a small provider charge.
Each connection card can validate, edit shared-account limits, rotate, disable and delete.
- Viewers can read metadata. Owners and admins make changes.
- RouterPlus never returns provider secrets.
- A disabled connection becomes active again only after rotation and a successful validation.
- You cannot restore a deleted connection.
When you issue a key, you can select workspaces and principals from the identity API. The console keeps their limits and restrictions.
Set up with the API
- 01
Sign in to the console and create a virtual key. BYOK inference needs no marketplace credit.
- 02
Send
POST /api/connectionson the site origin, with JSON:{"profile":"openai","models":["your-exact-provider-model-id"],"api_key":"YOUR_PROVIDER_KEY"}Field Rule profileopenaioranthropic.azureneeds a deployment mapping: see Azure and policy setup.bedrocktakesworkload_roleinstead ofapi_key: see Bedrock.models1 to 100 exact model IDs. No wildcards. nameOptional label. The response is
201withconnection_idandstatus: "pending". It never returns the key. - 03
Send
POST /api/connections/{connection_id}/validatewith{}. Success returnsvalid: trueandstatus: "active". For API-key profiles, validation makes one authenticated model-list GET, with a 10-second timeout and no generated tokens. It does not check access to every declared model or reserve capacity. - 04
Send
POST /api/connections/{connection_id}/bindwith{"key_id":"YOUR_VIRTUAL_KEY_UUID"}. This binds an enabled virtual key in the same org to an active connection. A key that served marketplace traffic takes up to 5 seconds to switch. You can use a new virtual key instead. - 05
Declare a quota pool for the provider account and assign the connection to it. A route with no declared pool returns 503. Credentials for the same account must share one pool or parent.
- 06
Use the virtual key with
/v1/chat/completionsor/v1/messages. Both request formats and streaming work with each profile, within the wire compatibility limits.
Management rules:
- Management needs the
tm_ssession cookie. - Writes also need
Content-Type: application/jsonand anOriginheader equal tohttps://demo.routerplus.com. - A same-origin browser
fetchsends the cookie and Origin for you. A CLI client must send both. Keep cookies and provider keys out of shell history. - An inference key cannot manage connections.
- Viewers can read. Owners and admins can write.
Management operations
| Method and site path | JSON body | Effect |
|---|---|---|
GET /api/connections | none | Newest 100 connections of your org, deleted ones included |
GET /api/connections/{id} | none | One connection's metadata and fully masked label |
POST /api/connections | profile, models, api_key or workload_role, optional name, endpoint_config | Create a pending connection |
POST /api/connections/{id}/validate | {} | Check the credential and activate on success. A failed validation leaves the connection pending. |
POST /api/connections/{id}/rotate | api_key or workload_role | Revoke old versions and create a pending version. Validate it before use. |
POST /api/connections/{id}/disable | {} | Disable the connection and revoke its credential versions |
POST /api/connections/{id}/bind | key_id | Bind or rebind a virtual key of your org to an active connection |
DELETE /api/connections/{id} | {} | Revoke and mark deleted. Attribution and bindings are kept. |
Lifecycle rules:
- To restore a disabled connection, rotate and validate a new credential.
- You cannot restore a deleted connection.
- Rotation stops new inference until validation succeeds.
- A profile or model-list change needs a new connection and an explicit rebind.
- You cannot unbind a key back to marketplace routing. Use a
house_onlypolicy from the policy API instead. - Management responses never show a secret suffix, ciphertext, envelope or provider validation body.
Inference behavior
Routing
- A bound key can use only its connection's exact models. It never falls back to marketplace supply on its own.
/v1/modelslists the connection's models.- Anthropic token counting uses the same connection, on an Anthropic profile only.
- Image generation works through an
openaiconnection. List the exact image model ids you will send (matching is literal). OpenAI bills the render to your account, sousage.costis0. See POST /v1/images/generations. - Supported destinations are OpenAI, Anthropic and configured Azure v1 public endpoints. Bedrock uses the workload-role profile. RouterPlus refuses redirects and arbitrary endpoints.
- BYOK gives no private-link, residency or retention guarantee.
- Routing policies add ordering, filtering and funding controls.
Errors
| Status | Cause |
|---|---|
401 auth | The virtual key is invalid. |
404 model_unavailable | The binding is unavailable, disabled or deleted. |
503 gateway_error | A database or decryption failure. |
| 400 | The request sends its own credentials or destination (api_key, base_url and the like). |
RouterPlus never relays provider HTTP error bodies, so an echoed credential cannot leak.
Billing
- RouterPlus meters and audits BYOK inference.
- RouterPlus charges
0. The attempt'sbilling_sourceisbyokand itscost_usdis0. - The inference cost is
null, because RouterPlus does not price your provider account. The provider bills your account. - Marketplace spend caps do not limit that provider bill. Virtual-key RPM limits and your organization's token and concurrency limits still apply, including to token counting.
- A BYOK key spends RouterPlus credit in one case: a policy with marketplace fallback. The marketplace attempt reserves and charges like any marketplace call.
Changes and outages
- New calls see a disable or rotation within 5 seconds. Calls and streams already started can finish on their original credential version.
- When the configuration database is unreachable, authority that RouterPlus already verified can serve for a bounded time. See limits and outage behavior.
- Validation and token-count calls are not inference ledger attempts. Validation writes a management audit event with no content.
- Shared limits and pilot fairness are in the admission guide.
Related
- Workspaces and principals: scoped keys and trusted end-user limits.
- Bedrock workload-role profile: native regional Claude inference. Its write-only
workload_rolereplacesapi_key.
The connection lifecycle, the quota-pool rule and the zero RouterPlus charge are the same for every profile.
For agents: /docs/byok.md and /llms.txt