For the complete documentation index, see llms.txt. This page is also available as Markdown.

OpenCode Integration with The Grid | Provider Setup

Connect OpenCode to The Grid with opencode auth /connect. Add your consumption key, choose model and small_model, and run the agent loop.

OpenCode ships with a /connect flow that adds The Grid as a provider in one step. No JSON to edit, no config scope to choose. Run opencode auth /connect, pick The Grid, paste your consumption key, and the agent loop runs on market-priced inference.

Prerequisites

  • OpenCode installed (opencode --version to check).

  • A Grid account at app.thegrid.ai.

  • Credits in your account. The Grid is prepaid; zero credits returns 402.

  • A Grid consumption API key from Settings → API Keys → Create Consumption Key.

Setup

1. Get your Grid consumption API key

Log into app.thegrid.ai. Go to Settings → API Keys → Create Consumption Key and copy it.

2. Run opencode auth /connect

opencode auth /connect

Select The Grid from the provider list. Paste your Grid consumption key when prompted. OpenCode persists the credential for you.

3. Pick your model and small_model

OpenCode separates a primary model from a cheaper small_model used for title generation, summaries, and utility calls. Map both to Grid instruments. A useful default for coding agents:

  • model: code-prime

  • small_model: code-standard

Set them in the TUI with /model thegrid/code-prime and the equivalent setting for small_model. Instrument tiers and use cases live in the current instruments list.

4. Launch OpenCode

The Grid's instruments appear in the /model picker.

Verification

Run a quick non-interactive check against both tiers:

If both return OK, the provider is wired up, the key is valid, and both tiers route correctly.

Troubleshooting

The Grid's instruments don't appear in /model. Restart OpenCode after auth /connect. If the providers list still excludes The Grid, run auth /connect again to re-register.

Token counts don't match the Grid dashboard. OpenCode's built-in counter is provider-agnostic and does not see Grid market pricing. Real spend is in the Grid dashboard.

Last updated

Was this helpful?