Skip to main content
If your organization already buys model capacity directly - from Anthropic, from AWS through Amazon Bedrock, or from OpenAI - you can serve the matching ValarCode traffic on your own key. Valar routes the request, meters the tokens, and charges you nothing for the inference. Your provider bills your account for it. You can store one key of each kind. A key covers the models of its own provider, and nothing else. An Anthropic or AWS Bedrock key serves your Claude-tier traffic; an OpenAI key serves the OpenAI models. A Bedrock key also serves OpenAI models when you enable Also serve OpenAI models on this key. Traffic to a provider you have stored no key for keeps running on Valar-managed providers and is billed by Valar, exactly as it was before you stored anything. This is often called BYOK — bring your own key.

Who it is for

Use your own key when:
  • You hold commitments, credits, or negotiated rates with Anthropic, AWS or OpenAI that you want your coding traffic to draw down.
  • Your procurement or compliance process requires frontier spend to sit on your own provider account.
Stay on Valar-managed providers when:
  • You want a single bill, or you have no account of your own with that provider.
  • You want Valar’s spend caps and failover to keep protecting your team. Both stop applying to requests served on your key — see What you give up, which you should read before you turn this on.
Using your own key is turned on per organization, by arrangement with Valar. Talk to your Valar contact to have it enabled for yours.

What you give up

Two guardrails stop applying to any request served on your key. Both are deliberate, and neither is recoverable by retrying.
No fallback onto Valar’s keys. If your provider cannot serve the request, the request fails.A request served on your key uses only your keys. Whichever Bedrock endpoint your key is set to, if that endpoint fails the request, it can move to your Anthropic key, and never to a Valar-paid one. If your provider is down, or your key is rate-limited, revoked, or wrong, the request returns an error to the harness: Valar never moves your traffic onto a credential you did not choose.Plan for it the way you would plan for calling the provider directly: keep enough rate limit headroom on your own account for your whole team’s coding traffic, and know that a provider incident is now visible to your engineers.The one exception is arranged, not configured. If you would rather keep working through a provider incident and pay Valar for those requests, ask your Valar contact to turn on fallback to Valar for your organization. It is off unless you ask. With it on, your keys are still tried first, in the order you chose; a request that none of your keys can serve is then served on Valar’s account and billed at your Valar rates, as normal usage rather than BYOK usage. The ValarCode settings page says when it is on for your organization. Valar’s spend limits still do not screen such a request up front (see the next box), so a fallback request is billed after the fact.
No spend cap. Your Valar spend limits no longer apply to this traffic.Valar’s per-engineer monthly and daily quotas and your organization’s spend limits and credit checks exist to stop a runaway agent from spending your money with us. They cannot govern spend that never reaches us: on your key the tokens are billed directly to your own provider account, with no Valar-side ceiling in front of them.Valar’s per-organization request rate limit is skipped for the same reason, so your provider account’s own rate limits are the only ones in front of this traffic.Set your budget where the spend now lands - use your provider’s own spend limits and usage alerts on the account that owns the key. Per-engineer pause still works, so you can still stop an individual engineer, and so do request limits set with the Quotas API.

Add, rotate, or remove your key

Once your organization is enabled, a box per provider appears under Bring your own key on the Settings - ValarCode settings page: Anthropic API key, AWS Bedrock API key and OpenAI API key. Each box carries a badge for the traffic that key serves - Claude, OpenAI, or both. You need the organization admin role to change a key; any member can see whether one is set. Add a key
  1. Create the key on the account you want the traffic billed to - an API key in the Anthropic console (starts with sk-ant-), a long-term Bedrock API key in the AWS console under Bedrock -> API keys (starts with ABSK), or an API key in the OpenAI platform console (starts with sk-). Give it enough rate limit for your whole team.
  2. Expand the box, paste the key, and click Check & save. Valar checks the key with the provider before storing anything: a key the provider rejects is not stored, and the box says why. A key that passes is stored encrypted and switched on.
  3. The box now shows the verdict — Verified just now: Anthropic accepted this key. — and a locked API key field with a redacted fingerprint (sk-ant-api0…, ABSK…bz0=) so you can tell which key is in place. The verdict stays: after a reload it reads Verified 3 minutes ago, or Check failed 2 days ago: … with the reason.
