Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Setup guide - Documented by OpenCode

Use OpenAI in OpenCode

OpenCode has a built-in OpenAI provider. Run /connect, choose OpenAI, then either sign in with ChatGPT Plus/Pro in the browser or paste an OpenAI API key; OpenAI models then appear under /models.

Last verified 4 steps2 official sources

Steps

  1. Step 1.

    Run the /connect command and select OpenAI.

    Snippet
    /connect
  2. Step 2.

    Select ChatGPT Plus/Pro to authenticate in the browser, or Manually enter API Key.

    Snippet
    ┌ Select auth method
    │
    │ ChatGPT Plus/Pro
    │ Manually enter API Key
    └
  3. Step 3.

    All OpenAI models should now be available from the /models command.

    Snippet
    /models
  4. Step 4.

    Keys added with /connect are stored in ~/.local/share/opencode/auth.json. A base URL can be customised per provider with the baseURL option in the provider section of the OpenCode config (useful for proxies).

Caveats

  • OpenCode's OpenAI section does not list model ids; the ids shown are from OpenAI's model catalog (developers.openai.com/api/docs/models). Pick them from /models.
  • OpenCode's docs recommend a ChatGPT Plus or Pro subscription for this path; the API key path bills your OpenAI Platform account.
  • For custom providers, OpenCode notes @ai-sdk/openai-compatible targets /v1/chat/completions and @ai-sdk/openai should be used for models that use /v1/responses.

FAQ

How do I use OpenAI in OpenCode?

OpenCode has a built-in OpenAI provider. Run /connect, choose OpenAI, then either sign in with ChatGPT Plus/Pro in the browser or paste an OpenAI API key; OpenAI models then appear under /models.

Which OpenAI model ids work in OpenCode?

The official docs read for this guide list gpt-6.1-sol, gpt-6-astra and gpt-6-luna.

Is this an official OpenAI and OpenCode setup?

OpenCode documents this setup in its own docs. It was last checked against 2 official pages on October 17, 2026.

Sources

Last verified against 2 official pages.

Newsletter

New models, set up the day they ship

One email per week. New model releases, the coding tools that support them and how to wire them up.