Skip to content

Integrations

Use OpenCode with any model

OpenCode reads custom providers from a provider block in its opencode.json config file. Connect to Hopscotch to use any model in the catalog.

Set it up

  1. 01

    The configuration surface

    The file is opencode.json, either at your repository root or globally at ~/.config/opencode/opencode.json, and the two are merged. Add a provider:

    opencode.json
    {
      "provider": {
        "hopscotch": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Hopscotch",
          "options": {
            "baseURL": "https://api.hopscotchlabs.ai/v1",
            "apiKey": "{env:HOPSCOTCH_API_KEY}"
          },
          "models": {
            "openai/gpt-4o-mini": {
              "name": "GPT-4o mini via Hopscotch"
            }
          }
        }
      }
    }

    OpenCode does not append /v1. Its documentation says the baseURL should end at the version prefix the provider uses, so include it.

  2. 02

    Pick the right package

    npm names the adapter, and the choice is not cosmetic. @ai-sdk/openai-compatible speaks chat completions, which is what this API serves.

  3. 03

    List the models yourself

    OpenCode does not ask a custom provider what it can serve. It has no discovery step for one, so the models it offers are the keys of your models object, and those keys are pinned ids. Adding a model means editing the file again.

    Each model may carry a limit object with context and output. Fill both in from GET /v1/models, which publishes the context window and the maximum output for every model.

  4. 04

    The key, and the file that gets committed

    OpenCode's own documentation says the project-level config is safe to check into version control, which it is right up until somebody writes a key into it. Use the interpolation instead: {env:VARIABLE_NAME} reads the value from your environment, as in the block above, and resolves to an empty string when the variable is unset.

    bash
    export HOPSCOTCH_API_KEY=ub_live_YOUR_KEY_HERE

Models that fit an agent

These models support tool calling and take at least 128K tokens of context. Prices are per million tokens.

ModelContextMax outputInput /1MOutput /1MCached input /1MProvidersReleased
GoogleGemma 4 E4B ITGoogledeepinfra/gemma-4-E4B-it131K8K$0.02$0.10n/aDeepinfra2 Apr 2026
OpenAIGPT OSS 20BOpenAIdeepinfra/gpt-oss-20b131K16K$0.03$0.14n/aDeepinfra5 Aug 2025
OpenAIGPT OSS 120BOpenAIdeepinfra/gpt-oss-120b131K16K$0.04$0.17n/aDeepinfra5 Aug 2025
Command R7BCoherecohere/command-r7b-12-2024128K4K$0.04$0.15$0.04Cohere2 Dec 2024
Nemotron 3 Nano 30B A3BNVIDIAdeepinfra/Nemotron-3-Nano-30B-A3B262K262K$0.05$0.20n/aDeepinfra15 Dec 2025
DeepSeekDeepSeek V4 Flash 0731DeepSeekdeepinfra/DeepSeek-V4-Flash-07311M384K$0.06$0.18n/aDeepinfra31 Jul 2026

What changes when OpenCode runs through Hopscotch

One key for every model
Switch models in OpenCode by changing the model name.
A budget for this tool
Give OpenCode its own key with a daily limit. A long session stops at the limit.
Every call in Activity
Each request OpenCode sends shows up with its model, provider, tokens and cost.
List price
You pay each provider's list price per token, with no markup.

OpenCode questions

Do I need an account with each provider?

No. One Hopscotch key covers every model in the catalog, and you buy credit once.

Which model name goes in OpenCode?

The ID from the models page, such as deepinfra/gemma-4-E4B-it. The provider comes first, then the model.

Will OpenCode get a different model than the one I picked?

No. Hopscotch runs the model you name. To add a backup, set up a routing profile.

Can I use my own provider key with OpenCode?

Yes. Add the key in your dashboard. Requests to that provider run on it.

Run OpenCode on any model

Get a key and paste the config above.