Skip to content
GitHubBook a demo

Set up

Models

Connect a model provider, choose models per role and control how 0 routes model calls.

0 uses your own model provider. Connect one in the browser or with an environment variable, then pick a model.

  1. Run 0 and open Settings → Models.
  2. Pick a provider. Paste an API key or follow its sign-in flow.
  3. A connected provider gets its default model automatically. To change it, open Settings → Models and pick a Default model, or pick a model in a thread with the model picker.

The model list comes from your connections. Models lists every model they serve and flags a connection that needs attention. Under Providers on the Models page, you can turn off single models of a connection. Public catalogs add price and context data but do not grant access; a listed model can still be unavailable to your account.

Export a provider key, then run any command:

Terminal window
export ANTHROPIC_API_KEY="sk-ant-..."
0 -p "Review ./your-repo for injection bugs"
Provider Environment
Anthropic ANTHROPIC_API_KEY
OpenAI OPENAI_API_KEY
ChatGPT Codex codex login, or ZERO_CHATGPT_ACCESS_TOKEN / ZERO_CHATGPT_OAUTH_REFRESH_TOKEN
OpenRouter OPENROUTER_API_KEY
Azure OpenAI AZURE_OPENAI_API_KEY, plus endpoint and deployment (details)
DeepSeek DEEPSEEK_API_KEY
Z.ai GLM Z_AI_API_KEY
Moonshot Kimi KIMI_API_KEY
Alibaba Qwen QWEN_API_KEY and QWEN_BASE_URL
xAI Grok XAI_API_KEY
OpenCode Zen OPENCODE_API_KEY (OPENCODE_BASE_URL to change endpoint)
Together AI TOGETHER_API_KEY (details)
Amazon Bedrock AWS credential chain, pinned with ZERO_SELECTED_PROVIDER=bedrock (details)

Pass ZERO_* variables with env, for example env ZERO_CHATGPT_OAUTH_REFRESH_TOKEN=... 0 config doctor.

Check what 0 found:

Terminal window
0 config doctor

0 config doctor prints the CLI version, runtime, operating system and Node.js check, then the API provider status: configured, bad (found but unusable, with the reason) or missing. It also lists claude, codex and gemini CLIs found on PATH. It checks local configuration only. The first model request proves the key, model access and quota.

  • Browser: the model picker in a thread changes that thread’s model while it is idle. Settings → Models → Default model sets the default for new threads. Existing threads keep their connection until you change it.
  • CLI: pass --model <id> or set ZERO_MODEL. --model wins.

Use an exact model ID your account supports:

Terminal window
env ZERO_SELECTED_PROVIDER=openai ZERO_MODEL=<model-id> \
0 -p "Review ./authorized-repo"

Agents need a model that supports tool calling.

Any OpenAI-compatible Chat Completions server works, local or remote.