It takes effect on the next request. There is nothing to change on any engineer’s machine — no new connect command, no config edit. Check a key later Click Check key at any time to re-test the stored key (expired, revoked, model access changed). The result is remembered, so the box tells the next person what the last check found. Rotate a key Click Rotate key, paste the new key, and click Check & save. The new key is tested and then replaces the old one in place. Rotate on your own schedule the same way you would rotate any provider key: create the new one, save it here, then revoke the old one at the provider. Turn a key off without deleting it Use the switch next to the box title. Off means the key stays saved but is not used - the traffic that key serves uses your other enabled key for the same models, if you have one. Otherwise it runs on Valar-managed providers with normal charges. Remove a key Click Remove key and confirm. From the next request, the affected models use your other enabled key for those models, if you have one. Otherwise they return to Valar-managed providers with normal Valar inference charges and spend caps.
The key is stored encrypted and is never shown again — not in the dashboard, not in the API, not in a log. Only the redacted fingerprint is ever displayed.

OpenAI key

An OpenAI API key serves OpenAI models through the Messages API, the Codex Responses API and Cursor. It does not affect your Claude traffic: that keeps running wherever it ran before - on your own Anthropic or AWS key if you store one, on Valar-managed providers otherwise. When you save or check an OpenAI key, Valar asks OpenAI which models the key can reach and lists any OpenAI model it cannot. That usually means the key’s OpenAI project has not been granted access to the model; grant it in the OpenAI console and click Check key again. The key is still stored - it authenticated, and the models it can reach are served on it. This check lists available models without generating tokens. It does not verify your credit balance or permission to generate responses. A request can still fail if either is missing. Any OpenAI key shape works (sk-, sk-proj-, sk-svcacct-). Use one whose project has the spend limits and rate limits you want for your whole team.

AWS Bedrock key

A Bedrock API key works from any AWS region. Which AWS endpoint Valar calls with it, and where in the world the model runs, is set by the Endpoint and region controls in the key box; the default lets AWS decide.

Connect with an IAM role instead of a key

With a role, Valar assumes a role in your own AWS account for 15-minute sessions and signs each Bedrock request with them. No long-lived credential leaves your account. The sessions show in your CloudTrail under the session name valar-bedrock. It is still one Bedrock connection. A role replaces the key, and the Endpoint, Region, Also serve OpenAI models and Use first settings work the same. In the AWS Bedrock box, set Connect with to IAM role. The box then shows three Setup steps. 1. Create the role In AWS IAM, go to Roles → Create role → Custom trust policy, and paste the policy the console shows. It lets Valar take on the role only when it presents your external ID. It has this shape:
Copy the policy from the console, not from this page. The console fills in both values for you. Writing your own policy? If you manage the role in Terraform or CloudFormation, or you are editing an existing role, click Writing your own policy? Show the values under the trust policy. It shows the two values, each with a Copy button:
  • Valar’s identity: the principal your trust policy must allow.
  • Your external ID: Valar generates it once for your organization. It never changes, and you can’t pick it. It is not a secret. It stops another Valar customer from using your role.
Your policy must allow sts:AssumeRole for Valar’s identity only when sts:ExternalId equals your external ID. 2. Let it call Bedrock Open the new role, go to Add permissions → Create inline policy → JSON, and paste this:
It covers both Endpoints: the two bedrock: actions are for bedrock-runtime, and bedrock-mantle:CreateInference is for Mantle. A role does not need the CallWithBearerToken actions; those are for API keys only. 3. Paste the role’s ARN below and click Check & save Copy the ARN from the top of the role’s page in AWS. It looks like arn:aws:iam::<account>:role/<name>. Paste it into IAM role ARN and click Check & save. What Check & save checks Valar checks the role before it stores anything:
  1. It assumes the role with your external ID.
  2. It tries again with a wrong external ID. AWS must refuse, which proves the role requires your external ID.
  3. It makes one small model call on each Endpoint your connection uses. With Also serve OpenAI models on, it also calls an OpenAI model.
If all three pass, the role is saved and switched on, and the box reads Verified and saved: AWS accepted this IAM role. If one fails, nothing is stored, and the box says why. Check IAM role runs the same check on the saved role at any time. Endpoint and region with a role. Both Endpoints work with a role, and the permissions policy from step 2 covers both. When you change Endpoint or Region and click Save & check, Valar first checks your saved role on the new Endpoint. It saves the change only if the check passes. If it fails, the box says Not applied: with the reason, and your traffic stays on the current endpoint. OpenAI models on a role. The Also serve OpenAI models on this IAM role switch works the same as with a key: AWS bills the account that owns the role. The permissions policy from step 2 already allows the calls. After you turn the switch on, click Check IAM role to confirm the role can reach an OpenAI model too. Switching between a key and a role. Set Connect with to the other choice, paste the key or the role’s ARN, and click Check & save. The new one is checked first. Only when it passes does it replace the old one. If the check fails, nothing changes and the old one stays in use. Your Endpoint, Region, Also serve OpenAI models and Use first settings carry over. To point at a different role, click Change IAM role. To disconnect the role, click Remove IAM role. Cutting Valar off. Remove Valar’s identity from the role’s trust policy, then use Revoke active sessions on the role in AWS. Removing the trust stops new sessions. Revoking ends the sessions Valar already holds at once. If you only remove the trust, access ends within 15 minutes at the latest. If the role can’t be used, for this or any other reason, requests are refused with a message that starts Your AWS role for Bedrock could not be used: and says what to fix. They are never served on Valar’s account.

