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.
- 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.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- 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 withABSK), or an API key in the OpenAI platform console (starts withsk-). Give it enough rate limit for your whole team. - 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.
- 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.
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 namevalar-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:
- 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.
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:
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:
- It assumes the role with your external ID.
- It tries again with a wrong external ID. AWS must refuse, which proves the role requires your external ID.
- It makes one small model call on each Endpoint your connection uses. With Also serve OpenAI models on, it also calls an OpenAI model.
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.
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 ondefault, which means
“not agreed”, so Bedrock refuses Fable 5 until you set it to provider_data_share.
On Mantle (the default endpoint) — one API call, made with your Bedrock key:
us. profile can serve from (us-east-1, us-east-2, us-west-2):
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:PutAccountDataRetentionpermission — typically an administrator signed in to the AWS account (the same AWS page’s “IAM actions reference” mapsPUT /data-retentiontobedrock:PutAccountDataRetentionandGET /data-retentiontobedrock: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 reportprovider_data_share, click Check key.
What the key check can tell you
Each line in the box is one situation and its action. The common ones: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 anx-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.