Docs › Account and usage › Bring your own key

Bring your own key

Use your own Anthropic API key, on plans from Pro up, so Anthropic models run on your Anthropic account and you choose the model yourself.

On this page

By default AstraCode runs on its own provider accounts, and AstraOne chooses the model for each step. If you would rather pay a provider directly, you can add your own Anthropic API key. Requests made with it go to Anthropic on your key and are not metered against your AstraCode allowance. Your own key is available on plans from Pro up; on Free and Student the editor does not offer it. See the pricing page.

You still sign in to AstraCode. The key decides who pays the provider; your AstraCode account is still what lets the editor use chat, the agent and completions. A key on its own does not get you past the sign-in window.

Add your key

  1. Create an API key in your Anthropic account. It starts with sk-ant-.
  2. In AstraCode, open AstraCode Settings > Models and choose Use my own key. The same is under Browser & Network > Your own API key > Manage, and in the command palette as AstraCode: Use My Own API Key (optional).
  3. Choose Add my Anthropic key.
  4. Paste the key into the box titled Your Anthropic API key and press Enter. A key that does not start with sk-ant- is refused with Anthropic keys start with "sk-ant-".
  5. The editor shows Checking your key…. It asks Anthropic whether it accepts the key, and AstraCode whether it has a model to run on it. The key is saved only when both say yes.
  6. The editor says Your Anthropic key is in use. You can choose the model in Settings. Choose a model opens AstraCode Settings > Models.

If the check fails, nothing is saved and the editor says why: Anthropic did not accept this key, AstraCode has no Anthropic model it can run on your key right now, Your own key is available on Pro and above, or Could not reach AstraCode to check the key. If Anthropic cannot be reached from your machine, that alone does not stop the key being saved.

The key is kept in your operating system's keychain through the editor's secret storage. It is never written to a settings file, so it is not in your settings sync or in a repository.

What changes with a key

Go back to AstraCode's key

  1. Run AstraCode: Use My Own API Key (optional) again.
  2. Choose Stop using my own key.
  3. The editor says Your key is removed. AstraOne is back on your plan's allowance. and the model list returns to AstraOne.

Limits

If something goes wrong

← Usage and limits What AstraCode sends and keeps →

All documentation

Get started

Using the editor

Agent

Context

Workspaces

Connectors

Extending AstraCode

CLI

Account and usage

Troubleshooting

Reference