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
- 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.
- 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.
- 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.
- 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.
bashexport 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.
| Model | Context | Max output | Input /1M | Output /1M | Cached input /1M | Providers | Released |
|---|---|---|---|---|---|---|---|
| Gemma 4 E4B ITGoogledeepinfra/gemma-4-E4B-it | 131K | 8K | $0.02 | $0.10 | n/a | Deepinfra | 2 Apr 2026 |
| GPT OSS 20BOpenAIdeepinfra/gpt-oss-20b | 131K | 16K | $0.03 | $0.14 | n/a | Deepinfra | 5 Aug 2025 |
| GPT OSS 120BOpenAIdeepinfra/gpt-oss-120b | 131K | 16K | $0.04 | $0.17 | n/a | Deepinfra | 5 Aug 2025 |
| Command R7BCoherecohere/command-r7b-12-2024 | 128K | 4K | $0.04 | $0.15 | $0.04 | Cohere | 2 Dec 2024 |
| Nemotron 3 Nano 30B A3BNVIDIAdeepinfra/Nemotron-3-Nano-30B-A3B | 262K | 262K | $0.05 | $0.20 | n/a | Deepinfra | 15 Dec 2025 |
| DeepSeek V4 Flash 0731DeepSeekdeepinfra/DeepSeek-V4-Flash-0731 | 1M | 384K | $0.06 | $0.18 | n/a | Deepinfra | 31 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.