On the Models page, in Providers, choose OpenAI / Custom AI Provider. Enter the base URL with its version path (for example http://localhost:20128/v1), the Custom model ID and the API key. HTTP and HTTPS both work. The model does not need to be in any catalog.

In a shell:

Terminal window
export OPENAI_API_KEY="your-provider-key"
export OPENAI_BASE_URL="http://localhost:20128/v1"
export OPENAI_MODEL="your-provider/model-id"
export ZERO_SELECTED_PROVIDER="openai"
0

0 appends /chat/completions to the base URL. Set OPENAI_WIRE_API=responses for servers that need the Responses API. Exported values override saved connection settings, and an explicit model choice overrides OPENAI_MODEL.

For OpenCode Go, use its published base URL, such as https://opencode.ai/inference/go/openai/v1.

Enterprise gateway: Bedrock through LiteLLM

Section titled “Enterprise gateway: Bedrock through LiteLLM”

Run models in your own AWS account by putting a LiteLLM proxy in front of Amazon Bedrock. 0 talks to the proxy as a custom OpenAI-compatible provider, so the proxy holds the AWS credentials and 0 never sees them.

A LiteLLM configuration file that exposes one Bedrock model:

model_list:
- model_name: claude-bedrock
litellm_params:
model: bedrock/anthropic.claude-sonnet-4-5-20250929-v1:0
aws_region_name: eu-central-1
general_settings:
master_key: os.environ/LITELLM_MASTER_KEY

Start it with litellm --config config.yaml, using the AWS credential chain of the host it runs on (an instance role, or AWS_* variables). Then point 0 at it:

Terminal window
export OPENAI_BASE_URL="https://litellm.internal.example/v1"
export OPENAI_API_KEY="your-litellm-key"
export ZERO_SELECTED_PROVIDER="openai"
export ZERO_MODEL="claude-bedrock"
export ZERO_NO_TELEMETRY=1
0 -p "Review ./authorized-repo"
  • ZERO_MODEL is the proxy’s model_name, not the Bedrock ID.
  • 0 calls <base>/chat/completions. Any other OpenAI-compatible gateway (vLLM, an API management layer, a vendor proxy) uses the same variables.
  • The Bedrock model must support tool use. 0 sends tool definitions in the standard OpenAI tools format and reads tool_calls back, which LiteLLM translates to and from Bedrock’s Converse API.
  • Leave ZERO_LLM_FALLBACK unset and do not export other provider keys, so no request can route elsewhere (Keep model traffic in one region).
  • Check the route without a scan: ZERO_RUNTIME_TRACE=1 0 -p "reply with ok" prints the chosen provider and model on stderr.

With ZERO_NO_TELEMETRY=1 (or DO_NOT_TRACK=1 or ZERO_OFFLINE=1) 0 sends no usage counts or crash reports and skips the public pricing and model-catalog lookups (OpenRouter and Models.dev). Model requests go only to OPENAI_BASE_URL. Prices for gateway models show as unknown. Still yours to control: the optional web_search tool is off unless ZERO_FEATURE_WEB_SEARCH=1, scan targets you point at are contacted by design, and GitHub is contacted only when you scan a GitHub repository.

Ollama serves an OpenAI-compatible endpoint, so connect it as a custom provider:

Terminal window
OPENAI_BASE_URL=http://localhost:11434/v1 OPENAI_API_KEY=ollama \
0 -p "Review ./authorized-repo" --model gemma4:27b

Pull a model that supports tool calling first. A remote Ollama server receives your source context.

On the Models page, in Providers, select ChatGPT Codex and follow the device sign-in. It runs codex login --device-auth and reloads the auth file when done.

From a shell, run codex login. 0 reads tokens from ~/.codex/auth.json at startup when no ZERO_CHATGPT_* token is set. A signed-in Codex session takes priority over stale OPENAI_API_KEY or AZURE_OPENAI_API_KEY values in your shell.

Variable Use
ZERO_CODEX_AUTH_JSON_PATH Read a different auth file. ZERO_CHATGPT_AUTH_FILE is a deprecated alias.
ZERO_CHATGPT_ACCESS_TOKEN, ZERO_CHATGPT_OAUTH_REFRESH_TOKEN Supply tokens directly. The access token is read first.
ZERO_CHATGPT_ACCOUNT_ID Set the account ID. Otherwise it comes from the auth file.

Codex uses its own auth file, not 0’s credential store. It rejects a generic --api-key. Choose OpenAI for an API-key connection.

Supply the key, the endpoint and the deployment ID, and pin the provider:

Terminal window
export AZURE_OPENAI_API_KEY="your-azure-key"
export AZURE_OPENAI_BASE_URL="https://your-resource.openai.azure.com/openai/v1"
export AZURE_OPENAI_WIRE_API="responses"
env ZERO_SELECTED_PROVIDER=azure ZERO_MODEL="your-deployment-id" \
0 -p "Review ./authorized-repo"
Setting Resolution
Endpoint AZURE_OPENAI_BASE_URL, then OPENAI_BASE_URL, then the Azure section of ~/.codex/config.toml
Model --model, then ZERO_MODEL. Without a pin, AZURE_OPENAI_MODEL or an Azure-backed Codex config model also works.
Wire AZURE_OPENAI_WIRE_API: chat_completions (default) or responses

Include /openai/v1 in a Responses base URL. The model picker lists deployments from your Azure resource through an existing Azure CLI sign-in; it never starts a login. With a key alone, enter the deployment ID by hand. 0 probes the endpoint once for its region; that is a diagnostic, not a residency guarantee.

0 calls Bedrock directly with the AWS SDK, so no proxy sits between 0 and your AWS account. Authentication is the standard AWS credential chain: environment keys, AWS_PROFILE (including SSO), an ECS task role, a web identity token or an instance role. Alternatively set AWS_BEARER_TOKEN_BEDROCK for a Bedrock API key. No AWS secret is stored in 0’s credential file.

Bedrock is never picked from ambient AWS variables. Pin it and name the model:

Terminal window
export AWS_PROFILE="audit-prod"
export AWS_REGION="eu-central-1"
env ZERO_SELECTED_PROVIDER=bedrock \
ZERO_MODEL="eu.anthropic.claude-sonnet-4-5-20250929-v1:0" \
0 -p "Review ./authorized-repo"
Setting Resolution
Credentials The AWS SDK chain. AWS_BEARER_TOKEN_BEDROCK wins when set.
Region AWS_REGION, then AWS_DEFAULT_REGION, then the profile’s region, then us-east-1.
Endpoint BEDROCK_BASE_URL for a VPC endpoint or an internal proxy; otherwise the regional bedrock-runtime endpoint.
Model A Bedrock model ID or cross-region inference profile ID your account can invoke. The default is global.anthropic.claude-sonnet-4-5-20250929-v1:0.

The model must support tool use through the Converse API. Bedrock runs on the pi-ai layer; ZERO_RUNTIME=legacy does not apply to it. bedrock:<model> also works in ZERO_LLM_FALLBACK when AWS credentials are configured. Prices for Bedrock models are shown as unknown. The model picker does not list Bedrock models yet; pass the ID with --model or ZERO_MODEL. To reach Bedrock through a LiteLLM proxy instead, use an OpenAI-compatible gateway.

Connect Together AI or export TOGETHER_API_KEY. The default endpoint is https://api.together.ai/v1; set TOGETHER_BASE_URL to change it.

Together model IDs look like other providers’ IDs (Qwen/..., deepseek-ai/...), so 0 never routes to Together by model name. Select it explicitly:

Terminal window
env ZERO_SELECTED_PROVIDER=together ZERO_MODEL=openai/gpt-oss-120b \
0 -p "Review ./authorized-repo"
# or, with no provider pin:
0 -p "Review ./authorized-repo" --model together/openai/gpt-oss-120b

The together/ prefix is removed once before the request. The default model is openai/gpt-oss-120b. The picker lists chat models with published prices; set TOGETHER_MODEL_LIST=all to list every chat model your key can see. Unlisted IDs, including dedicated endpoints, still work with --model.

Set QWEN_API_KEY and QWEN_BASE_URL for the same product and region shown in your account. QwenCloud, Model Studio, Coding Plan and Token Plan keys are not interchangeable, and 0 does not infer the region. Qwen OAuth is discontinued upstream.

  • OpenRouter: the browser sign-in provisions an API key for you. When OpenRouter is the selected provider, --model free maps to nvidia/nemotron-3-super-120b-a12b:free.
  • xAI and Kimi: browser sign-in needs a client registered for 0 in ZERO_XAI_OAUTH_CLIENT_ID or ZERO_KIMI_OAUTH_CLIENT_ID before the app starts. Otherwise use an API key.

OpenAI, OpenRouter, xAI and Azure accept OPENAI_WIRE_API, OPENROUTER_WIRE_API, XAI_WIRE_API and AZURE_OPENAI_WIRE_API set to chat_completions or responses.

With several keys set, 0 resolves the provider in this order:

  1. A pin. ZERO_SELECTED_PROVIDER selects the provider outright. Set ZERO_MODEL with it.
  2. The model name. --model or ZERO_MODEL routes by prefix when that provider has a key.
  3. Ambient priority. Otherwise the first configured key in the list below wins.

A connection is only Connected (green) after the provider accepted its key. 0 checks each connection once when you open Connections or Models and when you start a thread, with a short request that never blocks the page, and reuses the answer for about five minutes. The states are:

Badge Meaning
Connected The provider accepted the key.
Key rejected The provider answered 401 or 403. For a key from the environment the row says which variable to set; for a saved key it says to update it.
Can’t reach The provider did not answer in time. Check your network or the API endpoint.
Connected (grey) A key is present but the provider has no cheap check (for example Azure OpenAI), so it is not verified.

A rejected or unreachable provider is never picked as the default model for new threads, and a remembered model from it is skipped. If a message still fails with a rejected key, the thread names the provider and model and offers Switch to a model on a working connection (this resends your message) or Manage connection. The same states show on Settings → Diagnostics.

ZERO_SELECTED_PROVIDER accepts openrouter, anthropic, openai, azure, deepseek, chatgpt-codex, z-ai, kimi, qwen, xai, opencode, together and bedrock.

Terminal window
env ZERO_SELECTED_PROVIDER=deepseek ZERO_MODEL=deepseek-flash \
0 -p "Review https://example.com"

Pin when you need a predictable bill, especially with Azure deployment names.

Model ID Provider
together/<org>/<model> Together AI (prefix removed)
openrouter/* OpenRouter
glm-*, z-ai/*, IDs containing glm Z.ai GLM
qwen* Alibaba Qwen
k3*, kimi* Moonshot Kimi
grok*, xai/*, x-ai/* xAI Grok
opencode/*, muse-spark*, mimo*, ling*, big-pickle, nemotron*, minimax* OpenCode Zen
gpt-*, o1 to o4 ChatGPT Codex when signed in, else OpenAI
claude*, anthropic/*, IDs containing sonnet, opus or haiku Anthropic, else OpenRouter
Exact deepseek-flash, deepseek-v4-flash DeepSeek
Known Azure Foundry deployment IDs Azure

A match without that provider’s key falls through to ambient priority. These are routing rules, not an availability check.

  1. ChatGPT Codex (ZERO_CHATGPT_* tokens or ~/.codex/auth.json)
  2. DeepSeek
  3. OpenRouter
  4. Azure OpenAI
  5. OpenAI
  6. Z.ai GLM
  7. Moonshot Kimi
  8. Alibaba Qwen
  9. xAI Grok
  10. OpenCode Zen
  11. Anthropic
  12. Together AI

An explicit --api-key without a pin picks by shape: sk-or- selects OpenRouter, sk-ant- selects Anthropic, and anything else selects OpenAI-compatible access. Prefer environment variables; command-line secrets end up in shell history and process lists.

ZERO_LLM_FALLBACK lists backup routes for when the primary runs out of retries or hits a plan quota:

Terminal window
env ZERO_LLM_FALLBACK=deepseek:deepseek-flash,azure:gpt-5-deployment \
0 -p "Review ./authorized-repo"

Each entry is <provider>:<model>, comma-separated, tried in order. Entries without credentials (or, for Azure, without an endpoint) are skipped. Failover changes who receives your context and who bills you. A cyber access program request disables failover.

Variable Default Effect
ZERO_RUNTIME auto Provider client. auto uses the pi-ai layer for the routes it serves and the built-in client for the rest. legacy always uses the built-in client. pi-ai forces pi-ai and fails on routes it cannot serve.
ZERO_RUNTIME_TRACE unset 1 prints the chosen client, provider and model to stderr.
ZERO_MAX_COMPLETION_TOKENS 8192 Completion tokens requested per call. Positive integer; values above 131072 are clamped. Very small values truncate tool calls.

If a provider misbehaves under auto, set ZERO_RUNTIME=legacy and report it.

OpenAI’s Daybreak programs need an explicit request. A model name alone does not select one.

  • Browser: use the Daybreak control beside the model settings. Automatic clears the request.

The control requests access; it does not grant it. Reports keep the requested program separate from what the provider confirmed. Program-bound calls never fall back to another provider. Do not pass --api-key with ChatGPT sign-in.

Pin the provider and its endpoint with ZERO_SELECTED_PROVIDER and ZERO_MODEL, as in the Azure OpenAI example, and leave ZERO_LLM_FALLBACK unset.

  • Setting a provider’s variables alone does not guarantee all traffic goes there. Ambient priority and failover can pick other routes.
  • Other lookups still leave: the GitHub API and web search.

The same actions as Settings → Connections and Models are available as commands. Keys come from an environment variable or stdin, never from an argument.

Terminal window
0 models connect openai --key-env MY_OPENAI_KEY
0 models connect openai --test
0 models list --provider openai
0 models set --provider openai gpt-5.4-mini
0 models connect openai --remove --yes

Keys saved under Providers on the Models page are stored in plaintext at ~/.0/credentials.json, with 0600 file and 0700 folder permissions. Keep that file out of source control and bug reports. A nonblank environment variable wins over the saved key for that provider; Connections marks such a row From environment and the saved key Not in use. For CI and other automation, pass credentials in the environment.

  • Billing, model access and rate limits belong to your provider account.
  • Shown prices are estimates. Unknown prices are unknown, not zero.
  • A model connection does not authorize a target.