Integration Guides

OpenCode Zen OpenAI-Compatible API: URLs and Setup (2026)

ROIBest AI

What is the OpenCode Zen OpenAI-compatible API?

OpenCode Zen is the name many older guides still use for OpenCode's pay-per-use model catalog. In the official docs checked on December 3, 2026, that catalog is titled OpenCode Console, and the OpenAI-style base path is https://opencode.ai/inference/openai/v1. You sign in, add credits, create an API key, and call models either from the OpenCode TUI or from another client. A subscription with included usage is a separate lane called OpenCode Go.

"OpenAI-compatible" here is not one single URL that behaves like api.openai.com for every model. Official docs list a native endpoint per model family: GPT models use the Responses API, many open models use Chat Completions, Claude uses Anthropic Messages, and Gemini uses Google's generate path. The same docs also say Console translates, so a text model can be reached through the other text APIs. Always confirm the current path on OpenCode's Console models page before you hard-code anything. For the protocol itself, see what an OpenAI-compatible API covers.

How to connect in OpenCode

  1. Sign in to the OpenCode console and add billing details and credits.
  2. In the OpenCode TUI, run /connect, select OpenCode, and sign in with your OpenCode account.
  3. Run /models to see the models available to you and pick one.
/connect
/models

You are charged per request. Official docs note that this catalog is optional: you can use OpenCode with any other provider instead.

To pin a model in config, official docs use the opencode/<model-id> form:

{
  "model": "opencode/gpt-6.1-sol"
}

OpenAI-compatible base URL and endpoints

If you are calling the catalog from another coding agent or from the OpenAI SDK, start from the official OpenAI-style root and then pick the route your client actually speaks:

Purpose

Official URL (Dec 2026 docs)

OpenAI-style root

https://opencode.ai/inference/openai/v1

Chat Completions

https://opencode.ai/inference/openai/v1/chat/completions

Responses

https://opencode.ai/inference/openai/v1/responses

Embeddings

https://opencode.ai/inference/openai/v1/embeddings

Model list

https://opencode.ai/inference/v1/models

A Chat Completions client (OpenAI SDK chat.completions.create) should use the /v1 root, not the full /chat/completions path, and not the Responses path. That is the same base URL rule that trips up other gateways.

from openai import OpenAI
import os

client = OpenAI(
    base_url="https://opencode.ai/inference/openai/v1",
    api_key=os.environ["OPENCODE_API_KEY"],
)
resp = client.chat.completions.create(
    model="glm-5.3",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
curl https://opencode.ai/inference/v1/models \
  -H "Authorization: Bearer $OPENCODE_API_KEY"

Older blog posts and tool guides often show https://opencode.ai/zen/v1 as the base URL. That string does not appear in the current official Console models page. Use the /inference/ URLs from today's docs, and treat older zen/v1 snippets as stale until you have verified them yourself.

Which models are actually Chat Completions?

The model list changes. Do not copy a long catalog into production code; call GET https://opencode.ai/inference/v1/models and read the official table. As of the December 3, 2026 docs, the pattern was:

Family (examples)

Native official path

Typical client

GPT 6.x / 5.x (for example gpt-6.2-sol)

/inference/openai/v1/responses

OpenAI Responses / @ai-sdk/openai

Many open models (for example glm-5.3, kimi-k2.5, minimax-m2.7, deepseek-v4-pro)

/inference/openai/v1/chat/completions

OpenAI Chat Completions / @ai-sdk/openai-compatible

Claude (for example claude-sonnet-4-5)

/inference/anthropic/v1/messages

Anthropic Messages

Gemini chat models

/inference/google/v1beta/models/<id>

Google client

Official docs also say every text model can be reached through the other text APIs because Console translates. That helps when your client only speaks Chat Completions, but you should still test the model you care about. Image, embedding, and System One / Jev models use their own paths and will not behave like a chat model. If a call fails, read the error and check whether you used the native route; compatibility limits are often just the wrong endpoint.

Docs also note: free-tier chat models require OpenCode itself; from other clients, use paid models or OpenCode Go.

Gotchas when you switch a client to OpenCode Zen

  • Name drift. Search results still say OpenCode Zen; the current official page says OpenCode Console. Same product surface, different label.
  • Wrong base path. A Responses-only model ID sent to a client that only implements Chat Completions can fail if translation is not in play for that request. Switch the client or the route.
  • Do not append /chat/completions to a URL that already includes it. The SDK will add the method path to the base URL.
  • Auth. Official examples use Authorization: Bearer with an OpenCode API key (OPENCODE_API_KEY in several third-party setups).
  • Catalog churn. Model IDs and prices change. The models endpoint is the source of truth, not a screenshot or an old blog table.

If you need a stable gateway in front of several providers, that is a different job from this catalog; see LLM API gateway basics and OpenAI API proxy setup.

Frequently asked questions

Is OpenCode Zen the same as OpenCode Console?

For practical setup, treat them as the same pay-per-use catalog. The official documentation URL is still /docs/zen, but the page title in December 2026 is Console models. Use the official /inference/ URLs.

What base URL should I put in an OpenAI SDK client?

https://opencode.ai/inference/openai/v1 for Chat Completions or Responses under the OpenAI-style root. Do not use https://api.openai.com/v1. Confirm against the official docs if the path changes.

Can I use Claude or Gemini through the OpenAI-compatible API?

Their native official paths are Anthropic Messages and Google generate, not Chat Completions. Official docs say Console can translate text models across APIs, so a Chat Completions client may work, but you should test it. For a first integration, start with a model whose native path already matches your client.

How is OpenCode Zen different from OpenCode Go?

Official docs describe Console / Zen as pay-per-use (add credits, charged per request). OpenCode Go is the subscription lane with included usage. They are different billing lanes, not two different coding agents.

How do I list models?

Call GET https://opencode.ai/inference/v1/models with your key, or run /models in the OpenCode TUI.

The short version

OpenCode Zen, in current official docs, is the OpenCode Console catalog. The OpenAI-style root is https://opencode.ai/inference/openai/v1. List models at https://opencode.ai/inference/v1/models. Match the route to the model family, or rely on documented translation only after you have tested it. Ignore older zen/v1 snippets until you have confirmed they still work.

Sources: OpenCode documentation, Console models / Zen, checked December 3, 2026.