Skip to content

opencode integration

Thibaut Rey edited this page Sep 7, 2026 · 1 revision

OpenCode integration

Verified on 2026-09-07 against the public Go implementation and the deployed Console application's API schema. These are different authentication surfaces.

Connection Inference credential Workspace Quota support
Zen / Go API key API key Bound to the key Go exposes rolling 5h, weekly, monthly windows
Console device OAuth Current OAuth access token when config returns {env:OPENCODE_CONSOLE_TOKEN} x-org-id No Go quota-window endpoint was found in the current Console API schema
Console config with a literal inference key Configured key x-org-id plus configured headers Depends on the configured API root and Go entitlement

The public Go route is /zen/go/v1/usage, including when inference uses /zen. It authenticates against API keys, returns usage.rolling, usage.weekly, and usage.monthly, and each window supplies percent and resetsAt. The documented base limits are $12 per 5 hours, $30 per week, and $60 per subscription month; model multipliers affect actual consumption. MultiVibe does not hard-code these amounts or approximate a month as 30 days.

An authenticated key without a Go subscription receives HTTP 403 with error.type = EntitlementError and OpenCode Go subscription required.. Only that explicit response establishes unsupported Go quotas. Other 403s, 401s, 404s, non-JSON responses, and unrecognized success payloads are refresh errors. Unsupported snapshots discard stale quota windows. Monthly exhaustion is included when calculating the cooldown after an upstream quota rejection.

The Console inference root /inference/openai is not a usage root. MultiVibe shows an explanation without probing a fabricated /inference/openai/v1/usage route. Console billing summaries and dollar budgets are not converted into Go quota percentages. A separate Go API-key account is needed to use the public Go quota API.

Both Node and the native Rust edge resolve the Console token placeholder at request time, so refreshed OAuth credentials take effect immediately. Both send the selected workspace through x-org-id, preserve additional configured headers, and prevent a configured Authorization header from overriding the resolved credential. Unknown credential references are not expanded from the host environment. Reauthentication preserves the existing workspace, and a failed config fetch fails the connection instead of assigning the public Zen endpoint to an OAuth session. Admin account responses redact inference keys and omit configured headers, which may contain credentials.

The inspected deployment used the Console inference root, a token placeholder, and only the legacy x-opencode-org-id header. Its stored errors included Workspace selection is required; its quota snapshot reported unsupported. These observations establish the configuration and code defects, but do not prove whether the owner separately has an eligible Go subscription. No paid inference request, credential rotation, or deployment was performed during the investigation. The admin API redacts OAuth tokens, so end-to-end authenticated Console validation requires the updated deployment or a fresh device connection.

Sources:

Validation on local main:

  • Worktree: git diff --check passed; dependency-backed checks were deferred until integration, per the repository workflow.
  • npm run build: web production build and API TypeScript build passed.
  • Targeted Node tests: 88 passed across OpenCode, quotas and cooldowns, account refresh, runtime authorization, model discovery, proxy headers, and admin credential redaction.
  • Native edge: cargo test --locked -p multivibe-v1-edge opencode passed in rust:1.88-bookworm, with main mounted read-only and a separate build cache. The direct host command was unavailable (cargo: command not found).
  • The remote instance remained on build d143d38fb8c5cf9f0f072332bcbc89e9308a5112. Local validation does not constitute deployment or a live OAuth inference test.

Migrated from docs/opencode-integration.md on 2026-09-07.

Clone this wiki locally