Skip to content

Configure OpenCode

Add providers under unique IDs, pick the right AI SDK package, and manage OMO configuration.

Updated View as Markdown
For humans

OpenCode stores providers under provider.<id> in opencode.json, so several connections coexist in one configuration. Every Provider ID must be unique, and editing one provider preserves the others. Remove from tool deletes only that entry, not the others. Its default directory is ~/.config/opencode, and OcHub can also manage its MCP servers and skills.

Add an OpenCode connection

  1. Enter a stable ID such as openrouter or company_ai.

  2. Choose an AI SDK package that matches the upstream:

    Upstream Common package
    OpenAI-compatible third party @ai-sdk/openai-compatible
    Official OpenAI @ai-sdk/openai
    Anthropic / Claude @ai-sdk/anthropic
    Amazon Bedrock @ai-sdk/amazon-bedrock
    Google Gemini @ai-sdk/google
  3. Enter Base URL and API key. An official SDK may use its default endpoint.

  4. Add model IDs, display names, and optional context and output limits.

  5. Add options.* extensions or request headers only when required.

  6. Confirm that the preview changes only the intended provider.<id>.

  7. Save, add or switch, then choose the provider and model in OpenCode.

Option extensions parse booleans and numbers as literals. They can express setCacheKey or Bedrock region and credentials. Verify the expected type.

OMO configuration

Advanced tools can read and disable OMO / OMO Slim. Disabling deletes the corresponding file and clears current markers on related connections:

  1. Read OMO or OMO Slim first.
  2. Back up the OpenCode directory.
  3. Disable only when it is no longer needed.
  4. Return to the OpenCode page and verify the current connection.

After saving, follow the verification checklist to confirm the new connection works. For configuration layers, credentials, AI SDK protocol selection, and sharing, see Advanced OpenCode pitfalls.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close