API keys and profiles
Vibe Code CLI needs a Mistral API key to call hosted models. This page covers how to create the key, give it to the CLI, and switch keys between accounts or providers.
Browser-based sign-in is enabled by default when your config targets a model with a Mistral provider. The flow provisions and stores credentials for you, so no API key is needed for typical Mistral-provider setups. This page remains useful for non-Mistral providers, automation, troubleshooting, or when you want to use a custom API key.
Where to create your API key
Create your key from Code › Vibe CLI. The same key works in Free mode, with a paid plan, or with pay-as-you-go enabled.
Keep keys safe:
- Use the least-privileged key needed for the task.
- Rotate keys regularly and revoke unused ones from the console.
- Never paste API keys into prompts, logs, screenshots, or support tickets.
Give the API key to the CLI
The CLI supports three ways to provide your key. When more than one is set, the CLI uses the first key it finds, in this order: your shell environment, then ~/.vibe/.env, then your OS keyring (for example, macOS Keychain or Windows Credential Manager), where the setup flow saves keys.
1. Interactive setup (recommended)
On first run, the CLI starts a setup flow if it cannot find a key:
vibeYou can also rerun the setup at any time:
vibe --setupThe setup flow saves your key to your OS keyring for future sessions. If no keyring is available, it saves the key to ~/.vibe/.env, readable only by you.
2. Environment variable
Export the key in your shell:
export MISTRAL_API_KEY="your_mistral_api_key"Environment variables take precedence over values stored in ~/.vibe/.env and in the keyring. When a key set in your shell would override the key you save, the setup flow warns you.
.env file3. .env file
You can also edit ~/.vibe/.env directly:
MISTRAL_API_KEY=your_mistral_api_keyThe CLI loads ~/.vibe/.env automatically on startup.
The .env file is for credentials only. General CLI configuration belongs in config.toml. See Configuration.
Check which credentials Vibe uses
Run /status in a session to see the active model and provider, which credential source is in use, and which sources it overrides. Run /whoami to see your signed-in account, Workspace, plan, API key scope, and the credential source in use (shell, .env, or keyring).
Switch between accounts or providers
The CLI supports multiple providers and models through presets in config.toml. Use this to switch between, for example, a Mistral key for production work and a key from another OpenAI-compatible provider for experiments.
Define a provider preset and a model preset:
[[providers]]
name = "openrouter"
api_base = "https://openrouter.ai/api/v1"
api_key_env_var = "OPENROUTER_API_KEY"
api_style = "openai"
backend = "generic"
[[models]]
name = "mistralai/devstral-2512:free"
provider = "openrouter"
alias = "devstral-openrouter"
temperature = 0.2
input_price = 0.0
output_price = 0.0Set the active model:
active_model = "devstral-openrouter"Then export the matching API key:
export OPENROUTER_API_KEY="your_openrouter_api_key"You can also change the active model at any time inside the CLI with /config or /model.
Plan and billing notes
Mistral plans include monthly usage that is shared across Studio, the API, and Vibe Code. Vibe Code uses this included monthly usage before any pay-as-you-go charges apply.
After included monthly usage is exhausted, what happens next depends on your Organization settings:
- Pay-as-you-go off: Vibe Code can stop until the next billing period.
- Pay-as-you-go on: Vibe Code keeps working, and additional usage draws from your prepaid credits. When your balance reaches zero, Vibe Code stops until you add credits.
Pay-as-you-go is off by default. Some Pro plans purchased through partners (Google, Apple, Free Mobile, Orange) cannot enable pay-as-you-go. On those plans, Vibe Code stops once included monthly usage is exhausted.