OpenCode setup

OpenCode with one prepaid key for GPT, Claude, Grok and Gemini.

OpenCode reads custom providers from opencode.json. Add Model.sale once and pick any model with /models; you pay per token from your balance.

1. Put your key in the environment

Create a key in the dashboard and export it in your shell profile:

export MODEL_SALE_API_KEY=ms_live_...

2. Add Model.sale to opencode.json

Put this in opencode.json in your project (or in ~/.config/opencode/opencode.json for every project). The model-sale provider covers the Chat Completions models; the anthropic block points OpenCode's built-in Claude provider at our Anthropic-compatible API.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "model-sale": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Model.sale",
      "options": {
        "baseURL": "https://api.model.sale/v1",
        "apiKey": "{env:MODEL_SALE_API_KEY}"
      },
      "models": {
        "gpt-6-sol": { "name": "GPT-6 Sol" },
        "grok-4.7": { "name": "Grok 4.7", "limit": { "context": 500000, "output": 32000 } },
        "gemini-4-argon": { "name": "Gemini 4 Argon" },
        "glm-5.3": { "name": "GLM-5.3" }
      }
    },
    "anthropic": {
      "options": {
        "baseURL": "https://api.model.sale/v1",
        "apiKey": "{env:MODEL_SALE_API_KEY}"
      }
    }
  }
}

Add any other model ID from the catalog to the models map the same way.

3. Pick a model

Start OpenCode and run /models. Model.sale models appear under their provider, and Claude models such as claude-opus-5-5 and claude-sonnet-5-5 appear under Anthropic.