Use ToRun in opencode
Last updated 11 Nov 2026
Before you start
Create a developer key and save it in an environment variable named TORUN_API_KEY: see Developer keys.
Add ToRun to opencode
Add the server to opencode's configuration: ~/.config/opencode/opencode.json to use it in every project, or opencode.json in a project's root for that project only. If the file already has an mcp section, add the torun entry to it.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"torun": {
"type": "remote",
"url": "https://mcp.torun.ai/mcp",
"oauth": false,
"headers": { "Authorization": "Bearer {env:TORUN_API_KEY}" },
"timeout": 120000
}
}
}
{env:TORUN_API_KEY}is replaced with your key when opencode starts, so the key never sits in the file.oauth: falsetells opencode to sign in with the key instead of a browser login.timeoutgives a generation two minutes before opencode stops waiting. Music and video return a job id long before that.
Check that it works
Start opencode in your project and ask:
What is my ToRun balance?
The agent calls account_balance and answers with your plan allowance, your wallet and this key's limit. This call is free.
Ask for what your project needs
Some examples:
Make a 64x64 pixel-art sprite of a knight with a transparent background and save it to assets/knight.png.
Compose a 30-second calm background loop for the menu screen and save it to assets/menu.mp3.
Publish the game in dist/index.html to ToRun and give me the link.
Paid calls are charged to your ToRun account: see how calls are paid.
ToRun's models inside opencode
To use ToRun's chat models as opencode's model provider, see OpenAI-compatible API.