← Portfolio/free-code

free-code

Models — manage which models appear, and add your own.

One file to manage models

Everything about which models free-code offers lives in ~/.free-code/agent/models.json.

~/.free-code/agent/models.json is the single place you edit to control the model list. It is re-read every time you open /model, so changes apply without restarting. Use it to:

  • Curate which models show in /model (the only whitelist) — including built-in ones.
  • Add custom providers and models (Fireworks, proxies, local servers).
  • Override built-in models (rename, change context window, route through a proxy).
Fresh installs start clean
On first run free-code seeds models.json with an only whitelist containing the most-used models (4 per provider) of each provider you can log in to, so /model is short out of the box instead of listing the whole factory catalog. It is only created if the file doesn't already exist — your edits are never overwritten.

Curating the list — the only whitelist

Show just the models you use, instead of every factory model.

Add a top-level only array. When present and non-empty, /model shows only matching models:

{
  "only": [
    "anthropic/claude-sonnet-4-6",
    "anthropic/claude-haiku-4-5",
    "fireworks/**",
    "lmstudio/**"
  ],
  "providers": {}
}
  • Add a model: add its provider/id (list ids with free-code --list-models).
  • Remove a model: delete its line.
  • Show everything: remove the only key (or set it to []).
  • Keep a whole provider: use a glob such as lmstudio/** or fireworks/**.

Matching is lenient: each entry matches by provider/id, id, or name (case-insensitive; . - _ and spaces treated alike) or as a glob. If the whitelist accidentally matches nothing, free-code falls back to showing all models so the picker is never empty. Selecting a model explicitly with --model still works even if it isn't in only.

Supported providers

Built-in providers appear in /model once you authenticate. You can also add any OpenAI-compatible endpoint.

Log in with /login (OAuth)

ProviderSign-in / token
anthropicClaude subscription or ANTHROPIC_API_KEY
openai-codexChatGPT / Codex sign-in
github-copilotCopilot sign-in (or GH_TOKEN)
google-gemini-cliGemini CLI sign-in
google-antigravityGoogle Antigravity sign-in

API key (set the environment variable)

ProviderEnvironment variable
openaiOPENAI_API_KEY
azure-openai-responsesAZURE_OPENAI_API_KEY (+ base URL)
googleGEMINI_API_KEY
google-vertexGOOGLE_APPLICATION_CREDENTIALS or GOOGLE_CLOUD_API_KEY
amazon-bedrockAWS credentials / AWS_BEARER_TOKEN_BEDROCK
xaiXAI_API_KEY
groqGROQ_API_KEY
cerebrasCEREBRAS_API_KEY
openrouterOPENROUTER_API_KEY
vercel-ai-gatewayAI_GATEWAY_API_KEY
zaiZAI_API_KEY
mistralMISTRAL_API_KEY
minimax / minimax-cnMINIMAX_API_KEY / MINIMAX_CN_API_KEY
huggingfaceHF_TOKEN
opencode / opencode-goOPENCODE_API_KEY
kimi-codingKIMI_API_KEY
Local / custom
Ollama, LM Studio, vLLM, LocalAI, or any corporate proxy — add them as a custom provider (see below). Any OpenAI-compatible endpoint works.

Add a custom or local model

Define providers and models under providers. Keys resolve from env vars, a shell command, or a literal value.

Cloud (e.g. Fireworks) — key from an environment variable:

{
  "providers": {
    "fireworks": {
      "baseUrl": "https://api.fireworks.ai/inference/v1",
      "api": "openai-completions",
      "apiKey": "FIREWORKS_API_KEY",
      "authHeader": true,
      "models": [
        { "id": "accounts/fireworks/models/kimi-k2p7-code", "name": "Kimi K2.7 Code" }
      ]
    }
  }
}

Local (LM Studio / Ollama) — any dummy key works:

{
  "providers": {
    "ollama": {
      "baseUrl": "http://localhost:11434/v1",
      "api": "openai-completions",
      "apiKey": "ollama",
      "compat": { "supportsDeveloperRole": false, "supportsReasoningEffort": false },
      "models": [ { "id": "qwen2.5-coder:7b" } ]
    }
  }
}
Keys in one place
free-code loads ~/.free-code/agent/.env on startup, so you can keep FIREWORKS_API_KEY (and other secrets) there and reference them by name in models.json.

Full schema, value resolution, overriding built-ins, and OpenAI-compat flags: see packages/coding-agent/docs/models.md and docs/local-models-setup.md.