> For the complete documentation index, see [llms.txt](https://infronai.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infronai.gitbook.io/docs/frameworks-and-integrations/opencode.md).

# OpenCode

### **Account & API Keys Setup**

The first step to start using Infron is to [create an account](https://infron.ai/login) and [get your API key](https://infron.ai/dashboard/apiKeys).

### Installation OpenCode

```bash
# Official install script
curl -fsSL https://opencode.ai/install | bash

# npm
npm install -g opencode-ai

# pnpm
pnpm install -g opencode-ai

# bun
bun install -g opencode-ai

# macOS / Linux Homebrew tap
brew install anomalyco/tap/opencode

# Verify
opencode --version
opencode
```

Full docs: [opencode.ai/docs](https://opencode.ai/docs)

Inside the TUI, run `/connect`, choose `Other`, set provider id to `infronai`, then paste the Infron API key. Alternatively use `INFRON_API_KEY` through environment variables.​​

### Infron model discovery

```bash
open https://infron.ai/models

curl -sL --noproxy '*' 'https://infron.ai/llms-full.txt' | less

curl -sL --noproxy '*' 'https://infron.ai/llms-full.txt' \
  | rg -n 'gpt-5|claude|gemini|deepseek|qwen|kimi|glm'
```

### opencode.json setup <a href="#openrouter-setup" id="openrouter-setup"></a>

<figure><img src="/files/Ln1qHOyWuKzzSAZLGpA2" alt=""><figcaption></figcaption></figure>

By default, the customer provider configuration in Opencode enables only text‑chat capabilities. To enable the full range of model features (such as multimodal file inputs), you must manually add the following configuration items to the configuration file.

`cd ~/.config/opencode/`

```json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "infronai": {
      "name": "Infron AI",
      "npm": "@ai-sdk/openai-compatible",
      "models": {
        "openai/gpt-5.2": {
          "name": "GPT-5.2",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "release_date": "2026-06-01",
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          },
          "cost": {
            "input": 0,
            "output": 0
          },
          "limit": {
            "context": 400000,
            "output": 128000
          }
        },
        "openai/gpt-5-mini": {
          "name": "GPT-5 Mini",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "release_date": "2026-06-01",
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          },
          "cost": {
            "input": 0,
            "output": 0
          },
          "limit": {
            "context": 400000,
            "output": 128000
          }
        },
        "anthropic/claude-opus-4.8": {
          "name": "Claude Opus 4.8",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "release_date": "2026-06-01",
          "modalities": {
            "input": ["text", "image", "pdf"],
            "output": ["text"]
          },
          "cost": {
            "input": 0,
            "output": 0
          },
          "limit": {
            "context": 200000,
            "output": 32000
          }
        },
        "anthropic/claude-opus-4.6": {
          "name": "Claude Opus 4.6",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "release_date": "2026-06-01",
          "modalities": {
            "input": ["text", "image", "pdf"],
            "output": ["text"]
          },
          "cost": {
            "input": 0,
            "output": 0
          },
          "limit": {
            "context": 200000,
            "output": 32000
          }
        },
        "anthropic/claude-sonnet-4.5": {
          "name": "Claude Sonnet 4.5",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "release_date": "2025-09-29",
          "modalities": {
            "input": ["text", "image", "pdf"],
            "output": ["text"]
          },
          "cost": {
            "input": 0,
            "output": 0
          },
          "limit": {
            "context": 200000,
            "output": 32000
          }
        },
        "google/gemini-3-flash-preview": {
          "name": "Gemini 3 Flash Preview",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "release_date": "2025-11-01",
          "modalities": {
            "input": ["text", "image", "pdf"],
            "output": ["text"]
          },
          "cost": {
            "input": 0.5,
            "output": 3
          },
          "limit": {
            "context": 1000000,
            "output": 65535
          }
        },
        "google/gemini-2.5-flash": {
          "name": "Gemini 2.5 Flash",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "release_date": "2025-06-01",
          "modalities": {
            "input": ["text", "image", "pdf"],
            "output": ["text"]
          },
          "cost": {
            "input": 0,
            "output": 0
          },
          "limit": {
            "context": 1000000,
            "output": 65535
          }
        },
        "deepseek/deepseek-v3.2": {
          "name": "DeepSeek V3.2",
          "attachment": false,
          "reasoning": false,
          "tool_call": true,
          "temperature": true,
          "release_date": "2026-06-01",
          "modalities": {
            "input": ["text"],
            "output": ["text"]
          },
          "cost": {
            "input": 0,
            "output": 0
          },
          "limit": {
            "context": 128000,
            "output": 32000
          }
        },
        "qwen/qwen3-coder-plus": {
          "name": "Qwen3 Coder Plus",
          "attachment": false,
          "reasoning": false,
          "tool_call": true,
          "temperature": true,
          "release_date": "2026-06-01",
          "modalities": {
            "input": ["text"],
            "output": ["text"]
          },
          "cost": {
            "input": 0,
            "output": 0
          },
          "limit": {
            "context": 128000,
            "output": 32000
          }
        },
        "moonshotai/kimi-k2-0905": {
          "name": "Kimi K2 0905",
          "attachment": false,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "release_date": "2025-09-05",
          "modalities": {
            "input": ["text"],
            "output": ["text"]
          },
          "cost": {
            "input": 0,
            "output": 0
          },
          "limit": {
            "context": 128000,
            "output": 32000
          }
        },
        "z-ai/glm-5": {
          "name": "GLM-5",
          "attachment": false,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "release_date": "2026-06-01",
          "modalities": {
            "input": ["text"],
            "output": ["text"]
          },
          "cost": {
            "input": 0,
            "output": 0
          },
          "limit": {
            "context": 128000,
            "output": 32000
          }
        }
      },
      "options": {
        "baseURL": "https://llm.onerouter.pro/v1",
        "apiKey": "{env:INFRON_API_KEY}"
      }
    }
  }
}
```

After completing the configuration, you can start the Opencode CLI.

<figure><img src="/files/0wIU2Gir8BfndleS4Two" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/kB4BzFmh6WpJoPMIadlm" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/GZpHZlbn1zhH1gTfOxTd" alt=""><figcaption></figcaption></figure>

### Basic Usage <a href="#basic-usage" id="basic-usage"></a>

Run `opencode` in a repo to init: It prompts project context, then use slash commands in the TUI.​

* `/connect`: Link Infron (auto-detects env vars).
* `/models`: List/select (e.g., Claude 3.5 Sonnet or Gemini 3 Flash).
* `/init`: Scans repo, suggests plan (e.g., "Analyze main.rs and create layers").
* Core flow: `/plan` for outline, `/build` to generate`/run` code, `/improve` for refinements.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://infronai.gitbook.io/docs/frameworks-and-integrations/opencode.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
