Phew Install

Use your own API key with an AI coding agent in VS Code

Updated · 3 min read

With your own API key, you choose the model, pay the provider directly for what you use, and need no extra subscription. Phew connects to the big providers, to gateways, and to any OpenAI-compatible API.

Connect a model

  1. Create an API key in the console of your provider.
  2. Run Phew: Connect a Model, or open Settings → Models, and pick the provider.
  3. Paste the key. Phew loads the list of models from the provider; pick one.
  4. Click Connect and test. Phew checks the key, the model, and that tool calls work.

Phew has presets for OpenAI, Anthropic, Google Gemini, Azure OpenAI, Mistral, xAI, DeepSeek, Groq, Cerebras, Together AI, Fireworks AI, OpenRouter, and LiteLLM. For anything else, choose Custom OpenAI-compatible API and enter its address.

Switch the model later

Open the settings of a model (⋯) and click Choose… next to its name. Phew lists the models of the provider with your saved key, by name and with their context windows. A click switches the model, takes its context window, and tests it.

Where the key is kept

Phew keeps keys in the secret storage of VS Code, never in settings.json. You can also read a key from an environment variable. Model settings come only from your user settings, so a project that you open cannot send your key to another server.

Company sign-in with short-lived tokens

Some companies give no long-lived keys. A model can get its token from a command that you trust, for example gcloud auth print-access-token for Google Vertex AI, or the Azure CLI for Azure with Entra ID. Phew runs the command again when the token expires.

Two keys, or several models at once

Connect a provider twice to use two keys, for example a work key and a personal key. Each chat keeps its own model: choose it in the menu under the input. Two chats, or two windows, can work at the same time with different keys, and a choice in one never changes another.

When a key runs out of quota

Open ⋯ on the card of a model and choose a Fallback model. When the model runs out of quota or credit, or stays rate limited after all retries, the fallback goes on with the same task, and the chat says why. A wrong key never falls back: that needs a fix, not a quiet switch.

Keep the cost under control

  • Phew fills the price of a model by itself from the public price list of OpenRouter, which has the prices of Anthropic, OpenAI, Google, Mistral, and xAI models. A price that you type in ⋯ → Price is yours, and Phew never changes it.
  • Set a Monthly budget in the settings of a model: a small ring next to it shows what Phew spent of it this month.
  • With OpenRouter or DeepSeek, turn on Show what is left of the plan in the settings of the model: a click on the small ring next to it shows your credits or balance. Anthropic, OpenAI, and Gemini do not share it with an API key.
  • Set phew.budget.maxCostPerTask or phew.budget.maxTokensPerTask. A task stops when it reaches the limit.
  • Give research to subagents with a cheaper model: set phew.subagents.model.
  • Keep chatting within a few minutes: with Anthropic, Phew puts the instructions and the conversation in the prompt cache, so the next messages read them at 10% of the price. OpenAI and Gemini cache by themselves, and Phew counts their discount too. For an exact cost, add the price of cached input in ⋯ → Price (price.cachedInput).
  • Open the folder of one project, not a folder with many: its rules then fit the task, and every request is smaller. Phew: Show Log shows what fills each request.