Configure OpenCode with a Free LLM API — No Credit Card

2. Pick your free backend

Owl Alpha OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "Owl Alpha": { "name": "Owl Alpha" }
      }
    }
  }
}
// Get API key at https://openrouter.ai
NVIDIA: Nemotron 3 Nano Omni (free) OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "NVIDIA: Nemotron 3 Nano Omni (free)": { "name": "NVIDIA: Nemotron 3 Nano Omni (free)" }
      }
    }
  }
}
// Get API key at https://openrouter.ai
Poolside: Laguna XS.2 (free) OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "Poolside: Laguna XS.2 (free)": { "name": "Poolside: Laguna XS.2 (free)" }
      }
    }
  }
}
// Get API key at https://openrouter.ai
Poolside: Laguna M.1 (free) OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "Poolside: Laguna M.1 (free)": { "name": "Poolside: Laguna M.1 (free)" }
      }
    }
  }
}
// Get API key at https://openrouter.ai
inclusionAI: Ling-2.6-1T (free) OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "inclusionAI: Ling-2.6-1T (free)": { "name": "inclusionAI: Ling-2.6-1T (free)" }
      }
    }
  }
}
// Get API key at https://openrouter.ai
Tencent: Hy3 preview (free) OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "Tencent: Hy3 preview (free)": { "name": "Tencent: Hy3 preview (free)" }
      }
    }
  }
}
// Get API key at https://openrouter.ai
Baidu: Qianfan-OCR-Fast (free) OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "Baidu: Qianfan-OCR-Fast (free)": { "name": "Baidu: Qianfan-OCR-Fast (free)" }
      }
    }
  }
}
// Get API key at https://openrouter.ai
Google: Gemma 4 26B A4B (free) OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "Google: Gemma 4 26B A4B  (free)": { "name": "Google: Gemma 4 26B A4B  (free)" }
      }
    }
  }
}
// Get API key at https://openrouter.ai
Google: Gemma 4 31B (free) OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "Google: Gemma 4 31B (free)": { "name": "Google: Gemma 4 31B (free)" }
      }
    }
  }
}
// Get API key at https://openrouter.ai
Google: Lyria 3 Pro Preview OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "Google: Lyria 3 Pro Preview": { "name": "Google: Lyria 3 Pro Preview" }
      }
    }
  }
}
// Get API key at https://openrouter.ai
Google: Lyria 3 Clip Preview OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "Google: Lyria 3 Clip Preview": { "name": "Google: Lyria 3 Clip Preview" }
      }
    }
  }
}
// Get API key at https://openrouter.ai
NVIDIA: Nemotron 3 Super (free) OpenRouter
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "free-llm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Free LLM",
      "options": {
        "baseURL": "https://openrouter.ai/api/v1",
        "apiKey": "<your-api-key>"
      },
      "models": {
        "NVIDIA: Nemotron 3 Super (free)": { "name": "NVIDIA: Nemotron 3 Super (free)" }
      }
    }
  }
}
// Get API key at https://openrouter.ai