Goose
Use Router9 as a custom provider in Goose
Goose is an open-source, on-machine AI agent — desktop app, CLI, and API — governed by the Agentic AI Foundation (AAIF). It talks to any OpenAI-compatible endpoint, so you can add Router9 as a custom provider without any code changes.
Everything below was verified against the Goose CLI (goose 1.45). Run goose --version to check yours; older builds may label the menus slightly differently.
Model configuration
Goose reaches an OpenAI-compatible endpoint in either of two ways. Pick one.
Option A — built-in openai provider (quickest, cross-platform)
Goose's bundled openai provider already speaks Router9's format; you only override the host. Set these environment variables and Goose sends every request to Router9.
macOS / Linux:
export GOOSE_PROVIDER=openai
export OPENAI_HOST=https://api.router9.com # host only — Goose appends /v1/chat/completions
export OPENAI_API_KEY=sk-r9k-your-key-here
export GOOSE_MODEL=deepseek/deepseek-v4-flash # any id from GET /v1/modelsWindows (PowerShell) — setx persists the values; open a new terminal afterwards:
setx GOOSE_PROVIDER openai
setx OPENAI_HOST https://api.router9.com
setx OPENAI_API_KEY sk-r9k-your-key-here
setx GOOSE_MODEL deepseek/deepseek-v4-flashOPENAI_HOST is the host only — Goose appends /v1/chat/completions itself.
Option B — named custom provider (router9)
If you keep Goose pointed at other providers too, register Router9 by name. Goose reads custom providers from JSON files under its config directory, in a custom_providers/ subfolder:
| OS | Custom-providers folder |
|---|---|
| macOS / Linux | ~/.config/goose/custom_providers/ |
| Windows | %APPDATA%\Block\goose\config\custom_providers\ |
Run goose info to print the exact config directory on your machine. Create router9.json there:
{
"name": "router9",
"engine": "openai",
"display_name": "Router9",
"description": "Router9 flat-rate LLM gateway",
"api_key_env": "ROUTER9_API_KEY",
"base_url": "https://api.router9.com/v1/chat/completions",
"models": [
{ "name": "deepseek/deepseek-v4-flash", "context_limit": 200000 }
],
"supports_streaming": true,
"requires_auth": true
}Note base_url here is the full chat-completions URL (unlike OPENAI_HOST, which is host-only). Provide the key through the variable named in api_key_env:
export ROUTER9_API_KEY=sk-r9k-your-key-hereYou can also create the same entry interactively: run goose configure, choose Configure Providers → Add custom provider with compatible API.
Running Goose
Non-interactive (one-shot), naming the provider and model explicitly:
goose run --provider router9 --model deepseek/deepseek-v4-flash -t "Summarize README.md"Interactive session (uses your configured/default provider and GOOSE_MODEL):
goose sessionEarlier docs showed
goose session start --provider …. That subcommand does not exist —goose sessionhas nostartverb and no--providerflag. Select the provider withgoose configure, theGOOSE_PROVIDERenv var, orgoose run --provider.
Choosing models
GOOSE_MODEL / --model take the model id Router9 routes on. Use the exact ids from GET /v1/models — Router9 ids are provider-prefixed slugs, so short names like gpt-4o return 404 model_not_found:
curl https://api.router9.com/v1/models \
-H "Authorization: Bearer sk-r9k-your-key-here"The exact set depends on your deployment — see Models.
If your administrator has configured an
autoroute, you can set the model toautoand let Router9 pick.autois not a built-in alias — when no such route exists it returns404 model_not_found, so checkGET /v1/modelsfirst.
MCP Setup
Goose is built around extensions (MCP servers). Add Router9's hosted MCP server as a Remote Extension (Streamable HTTP) to expose Router9 Skills as tools.
Interactively: goose configure → Add Extension → Remote Extension (Streamable HTTP), then answer:
| Prompt | Value |
|---|---|
| Streaming HTTP endpoint URI | https://api.router9.com/v1/mcp |
| Name | router9 |
| Custom header | Authorization = Bearer sk-r9k-your-key-here |
Or add it by hand to config.yaml (same directory as above, goose info prints it):
extensions:
router9:
enabled: true
type: streamable_http
name: router9
uri: https://api.router9.com/v1/mcp
headers:
Authorization: "Bearer sk-r9k-your-key-here"
timeout: 300
bundled: null
description: Router9 hosted skillsStart a session and the Router9 tools (image_generate, memory_list, …) are available. See Install MCP Server for the full tool list.
Skills (optional): Router9 also offers image and audio Skills as agent tools. MCP is the recommended way to expose them where your harness supports it; otherwise call them directly as REST endpoints (
/v1/image/*,/v1/audio/*,/v1/search/) with yoursk-r9k-key — see the API Reference.
Tips
- Router9's flat monthly pricing suits Goose's long, autonomous sessions — no per-token surprises.
- Keep your key in an environment variable (
OPENAI_API_KEY/ROUTER9_API_KEY) rather than committing it to a provider JSON orconfig.yaml. goose infoprints the resolved config paths per OS;goose configureedits them for you.