Integration guide

Run OpenCode on OpenLux models

OpenCode accepts custom providers through opencode.json. Register OpenLux once with the OpenAI-compatible AI SDK package, then run your terminal coding agent on GPT-6 Astra, Claude Sonnet 4.5, Gemini 3.8 Flash or DeepSeek V4 with one upstream key.

Create an API key Read the docs

Abstract orange glass sculpture illustrating the OpenCode integration with OpenLux
OpenCode + OpenLux — one key, one endpoint, one bill.

Set it up in four steps

1

Install OpenCode

Install OpenCode with its current official installer and run opencode once so the configuration file is created.

2

Create an OpenLux key

Create an API key in the OpenLux console and export it as OPENLUX_API_KEY. Billing is pay as you go and trial credit covers the first tests.

3

Register the provider

Add an openlux provider to opencode.json using @ai-sdk/openai-compatible, the OpenLux base URL and the model IDs you want in the picker.

4

Select and verify a model

Restart OpenCode, run /models, select an OpenLux model and test a file-reading task plus a tool call. The console should show the matching request and cost.

Configuration

Copy these blocks, replace the placeholder key and you are done.

opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "openlux": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "OpenLux",
      "options": {
        "baseURL": "https://openlux.lol/v1",
        "apiKey": "{env:OPENLUX_API_KEY}"
      },
      "models": {
        "gpt-6-astra": { "name": "GPT-6 Astra" },
        "claude-sonnet-4-5-20250929": { "name": "Claude Sonnet 4.5" },
        "deepseek-v4": { "name": "DeepSeek V4" },
        "gemini-3.8-flash": { "name": "Gemini 3.8 Flash" }
      }
    }
  }
}

Terminal

export OPENLUX_API_KEY="sk-openlux-..."
opencode

# inside OpenCode
/models

Models that fit OpenCode

GPT-6 Astra

OpenAI · $0.3677 / 1M tokens

Claude Sonnet 4.5

Anthropic · $0.2647 / 1M tokens

Gemini 3.8 Flash

Google · $0.0551 / 1M tokens

DeepSeek V4

DeepSeek · $0.0613 / 1M tokens

The full list is in the model catalogue and the use-case collections.

OpenCode + OpenLux questions

Does OpenCode support an OpenAI-compatible gateway?

Yes. OpenCode supports custom providers with @ai-sdk/openai-compatible when the endpoint implements the OpenAI Chat Completions API. OpenLux exposes /v1/chat/completions at https://openlux.lol/v1.

Where should the OpenLux key live?

Reference it as {env:OPENLUX_API_KEY} in opencode.json and export the real value in the shell that launches OpenCode. This keeps the secret out of the checked-in configuration.

Which OpenLux models should I use in OpenCode?

GPT-6 Astra and Claude Sonnet 4.5 are strong planning and code-editing defaults, Gemini 3.8 Flash suits high-volume iterative work, and DeepSeek V4 is a low-cost reasoning option.

How do I verify that tool calling works?

Ask OpenCode to inspect a small repository, read a file and run a harmless command. If the model is not returning valid tool calls, test a different Tools-capable model and confirm the selected model ID exactly matches the catalogue.

How much will this cost?

Estimate OpenCode API cost

Model sessions, tokens, retries and monthly team spend before rollout.

Open the cost guide

Add AI review to the pull-request loop

Build a bounded code reviewer

Use the same OpenAI-compatible endpoint to review pull-request diffs, publish findings and estimate the review budget.

Open the AI code review guide

Connect OpenCode to OpenLux today

One key covers every model in this guide and the rest of the catalogue, metered in USD with free trial credit to start.

Create an API key See pricing