Integration · Agent

Use any model in OpenCode through one custom provider

OpenCode is an open-source terminal coding agent that supports custom providers in opencode.json. AutoJev writes an autojev provider for you, lists every model and route you select under it, and routes each request to the right upstream.

  • One autojev provider in opencode.json(c)
  • All selected models and routes listed
  • Chat Completions in, any protocol out
  • Original config restored on disconnect

Agents

+ Agent

CodexResponses

~/.codex/config.toml

Connected

Claude CodeMessages

~/.claude/settings.json

Connected

Gemini CLIGemini

~/.gemini/settings.json

Connected

OpenCodeChat

~/.config/opencode/opencode.json

Connect

What changes in OpenCode

Normally you add each provider to OpenCode by hand, with its own base URL, key and model list. With AutoJev, OpenCode gets exactly one provider — autojev — pointing at http://127.0.0.1:9527/v1 through the @ai-sdk/openai-compatible package. Every model and route you select on the Agents page becomes a model under that provider.

OpenCode talks Chat Completions to the gateway. AutoJev then forwards each request to the model’s real provider, converting to Responses or Anthropic Messages if that upstream needs it. Provider keys stay in AutoJev; OpenCode only holds a placeholder key that labels its requests in your logs.

What AutoJev configures

ItemValue
Config file~/.config/opencode/opencode.json, or opencode.jsonc if that exists
OverridesOPENCODE_CONFIG or XDG_CONFIG_HOME are respected
Providerprovider.autojev with npm @ai-sdk/openai-compatible
Base URLhttp://127.0.0.1:9527/v1
Keyautojev-local-opencode (placeholder; labels requests as opencode)
Default modelmodel = "autojev/<model or route id>"

What OpenCode gains from the gateway

One place for keys

Provider keys live in AutoJev on your machine. OpenCode only holds a placeholder key, and requests go directly to your providers with no markup.

Failover before output

On connection errors or HTTP 401/402/403/408/429/5xx before output starts, a route retries another candidate (up to 4 attempts by default) and respects Retry-After.

Per-agent logs and cost

Every request is labeled opencode, with model, route, input/output/cache tokens, latency and estimated cost. Prompts and responses are not stored.

Routing without edits

Connect a route once. Switch its strategy between load balancing and intelligent selection in AutoJev without touching OpenCode’s config again.

Set up OpenCode with AutoJev

  1. 1

    Install AutoJev

    Download the desktop app and open it; the local gateway starts on port 9527.

  2. 2

    Add providers and models

    Add DeepSeek, OpenRouter, OpenAI, Ollama or any OpenAI-compatible or Anthropic-compatible endpoint with your own key, test it, and add models.

  3. 3

    Optional: create routes

    Routes like autojev/fast, autojev/quality or autojev/cheap let AutoJev choose the model per request with load-balancing or intelligent-selection strategies.

  4. 4

    Connect OpenCode

    On Agents, AutoJev detects the opencode executable. Select models and routes, pick the default, and click Connect.

  5. 5

    Start OpenCode

    Your selections appear under the AutoJev provider in OpenCode’s model list.

    bash
    opencode

The config AutoJev writes

Example with a route (autojev/fast) and a single model selected. OpenCode model IDs are provider-prefixed, so the default route becomes autojev/autojev/fast.

~/.config/opencode/opencode.json
{ "provider": { "autojev": { "npm": "@ai-sdk/openai-compatible", "name": "AutoJev", "options": { "baseURL": "http://127.0.0.1:9527/v1", "apiKey": "autojev-local-opencode" }, "models": { "autojev/fast": { "name": "Fast" }, "openrouter/qwen/qwen3-coder-flash": { "name": "Qwen3 Coder Flash" } } } }, "model": "autojev/autojev/fast" }

Switching models and routes

Pick any of the AutoJev models from OpenCode’s model list during a session. To add or remove options, or change the default, update the selection on the Agents page and reconnect — or use “Batch update configurations” to refresh every connected agent. Restart OpenCode to reload the list.

Connecting routes rather than individual models keeps OpenCode’s config stable: change the route in AutoJev and the next request uses the new rule.

Restoring opencode.json

AutoJev validates the file before writing and keeps a backup of the original. On disconnect, “Stop and restore configurations” or quit, it reverts what it wrote and keeps non-conflicting edits you made since. JSONC comments may be reformatted while connected.

Every agent on one page

OpenCode sits next to Codex, Claude Code and your other agents, each with its config path, selected models and connection status.

Agents

+ Agent

CodexResponses

~/.codex/config.toml

Connected

Claude CodeMessages

~/.claude/settings.json

Connected

Gemini CLIGemini

~/.gemini/settings.json

Connected

OpenCodeChat

~/.config/opencode/opencode.json

Connect

Frequently asked questions

How do I add a custom provider to OpenCode?

With AutoJev you don’t edit opencode.json by hand: connect OpenCode on the Agents page and AutoJev adds the autojev provider with your selected models. Every provider you add in AutoJev becomes reachable through it.

Can OpenCode use DeepSeek through AutoJev?

Yes. Add the DeepSeek preset and model in AutoJev, select it for OpenCode and connect. It shows up as autojev/<provider>/<model_id> in OpenCode.

Does AutoJev work with opencode.jsonc?

Yes. If opencode.jsonc exists, AutoJev edits it instead of opencode.json. OPENCODE_CONFIG also overrides the path.

Why is the model ID autojev/autojev/fast?

OpenCode prefixes model IDs with the provider name. The provider is autojev and the route ID is autojev/fast.

What about Kilo?

Kilo uses the same configuration layout. Add it as a custom agent and AutoJev recognizes the Kilo template automatically.

Keep exploring

Updated 2026-10-14

Give every agent the right model.

Install AutoJev, add the providers you already pay for, and connect your agents in one click. Everything stays on your machine.

Free & open source · macOS · Windows · Linux