Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.gravitex.ai/llms.txt

Use this file to discover all available pages before exploring further.

1. Overview

OpenCode is an open-source AI coding assistant with first-class support for 75+ models and self-hosted deployments. Through GravitexAI, you can use mainstream models (GPT, Claude, Gemini, Qwen…) inside OpenCode without configuring every vendor separately.

Unified multi-model

One provider, full GPT / Claude / Gemini / Qwen family

Self-host friendly

Supports your own backends and per-project config overrides

Responses API ready

apiCompatibility: "responses" works with the GPT Codex series

Open & auditable

Fully open-source, customize as needed
Download: https://opencode.ai/

2. Quick Setup (GravitexAI)

2.1 Get an API key

1

Sign in

Go to the GravitexAI console and register or log in.
2

Create a token

Open API Keys, click “Create new token”, and copy the sk-xxxxxxxxxx key.

2.2 Configure a custom provider in OpenCode

1

Open provider settings

In OpenCode, go to Server / Provider settings and select Add custom provider (OpenAI-compatible).
2

Fill in provider info

FieldValue
Provider IDgravitex (lowercase, digits, hyphens or underscores)
Display nameGravitexAI
Base URLhttps://api.gravitex.ai/v1 (must end with /v1)
API keyPaste your GravitexAI key from the previous step
3

Add models

Under Models, add model IDs you want to use (e.g. gpt-5.5, claude-sonnet-4-6, gemini-3.5-flash). IDs must match the GravitexAI model list.
4

Save and use

After saving, select via providerID/modelID in chats and settings, e.g. gravitex/gpt-5.5.
OpenCode custom provider setup OpenCode provider and API config OpenCode model config

2.3 Switching models

In chat or settings, pick the configured provider/model (e.g. gravitex/gpt-5.5) to switch. OpenCode switch model
  • For self-hosted or backup GravitexAI endpoints, change the Base URL, e.g. http://your-server:3003/v1.
  • Set a default model in project or global opencode.json via "model": "gravitex/modelID".

3. Some Models Require the Responses API (Important)

Some Azure / OpenAI models only support the Responses API, not the legacy Chat Completions endpoint. When OpenCode defaults to Chat Completions you’ll see:
The chatCompletion operation does not work with the specified model, gpt-5.1-codex. Please choose different model and try again.
The screenshot below shows how this error appears in OpenCode: Error when using gpt-5.1-codex with Chat Completions

3.1 Models that require Responses API

Model ID / familyNotes
gpt-5.1-codexGPT 5.1 Codex (code-focused) — Responses API only
gpt-5.2-codexSame as above
computer-use-previewExperimental model used with the Responses API computer-use tools
For the latest full list, see Azure / vendor docs:

3.2 How to configure in OpenCode

Add the apiCompatibility parameter to a model in your config — no code changes needed.
1

Locate the config file

  • Windows: C:\Users\<username>\.config\opencode\opencode.jsonc
  • macOS / Linux: ~/.config/opencode/opencode.jsonc
Responses API requirement for some models
2

Add the parameter

In your existing custom provider (pointing at GravitexAI or your own API), add "apiCompatibility": "responses" for models that need it (e.g. gpt-5.1-codex):opencode.jsonc: apiCompatibility responses for gpt-5.1-codex
{
  "$schema": "https://opencode.ai/config.json",
  "disabled_providers": [
    "backup_gravitex"
  ],
  "provider": {
    "backup_gravitex": {
      "name": "backup_gravitex",
      "npm": "@ai-sdk/openai-compatible",
      "models": {
        "gpt-5.2": {
          "name": "gpt-5.2"
        },
        "gpt-5.1-codex": {
          "name": "gpt-5.1-codex",
          "apiCompatibility": "responses"
        },
        "gpt-5.1-chat": {
          "name": "gpt-5.1-chat"
        }
      },
      "options": {
        "baseURL": "xxxxxxxx"
      }
    },
    "backup_v1": {
      "name": "backup_v1",
      "npm": "@ai-sdk/openai-compatible",
      "models": {
        "gpt-5.2": {
          "name": "gpt-5.2"
        },
        "gpt-5.1-codex": {
          "name": "gpt-5.1-codex",
          "apiCompatibility": "responses"
        },
        "gpt-5.1-chat": {
          "name": "gpt-5.1-chat"
        }
      },
      "options": {
        "baseURL": "https://api.gravitex.ai/v1"
      }
    }
  }
}
After saving, selecting that provider’s gpt-5.1-codex (e.g. backup_v1/gpt-5.1-codex) will send requests to that baseURL using the Responses API format.
3

Verify the setup

Pick a correctly configured model (e.g. backup_v1/gpt-5.1-chat) and test a chat — successful reply means you’re good:OpenCode chat after successful config

3.3 Summary

ScenarioWhat to do
Models that only support Responses (e.g. gpt-5.1-codex, gpt-5.2-codex)Add "apiCompatibility": "responses" to that model under your custom provider’s models in opencode.jsonc
Regular models (e.g. gpt-5.5, claude-sonnet-4-6, gemini-3.5-flash)No apiCompatibility needed — follow Quick Setup
CategoryModel ID examplesNotes
Flagship codinggpt-5.5, claude-opus-4-7Best overall coding ability
Codex seriesgpt-5.1-codexRequires Responses API (see Section 3)
General chat + codegpt-5.4, claude-sonnet-4-6, claude-sonnet-4-5-20250929Works out of the box
Fast / low latencygemini-3.5-flash, claude-haiku-4-5-20251001Great for completions & tool use
Cost-effectivegpt-5.4-mini, gemini-3.1-flash-lite-preview, qwen3-coder-plusHigh concurrency / batch
See the GravitexAI model list for complete IDs.

Success example

A normal chat in OpenCode using GravitexAI: OpenCode success with GravitexAI

5. FAQ

That model only supports the Responses API. Add "apiCompatibility": "responses" to it in opencode.jsonc — see Section 3.
  1. Check the key for completeness and trailing whitespace.
  2. Confirm it isn’t deleted/disabled in the GravitexAI console.
  3. Ensure your balance is positive.
Make sure the Base URL ends with /v1: https://api.gravitex.ai/v1.
Model IDs must exactly match the GravitexAI list. Watch the case and version suffix (e.g. claude-sonnet-4-5-20250929, not claude-sonnet-4-5).
Commit opencode.jsonc to .config/opencode/ in the repo (or the project root). Each engineer brings their own API key.

6. References