goose is an open-source agent from Block that runs as a desktop app and as a CLI. It ships first-class support for a long list of named providers, but the interesting case for anyone routing across several models is the Goose OpenAI compatible API path: give it one base URL, and the agent will use whatever model IDs that endpoint serves.
This guide wires goose to AtmoRouter. It covers both supported routes — the built-in OpenAI provider and a named custom provider — the failure modes that cost people an afternoon, and an honest look at what a session actually bills. This post is AtmoRouter-authored; the cost figures below are illustrative arithmetic, not an independent benchmark.
What goose needs from the endpoint
goose leans on tool calling hard. Each turn sends the model a system prompt plus the schemas of every enabled extension (MCP server), and expects structured tool calls back. Two things follow from that.
Pick models with dependable tool calling. A cheap model that mangles tool arguments spends more tokens retrying than it saves.
Keep the tool set stable inside a session. A large, unchanging prefix is what lets cached input work on the turns that follow; adding and removing extensions rewrites that prefix and you pay the full input rate again.
Streaming is expected as well. AtmoRouter serves OpenAI-shaped requests at https://atmorouter.dev/v1, so the endpoint goose should end up calling is https://atmorouter.dev/v1/chat/completions. Confirm the model IDs you plan to use before you write any config:
bashcurl -s https://atmorouter.dev/v1/models \
-H "Authorization: Bearer ar-xxxxxxxxxxxx" | head -c 400Route 1: the built-in OpenAI provider
The fastest path when you have one gateway and one key. goose's built-in OpenAI provider reads OPENAI_API_KEY, OPENAI_HOST, and optionally OPENAI_BASE_PATH.
OPENAI_HOST wants the host root, with no path. OPENAI_BASE_PATH is the path appended to it and defaults to v1/chat/completions — exactly what AtmoRouter serves, so leave it unset.
bashexport OPENAI_HOST="https://atmorouter.dev"
export OPENAI_API_KEY="ar-xxxxxxxxxxxx"
export GOOSE_PROVIDER="openai"
export GOOSE_MODEL="zai/glm-5.3"
goose run -t "summarise the README in three bullets"The trap is the variable name. goose reads OPENAI_HOST, not OPENAI_BASE_URL or OPENAI_API_BASE. Set the variable every other tool uses and goose quietly keeps its default host (api.openai.com), sends your AtmoRouter key there, and the rejection looks like a bad key rather than a bad URL.
Environment variables take precedence over the config file, which makes the snippet above version-proof: current releases store provider settings under active_provider and providers, while older flat GOOSE_PROVIDER / GOOSE_MODEL keys are still read and migrated. For a permanent setup, put the same values in ~/.config/goose/config.yaml, leave the key out of that file, and verify with goose info -v.
Route 2: a named custom provider
If you switch between endpoints, or you would rather see "AtmoRouter" than "OpenAI" in the picker, register a custom provider. Each one maps to a JSON file in ~/.config/goose/custom_providers/:
json{
"name": "atmorouter",
"engine": "openai",
"display_name": "AtmoRouter",
"base_url": "https://atmorouter.dev/v1/chat/completions",
"api_key_env": "ATMOROUTER_API_KEY",
"models": [
{ "name": "zai/glm-5.3", "context_limit": 1000000 },
{ "name": "alicn/deepseek-v4.1-flash", "context_limit": 1000000 },
{ "name": "oai/gpt-6-luna", "context_limit": 1050000 }
]
}Select it the same way as any built-in provider:
bashexport ATMOROUTER_API_KEY="ar-xxxxxxxxxxxx"
export GOOSE_PROVIDER="atmorouter"
export GOOSE_MODEL="zai/glm-5.3"Note the different shape: base_url here is the full request path, whereas OPENAI_HOST was a bare host. If you get 404s, curl the exact URL you wrote in the file before suspecting goose. api_key_env names the variable goose should read, so the secret stays in your shell and out of the JSON.
The models array is what fills the provider's model list. Keep each ID byte-identical to the catalogue; a typo surfaces as a provider-side error on the first turn rather than a validation message when you save the file.
Each model entry can also declare prices in USD per token, which goose uses for its own cost readout:
json{ "name": "zai/glm-5.3", "context_limit": 1000000,
"input_token_cost": 0.0000035, "output_token_cost": 0.000011 }Both input and output prices must be present, or goose ignores the pair and falls back to its own catalogue data. Turn the readout on with GOOSE_CLI_SHOW_COST: true in config.yaml. Treat that number as an estimate — the authoritative figure is your AtmoRouter usage and balance.
What a session actually costs
Swapping the model row moves the bill far more than the gateway plumbing does. Live "from" rates at the time of writing, per million input/output tokens:
| Model | Input | Output | Context | |---|---|---|---| | mm/MiniMax-M3 | $0.00075 | $0.003 | 1M | | zai/glm-5.3 | $0.0035 | $0.011 | 1M | | alicn/deepseek-v4.1-flash | $0.042 | $0.168 | 1M | | oai/gpt-6-luna | $0.07475 | $0.37375 | 1.05M | | ali/qwen4-max | $0.1125 | $0.3375 | 1M | | cc/claude-sonnet-5-5 | $0.15 | $0.75 | 1M |
Illustrative math: 25 turns, 100k input tokens per turn with 80% served from cache (cached input is 10% of the input rate where the model supports it), 2k output per turn.
pythonPRICES = { # from $ per million tokens, live catalogue, 2026-11-20
"mm/MiniMax-M3": (0.00075, 0.003),
"zai/glm-5.3": (0.0035, 0.011),
"alicn/deepseek-v4.1-flash": (0.042, 0.168),
"oai/gpt-6-luna": (0.07475, 0.37375),
"ali/qwen4-max": (0.1125, 0.3375),
"cc/claude-sonnet-5-5": (0.15, 0.75),
}
TURNS, IN_PER_TURN, CACHED, OUT_PER_TURN = 25, 100_000, 0.80, 2_000
for mid, (i, o) in PRICES.items():
cached = IN_PER_TURN * CACHED
fresh = IN_PER_TURN - cached
per_turn = (fresh * i + cached * i * 0.10 + OUT_PER_TURN * o) / 1_000_000
print(f"{mid:28s} ${per_turn:.5f}/turn ${per_turn * TURNS:.3f}/session")That works out to about $0.0007 per session for mm/MiniMax-M3, $0.003 for zai/glm-5.3, $0.038 for alicn/deepseek-v4.1-flash, $0.071 for oai/gpt-6-luna, $0.096 for ali/qwen4-max, and $0.14 for cc/claude-sonnet-5-5 — a spread of roughly two hundredfold on identical traffic. That gap is the practical argument for putting a gateway in front of the agent: changing the row becomes a config edit instead of a migration.
Note where the money goes. The 80% cache hit rate is doing most of the work; set it to zero and the same 25 turns cost about three times as much on every row.
Troubleshooting
No api key passed in — goose does not read provider keys from config.yaml; a key placed there is ignored. Use the provider's environment variable, goose configure (system keyring), or secrets.yaml when the keyring is unavailable, as in containers and CI.
404 on every request — the host/path split. OPENAI_HOST is a root; base_url in a custom provider file is a full path. Mixing the two either doubles /v1/chat/completions or drops it.
Model missing from the picker — goose configure will not accept an arbitrary model name, and model discovery differs between providers. Set GOOSE_MODEL directly, or use "Use custom model" in goose Desktop.
Sessions that grow without limit — auto-compaction triggers at 80% of the context window by default, or at 225k tokens, whichever comes first. On a 1M-token model you can raise GOOSE_AUTO_COMPACT_TOKEN_LIMIT, but remember that compaction is itself a summarisation pass you pay for. Running many MCP extensions? GOOSE_TOOL_DEFERRAL: lookup publishes tool names up front and loads their schemas on demand.
Retry loops that never stop — a client that retries a broken request forty times costs nothing in inference on AtmoRouter, since failed requests are not billed, but it costs you the wall-clock time and the log noise. Fix the 404 instead of retrying it.
FAQ
Does goose work with any OpenAI-compatible API?
Yes, as long as the endpoint serves Chat Completions with streaming and tool calling. Point OPENAI_HOST at the host root (or base_url at the full path in a custom provider) and use the exact model IDs the endpoint lists under /v1/models.
Should I use OPENAI_HOST or OPENAI_BASE_URL for goose?
OPENAI_HOST. goose's built-in OpenAI provider reads OPENAI_HOST plus an optional OPENAI_BASE_PATH (default v1/chat/completions). OPENAI_BASE_URL is ignored.
Where should the API key live?
In an environment variable, the system keyring via goose configure, or secrets.yaml when no keyring is available. Never in config.yaml; goose ignores keys placed there.
Which model should I start with?
Start with a model that handles tool calls reliably, such as zai/glm-5.3 for cheap everyday work or cc/claude-sonnet-5-5 for harder multi-step tasks, then compare cost and quality on your own sessions.
Next step
Rates refresh, so the model page is authoritative: check live pricing on AtmoRouter Models before you budget a rollout, and create a key at atmorouter.dev. For the cost mechanics in more depth, read prompt caching for AI agents and tool calling token cost per turn; the LangChain setup guide covers the same endpoint from the framework side.