Skip to main content

Using OpenCode with NanoGPT

A quick guide to set up NanoGPT inside OpenCode (CLI, VS Code extension, or desktop app).

Setup Instructions

  1. Generate an API key at nano-gpt.com/api.
  2. Add NANOGPT_API_KEY to your .env or shell environment.
  3. Create or update opencode.json with a NanoGPT provider block:
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "NanoGPT": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "NanoGPT",
      "options": {
        "apiKey": "{env:NANOGPT_API_KEY}",
        "baseURL": "https://nano-gpt.com/api/v1"
      }
    }
  }
}
  1. Restart OpenCode and run /connect so NanoGPT shows up in the provider list.
Model names are listed on our pricing page. Once connected, pick any model from the NanoGPT/<model> list.