Also serve OpenAI models on your Bedrock key

Bedrock supports OpenAI models as well as Claude models; your AWS account must have access to them. The Bedrock box has a switch - Also serve OpenAI models on this key - that extends the key you already stored to that traffic too. It is off by default and stays off until you turn it on, so a key you stored for Claude keeps serving Claude only, and your OpenAI-model spend does not move onto your AWS bill without you asking for it. Turning it on re-checks the key. With it on, AWS bills you for OpenAI traffic served on this key and Valar charges $0. With it off, OpenAI traffic uses your enabled OpenAI API key, if present, or Valar-managed providers with normal charges. If both keys are enabled for OpenAI, requests can use either of your accounts. The Bedrock check verifies Claude access; it does not verify OpenAI model access or change that access in AWS. On the default Mantle endpoint, GPT-6.1 Sol, GPT-6 Sol, GPT-6 Astra and GPT-6 Luna are called in the US East (N. Virginia) region (us-east-1), the region where AWS offers all four. Make sure your AWS account has access to them in that region. With bedrock-runtime + US, every OpenAI model on your key is called through bedrock-runtime with its us. inference profile, the same way Claude models are. When you save or check a Bedrock key, Valar tests it against every Claude model it can serve on your Bedrock key, on the endpoint you selected, and the box lists any model the key authenticated for but cannot use, with the reason. Two kinds of line:
  • Transient — AWS was overloaded, timed out, or is still enabling the model on your account (the first use of each model creates a Marketplace subscription, which takes about a minute). The key is fine; click Check key again. If an Overloaded line persists for one model while the others work, your account’s on-demand throughput quota for that model is probably zero — new accounts start there for Opus-class models. Request an increase in the AWS console (Service Quotas → Bedrock), then check again.
  • Not usable on your AWS account — the account itself blocks the model. The line says what to change; the common cases are under What the key check can tell you.

Endpoint and region

AWS offers two endpoints that accept the same Bedrock API key for Claude and OpenAI models. The Bedrock key box lets you pick which one your traffic uses. The setting applies to both: with Also serve OpenAI models on, your OpenAI-model traffic uses the endpoint you pick too. Changing a select does not apply anything by itself — the row reads Not applied yet until you commit it with a button:
  • Key or role already stored: click Save & check. Valar first checks your stored key or role on the endpoint you picked, and saves the setting only if the check passes. If it fails, the box says Not applied: with the reason, and your traffic stays on the current endpoint. Cancel puts the selects back and saves nothing.
  • Adding or rotating a key: the selects are part of the form and are saved together with the key when you click Check & save. The new key is tested on the endpoint you picked.
When to use bedrock-runtime + US. Choose it when your AWS organization blocks global routing, or requires that your Claude and OpenAI traffic stays in US regions. On Mantle, AWS resolves the model itself and may serve it from any region; a policy that denies that will fail your Fable 5 requests (and may let other models quietly leave the US). On bedrock-runtime with US, Valar asks for the model’s us. inference profile, so the request is served only from US regions. Note that AWS prices US-region (geographic) inference about 10% higher than global inference — see Amazon Bedrock pricing. The same key, different permissions. The two endpoints are gated by different IAM actions — bedrock:InvokeModel and bedrock:CallWithBearerToken for bedrock-runtime, bedrock-mantle:CreateInference and bedrock-mantle:CallWithBearerToken for Mantle (see AWS: API keys → Control who can generate and use API keys for the two CallWithBearerToken actions, and Bedrock Mantle → Prerequisites → Permissions for bedrock-mantle:CreateInference and bedrock:InvokeModel) — so a key that passes on one can fail on the other, and a policy in your AWS organization can allow one and deny the other. That is why the key check always runs on the endpoint you selected. If it fails when you switch, the switch is not applied; ask your AWS administrator to allow the actions for that endpoint on the key’s IAM user. Failover is unchanged. With both keys, a request that fails on your selected Bedrock endpoint falls back to your Anthropic key. With a Bedrock key only, it returns a clear error to the harness instead — it is never served, and never billed, on Valar’s account, unless you arranged fallback to Valar with your Valar contact.

Claude Fable 5 needs an opt-in

