Knowledge Base Sections ▾

Navigation

▸ Start here By roles

Categories

Tools 37
Glossary 12

Tools

OpenCode: your own model in the terminal

OpenCode is an open-source AI coding assistant that runs directly in your terminal. No subscriptions, no vendor lock-in. It supports autocomplete, code generation, refactoring, and explanations—all via an OpenAI-compatible API.

Unlike proprietary tools (GitHub Copilot, Cursor Pro), OpenCode is completely free and open. The only cost is the LLM API provider. With JoinGonka Gateway, this cost drops to $0.30 per month.

Configuration takes a couple of minutes—either with a one-command installer or manually via native OpenCode methods, without editing environment variables.

Step 1: Get API Key

Standard procedure for all tools:

  1. Register at gate.joingonka.ai/register.
  2. A 1.5M free token bonus is credited automatically.
  3. Create an API key (format jg-xxx) in the Dashboard.

The same key works with Cursor, Cline, Continue.dev and any OpenAI-compatible client.

Step 2: Configure OpenCode

The easiest way is to set it up with the one-command installer. For CLI/file tools, it will automatically register the JoinGonka provider (baseUrl, models) and save the key to the native OpenCode storage without touching environment variables; for UI tools, it will display the pre-filled values for you to copy:

npx @joingonka/setup --tool opencode

The installer is universal (running without a flag will prompt you to select a tool), asks for your jg-… key, and performs a live check via a gateway request after setup. It does not affect other settings. Below is the manual method if you prefer to configure it yourself.

Manual setup (Plan B)

OpenCode stores keys natively and describes providers in its own config—therefore, manual setup also does not touch environment variables, and your other OpenAI-compatible tools will continue to work as before.

Step 1 — save the key. Run opencode auth login, select Other, enter the provider ID joingonka, and paste your jg-… key. OpenCode will save it to ~/.local/share/opencode/auth.json.

Step 2 — define the provider. Add the following to ~/.config/opencode/opencode.json (the joingonka ID must match Step 1):

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "joingonka": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "JoinGonka (Gonka)",
      "options": { "baseURL": "https://gate.joingonka.ai/v1" },
      "models": {
        "moonshotai/Kimi-K2.6": { "name": "Kimi K2.6" },
        "MiniMaxAI/MiniMax-M2.7": { "name": "MiniMax M2.7" },
        "deepseek-ai/DeepSeek-V4-Flash-0731": { "name": "DeepSeek V4 Flash" }
      }
    }
  }
}

You do not need to add the apiKey field to this file—OpenCode will inject the key from auth.json using the matching ID.

Model selection: joingonka/moonshotai/Kimi-K2.6 is recommended by default; for long context use joingonka/MiniMaxAI/MiniMax-M2.7; for the network's longest context (380K) use joingonka/deepseek-ai/DeepSeek-V4-Flash-0731.

Verification: launch opencode and ask it to write a function. If you receive a response, configuration is complete.

Why OpenCode + Gonka is the best combination

Three reasons why the OpenCode + Gonka combination is optimal for developers:

  • Fully open-source: Both OpenCode and Gonka Network are open-source. No vendor lock-in, no proprietary dependencies. You control every component.
  • Cost: $0.0047/1M tokens — thousands of times cheaper than any proprietary alternative. GitHub Copilot costs $19-39/mo with limits. OpenCode + Gonka — no limits, for pennies.
  • Privacy: Your code is not sent to Microsoft/OpenAI/Anthropic servers. Requests go through a decentralized network — there is no single storage for your data.

OpenCode supports many LLM providers, but with JoinGonka Gateway you get the optimal balance of price, quality, and privacy. Alternative terminal tools: Claude Code, Aider.

Model parameters: Context window — 200K tokens, maximum response length — up to 8192 tokens (for all network models). Current list of models: GET https://gate.joingonka.ai/v1/models.

OpenCode + Gonka = a fully open-source AI coding assistant for $0.30/month. No subscriptions, no vendor lock-in, no sending code to corporate servers. Free tokens upon sign-up.

Want to learn more?

Explore other sections or start earning GNK right now.

Get free tokens →