~/.atomic/agent/models.json. Set ATOMIC_CODING_AGENT_DIR (or legacy PI_CODING_AGENT_DIR) to use another directory.
- Single file, no merging. Atomic reads only
models.jsonfrom the active agent directory. It does not read project-scoped.atomic/models.json, fall back to~/.pi/agent/models.json, or merge.piand.atomicmodel files. - Syntax and schema.
models.jsonsupports//line comments, trailing commas, and leading UTF-8 BOMs (/* */block comments are not supported). Add"$schema": "https://raw.githubusercontent.com/bastani-inc/atomic/main/packages/coding-agent/schemas/models.schema.json"for editor validation and completion. - Reloading and errors. Open
/model, open/scoped-models, or run/reloadafter savingmodels.jsonto reload without restarting. Ifmodels.jsoncontains a JSON or schema error, Atomic ignores the file, keeps built-in providers working, and shows an error banner in/model.
models.json field reference. For compatibility flags, value resolution, overrides, cost tiers, and derived fast variants, see Model runtime & overrides.
Add a local or OpenAI-compatible model
For local servers such as Ollama, LM Studio, or vLLM, onlyid is required per model; add explicit limits, modalities, pricing, and prompt cache lifetimes when needed.
- Minimal
- Full
apiKeyis optional in the schema, so you can omit it and save a key later via/login <provider>. However, Atomic lists a provider’s models as available only when some credential is present, which is why local servers such as Ollama use a placeholder like"apiKey": "ollama".- Every provider entry must be non-empty and include at least one of
baseUrl,headers,compat, non-emptymodelsormodelOverrides,apiKey, orauthHeader. An empty{}object, or an entry containing only"models": []or"modelOverrides": {}, fails validation. - Required fields for custom
models: Any custom provider definingmodelsrequiresbaseUrl(unless overriding a built-in provider that already has one) and anapiat either the provider or model level.
OpenAI-compatible server compatibility
Some OpenAI-compatible servers (such as Ollama, vLLM, or SGLang) reject thedeveloper role or reasoning_effort. Set compat flags at the provider level (applies to every model under that provider) or the model level (overrides provider defaults):
Request tracing and duplicate charges
X-Client-Request-Idlets OpenAI look up a request, even if the connection dropped before it returned anx-request-id. By default, Atomic sends a fresh UUID for every Chat Completions or Responses attempt toapi.openai.com, including retries. This doesn’t change the session ID or prompt-cache key. Tracing IDs, including Cloudflare’scf-aig-event-id, do not prevent duplicate execution or billing.- Z.ai and Zhipu Coding CN get a fresh request ID on every attempt, including retries. The ID helps the provider look up a request that timed out; it does not prevent duplicate work or charges.
Idempotency-Keyasks a supporting endpoint not to run the same operation twice. Atomic keeps the key for retries of the same request and uses a new one for the next request. This is off by default. Only enable it for models usingopenai-completionsoropenai-responseswhose endpoint explicitly documents support. Whether a duplicate is billed, and whether a retry can retrieve the original answer, depends on the endpoint.
~/.atomic/agent/models.json, set OP_API_KEY in the environment where you launch Atomic, and select /model op-inference/openai/gpt-oss-120b:
409 idempotency_conflict for a duplicate chat completion instead of replaying the answer. Atomic stops retrying that request when it gets this error. If you configured a fallback model, Atomic can still try it as a new request, which may incur a separate charge. Don’t set a static Idempotency-Key in headers: a key must never be shared between unrelated requests.
Prompt cache lifetimes
DeclarepromptCache with positive lifetimes in seconds for short and long cache-retention tiers when configuring a custom model or overriding a built-in model:
promptCache altogether) if your endpoint does not advertise a predictable prompt-cache TTL.
Proxy a built-in provider
To route a built-in provider through an HTTP proxy while keeping its built-in models, authentication, and derived-fast variants, set only baseUrl:
Add a Google AI Studio model
Usegoogle-generative-ai with a baseUrl to add Google AI Studio models such as Gemma 4:
Catalog refresh and startup defaults
/model and /scoped-models display cached authenticated catalogs immediately while refreshing network-backed catalogs in the background for up to 15 seconds. Closing either picker cancels the refresh. From the shell, use --model, --models, --list-models and atomic update --models to inspect or refresh catalogs.
- Direct
/model <name>: Without an active model scope (enabledModels/--models),/model <name>checks cached models first and waits for a network refresh only on a miss. With a scope active,/model <name>searches only scoped models without triggering a refresh. - Failed or slow refreshes: If a refresh times out or fails, Atomic keeps showing cached models; you do not need to reset
auth.jsonor~/.atomic. Login and logout changes stay in effect even if an earlier background refresh finishes afterward. - Unsupported
defaultProvider/defaultModel: Saved defaults resolve after built-in,models.json, and extension providers finish loading. If the saved provider is still unsupported, interactive mode warns and leaves model selection open, print and JSON modes write the error to stderr and exit nonzero (keeping JSON stdout valid JSONL), and RPC rejectspromptuntil a valid model is selected.
Remote compaction models
Add a custom remote compaction endpoint by setting"type": "compactor" on a model entry, or override built-in morph/morph-compactor parameters under modelOverrides. Custom compactor models never appear in /model; they appear automatically under /settings → Compaction model:
"api" at the provider or model level (built-in Morph defines "api": "morph-compact"). Atomic sends { messages, query, model } plus any keys in compactionParams (omitting compactionParams lets the remote API apply its own defaults). Compactor output has no built-in size cap; set maxTokens on the compactor model to reject output longer than that many estimated tokens, or pass the endpoint’s own compression parameter in compactionParams. See Configure Morph or add a custom compactor and Compaction reference.
Use classifier models
Classifier models answer typed questions (choice, bool, score) about structured JSON state instead of generating chat replies, and they do not appear in /model. Choose a classifier for Atomic’s structured-decision tool (structured_output) and SDK/extension decisions (decide()) via decisionModel (unset by default; see Structured decisions), or call classifiers directly from codemode with models.getAvailableOfType("classifier") and models.classify().
Built-in classifiers:
- Gemini Decisions:
google-decisions/gemini-decision-1answers yes/no, choice, and score questions about text and images. It uses your saved/login googleAPI key,GEMINI_API_KEY, orGOOGLE_API_KEY. See Gemini Decisions for supported inputs and limits. - OpenAI Decisions:
openai-decisions/gpt-6-lunavia OpenAI’s Decisions API. It has no/loginentry and reuses the first OpenAI API key found (openai-api,openaiAPI key, thenOPENAI_API_KEY), skipping ChatGPT sign-in. It accepts up to 128 images and up to 922K tokens; requests above roughly 600K tokens may hit a gateway 504 timeout that is not retried. (openai/gpt-6-lunaalways selects the chat model.) - TypeSafe Jev (direct):
typesafe/jev-latestandtypesafe/jev-1.14.0(up to 262K tokens with PNG/JPEG images; see TypeSafe Jev). - Cloudflare Workers AI: Cloudflare Clef (
@cf/cloudflare/clef,@cf/cloudflare/clef-flash,@cf/cloudflare/clef-omni, up to four PNG/JPEG/WebP images) and TypeSafe Jev (typesafe/jev,typesafe/jev-1.14.0, PNG/JPEG images). - OpenRouter: TypeSafe Jev (
~typesafe/jev-latest,typesafe/jev-1.13,typesafe/jev-1.14), Cloudflare Clef, plus additional third-party classifiers such as Liquid D1 (~liquid/d1-latest), Perplexity Decider (~perplexity/pplx-decider-latest), Baseten (baseten/bison-1), Microsoft Decision (microsoft/microsoft-decision-1.1), Morph Reflex (morph/reflex), and Respan. - Vercel AI Gateway and OpenCode Zen: Text-only TypeSafe Jev plus additional Vercel AI Gateway classifiers (including Baseten Bison/Mammoth, Liquid D1.2, Microsoft Decision 1/1.1, Perplexity Decider, Google Gemini Decision 1, and OpenAI GPT-6 Luna Decisions).
- GitHub Copilot:
github-copilot/microsoft-decision-1,github-copilot/microsoft-decision-1.1(text only, 32,768-token context), andgithub-copilot/gpt-6-luna-decisions(text and images), authenticated with Copilot OAuth orCOPILOT_GITHUB_TOKEN. - Local llama.cpp: Native decision models and a next-token-probability fallback for chat models; see Local classification.
/settings → Decision model or run models.getAvailableOfType("classifier") in codemode to see every classifier available for your authenticated providers.
Built-in classifiers do not retry when the provider reports that your account is out of quota. Temporary throttles can still retry if the provider’s requested wait fits within the retry limit. If you call models.classify() directly, failure results include retryAfterMs when the provider supplied a delay, even if it exceeded the limit. SDK callers can set the limit with maxRetryDelayMs (60,000 ms by default, 0 to disable it). If your quota is exhausted, wait for it to reset, replenish it, or choose a different provider.
TypeSafe’s System One classifier protocol (/v1/systemone)—also used by Cloudflare Workers AI, OpenRouter, GitHub Copilot, and Vercel AI Gateway classifiers—accepts different image request layouts depending on the host, controlled by compat.imageInput ("assets", "images", or "state-image-urls"). Built-in entries configure this automatically, so overriding baseUrl preserves it. For a custom proxy targeting another classifier service, set imageInput and sendImageOptInHeader in provider-level compat (for example, a proxy in front of OpenRouter needs "imageInput": "state-image-urls" and "sendImageOptInHeader": false so OpenRouter does not silently drop images). See System One compatibility.
Use image models
Image models generate and edit images instead of chatting and never appear in/model. Call them from codemode via models.getAvailableOfType("image") and models.generateImages(), or from an extension via ctx.modelRegistry.generateImages().
Built-in image providers:
- OpenAI Images (
openai-images):- Models:
gpt-image-1,gpt-image-1-mini,gpt-image-1.5,gpt-image-2,gpt-image-2.5-flare,gpt-image-2.5-sunburst,gpt-image-2.6-flare, andgpt-image-2.6-sunburst. - Authentication: No separate
/loginentry; reuses the first OpenAI API key found (openai-api,openaiAPI key, thenOPENAI_API_KEY), skipping ChatGPT sign-in. If you only signed in with ChatGPT, save a key via/login openai-apior setOPENAI_API_KEY. - Editing and options: Pass text and image blocks in
input(the first untagged image is the base image, extra untagged images are references, and optionalrole: "markup"on GPT Image 2.5+ orrole: "mask"are mutually exclusive). Supported options includesize,quality,n,background("transparent"requires"png"or"webp"),outputFormat("png","jpeg","webp", plus"svg"and"gif"on GPT Image 2.6),outputCompression(0–100for JPEG/WebP),complexity("low","medium", or"high"on GPT Image 2.6),moderation, andsafetyIdentifier(up to 128 characters). - SVG and animated GIF (GPT Image 2.6):
outputFormat: "svg"requiresn: 1(or omitted); leavesvgunset so Atomic retries automatically withgpt-6.1-solif your account requiressvg.model, or passsvg: { model, reasoning }to pin a specific authoring model.outputFormat: "gif"acceptsframeCount(2–16, default9) andframeDurationMs(20–2000, default200, rounded to 10 ms).
- Models:
- OpenRouter (
openrouter):- Reuses your OpenRouter credential (
/login openrouterorOPENROUTER_API_KEY). - Exposes multi-vendor image models through OpenRouter’s image generation API—such as
google/gemini-2.5-flash-image,google/gemini-3-pro-image,black-forest-labs/flux.2-pro,black-forest-labs/flux-3-image,openai/gpt-image-2.6-flare, andrecraft/recraft-v4-pro-vector. OpenAI-specificImagesOptionsare ignored by OpenRouter image models. - If OpenRouter says the account is out of quota, Atomic returns the error without retrying. Wait for the quota to reset, replenish it, or use another provider. Temporary throttles can still retry if an SDK caller sets
maxRetriesabove its default of0and the requested wait is withinmaxRetryDelayMs(60,000 ms by default).
- Reuses your OpenRouter credential (
Fallbacks and credentials
A model chain starts with a pinned model followed byfallbackModels in a session or subagent; model: "auto" starts with your configured default model:
- Candidates whose providers lack credentials are skipped before any request (recorded in session history and subagent run details).
autonever selects an unauthenticated default model. - A provider that rejects credentials (HTTP 401 or an invalid, expired, revoked, or restricted key/token) is skipped for the rest of that chain. A model-scoped HTTP 403 skips only that model.
- A chain with no usable candidate fails immediately and names each skipped model and provider. A single pinned model with no fallbacks is never replaced.
fallbackModels, enabledModels, CLI model options, and Automatic model selection.
Model runtime & overrides
Supported APIs, secret/header resolution, overrides, cost tiers, fast variants, and API compatibility rules.
models.json field reference
Complete schema table for every provider, model, override, and compatibility field.