The free tier is closed for most users.Thank you for every chat along the way. Paid models work as before, and your account, API keys, and balance stay as they are.Read why

OpenCode API: Add FreeTheAI as a Custom Provider

OpenCode adds FreeTheAI as a custom provider: the key goes in with /connect, the provider and models go in opencode.json.

WebsiteSource codeAPI reference

Steps

  1. Store your key

    In OpenCode run /connect, scroll to Other, enter freetheai as the provider ID, then paste your key.

  2. Add the provider

    Add this to ~/.config/opencode/opencode.json (or opencode.json in your project).

    json
    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "freetheai": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "FreeTheAI",
          "options": { "baseURL": "https://api.freetheai.org/v1" },
          "models": {
            "glm-5.3": { "name": "GLM 5.3", "limit": { "context": 200000, "output": 32000 } },
            "kimi-k3.1-pro": { "name": "Kimi K3", "limit": { "context": 200000, "output": 32000 } }
          }
        }
      }
    }
  3. Pick the model

    Run /models and choose a FreeTheAI model.

How this guide was checked: Checked against OpenCode's provider docs (custom provider) on 2026-09-29.

Tips

  • The limit values let OpenCode track how much context is left. Keep them at or below the model's real limits on freetheai.org/models.

Troubleshooting

Where does OpenCode keep the FreeTheAI key?

/connect stores it in OpenCode's credential store. You can also set options.apiKey to "{env:FREETHEAI_API_KEY}".

Common errors

  • 401: the key is wrong or incomplete. Paste the whole key.
  • 403: follow a provider of the model, or confirm your email.
  • 404: the model ID or URL is wrong.
  • 429: daily limit reached, or too many requests at once.

More guides: Coding tools

All setup guides

Did this guide work for you?