Anthropic treats Claude Fable 5 (and Mythos 5) as covered models: AWS only serves them if your account has agreed that prompts and completions may be shared with Anthropic and kept for up to 30 days for safety review. Older Claude models do not require this. AWS enforces it through an account setting called the data retention mode; a new account starts on default, which means “not agreed”, so Bedrock refuses Fable 5 until you set it to provider_data_share.
AWS stores this setting separately for each endpoint. Opting in through Mantle’s API does not cover bedrock-runtime, and the other way round. Opt in on the endpoint your key is set to; if you switch endpoints later, opt in again on the new one.
On Mantle (the default endpoint) — one API call, made with your Bedrock key:
To limit the sharing to one Bedrock project instead of the whole account, set it on the project the key belongs to:
On bedrock-runtime + US — the setting lives on the Bedrock control plane, per region. Under cross-region inference AWS stores retained data in the region that served the request, so set it in each US region the us. profile can serve from (us-east-1, us-east-2, us-west-2):
Or, without the AWS CLI: PUT https://bedrock.<region>.amazonaws.com/data-retention with the body {"mode":"provider_data_share"}, once per region, signed with AWS credentials. Both forms are the same control-plane API — see AWS: Data retention → Configuring data retention → Set account-wide data retention → Bedrock Control Plane (the PUT /data-retention call; the CLI command is its aws bedrock surface). Two things to know about this call:
  • A Bedrock API key cannot make it. It needs an IAM identity (a user or role) with the bedrock:PutAccountDataRetention permission — typically an administrator signed in to the AWS account (the same AWS page’s “IAM actions reference” maps PUT /data-retention to bedrock:PutAccountDataRetention and GET /data-retention to bedrock:GetAccountDataRetention).
  • It can take up to about an hour to propagate. Confirm it with aws bedrock get-account-data-retention --region <region> in each region (AWS: “Check your current configuration → Bedrock Control Plane”); when all three report provider_data_share, click Check key.
Then click Check key; the Fable 5 line disappears. Until you opt in, the other Claude models work on your key and a Fable 5 request on it fails. Details: Amazon Bedrock — Data retention. Claude Fable 5.1, the current Fable fallback, is not on Bedrock yet, so it is served only through an Anthropic key. A Bedrock-only key cannot serve a Fable-class request that falls back to it; add an Anthropic key alongside, or pin the Fable slot to Claude Fable 5 in the routing editor.

What the key check can tell you

Each line in the box is one situation and its action. The common ones:
Temporary keys expire. A 12-hour Bedrock API key (starts with bedrock-api-key-), or a long-term key with an expiry set in AWS, stops your Claude traffic when it lapses — and Check key cannot see an expiry date. Use a long-term key, and rotate it here before it expires. The box warns when you paste a temporary key, but does not stop you.

What it costs

Valar still counts every token so the traffic is measurable. It is simply priced at zero, because your provider bills your account for it. Your open-weight traffic is unchanged: those models are still served and billed by Valar. A routing policy that mixes open-weight, Claude, and OpenAI models can produce both provider charges and Valar charges.

Exactly which requests use your key

On the supported APIs below, requests served by a model for which you have an enabled, eligible key use that key. This includes Auto routing and capability escalations to those models. Claude fallback requests on the Messages API also use your eligible Claude key. Requests served by an open-weight model remain billed by Valar. BYOK covers these coding requests: Claude requests made through Cursor or Codex do not use your stored provider keys. The OpenAI support above does not extend Claude BYOK to those tools.

Where this traffic shows up

Requests served on your key appear in BYOK usage on the ValarCode Metrics tab once the selected time window contains own-key requests. Valar records the tokens and charges $0 for inference. Estimated spend in that section prices the recorded tokens at each model’s list prices. It is an estimate: it does not include discounts or commitments you have with the provider, or a model’s higher rate for very long prompts. The savings summary at the top of the tab counts that estimate as spend: Actual spend is what Valar billed plus the estimate, and the comparison figure rises by the same amount. Own-key traffic therefore adds no savings, and the saved percentage reflects all of your coding spend. The token and model panels still leave this traffic out. The Users tab does the same for each engineer: Spend is what Valar billed for them plus the estimate for their own-key requests, and the percentage under Savings reflects both. Hover the amount to see the own-key part. The spend chart, quotas and the Auto budget count only what Valar bills. For the actual cost, use your provider’s usage dashboard: Anthropic, OpenAI, or AWS Cost Explorer for Bedrock. That provider bills your account.

Which of your keys answered

With more than one key connected (say an Anthropic key and an AWS Bedrock key), each response served on one of them names it in an x-valar-served-byok header: anthropic, bedrock or openai. The header comes with the served model, under the same Show serving model name in the response metadata headers setting. A response served on Valar’s own account carries no such header.

Next steps

Model routing

Decide which requests reach Claude in the first place.

Analytics & savings

See what the panels measure, and why own-key traffic sits outside them.