Skip to main content

Connect Open Code

Connect Open Code to your instance of Dedicated Gateway and use IG1 AI sovereign models with Open Code.

Install Open Code

curl -fsSL https://opencode.ai/install | bash

Install via npm

npm install -g opencode-ai

Install via Homebrew (macOS/Linux)

brew install anomalyco/tap/opencode

Verify Installation

opencode --version

Configure IG1 AI Provider

Step 1: Create Configuration File

For persistent configuration, create or edit ~/.config/opencode/opencode.json:

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ig1-ai": {
"npm": "@ai-sdk/openai-compatible",
"name": "IG1 AI",
"options": {
"baseURL": "https://api.xxx.ig1.ai"
},
"models": {
"Coding Max Thinking": {
"name": "coding-max-thinking"
},
"Coding Pro Thinking": {
"name": "coding-pro-thinking"
},
"Kimi K2.6 Instant": {
"name": "kimi-k26-instant"
},
}
}
},
"model": "ig1-ai/Coding Max Thinking",
"small_model": "ig1-ai/Coding Pro Thinking"
}
note

Replace https://api.xxx.ig1.ai with your Dedicated Gateway URL where xxx is your organization trigram.

Step 2: Add API Key

Use the /connect command to add your API key:

opencode

Then in the TUI:

/connect

Select OpenAI Compatible or search for your custom provider, then enter your API key.

tip

The API key is stored securely in ~/.local/share/opencode/auth.json.


Initialize Open Code

Navigate to your project directory:

cd /path/to/your/project

Initialize Open Code for the project:

opencode

Then run the /init command inside the TUI to create an AGENTS.md file at the project root.

tip

You should commit the AGENTS.md file to Git. It helps Open Code understand your project structure and coding patterns.


Test your setup

Launch Open Code:

opencode

Check available models:

/models

You should see IG1 AI models listed. Select your preferred model.

🎉 It works! Open Code now uses IG1 AI models through your Dedicated Gateway.


Available IG1 AI Models

ModelUse Case
Coding Max ThinkingAutonomous agents with preserved reasoning traces across turns
Coding MaxDeep debugging, algorithm design, complex system modeling
Coding Pro ThinkingEngages deep reasoning (Pro level)
General MaxStandard, High-velocity coding, code review, architectural decisions

You can configure all LLM models and all Virtual Models depending on your needs and usage.


Usage Examples

Ask Questions

You can ask Open Code to explain parts of your codebase:

How is authentication handled in @src/api/auth.ts

Use the @ key to fuzzy search files in your project.

Add Features

Use Plan Mode (press Tab) to have Open Code create a plan before making changes:

<TAB>
Add a delete feature for notes. When a user deletes a note, flag it as deleted in the database.
Create a screen showing recently deleted notes with options to undelete or permanently delete.

Once satisfied with the plan, switch back to Build Mode (press Tab again) and ask Open Code to implement it.

Make Simple Changes

For straightforward changes, you can ask Open Code to build directly:

Add authentication to the /settings route. Use the same logic as in @src/routes/notes.ts

Undo Changes

If you're not happy with the changes:

/undo

You can run /undo multiple times to undo several changes.


Advanced Configuration

Custom Model Settings

Configure specific model options in ~/.config/opencode/opencode.json:

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ig1-ai": {
"options": {
"timeout": 600000
},
"models": {
"Coding Max Thinking": {
"variants": {
"high": {
"reasoningEffort": "high"
},
"low": {
"reasoningEffort": "low"
}
}
}
}
}
}
}

Disable Auto-Update

{
"$schema": "https://opencode.ai/config.json",
"autoupdate": false
}

Set Permissions

Require approval for file edits and bash commands:

{
"$schema": "https://opencode.ai/config.json",
"permission": {
"edit": "ask",
"bash": "ask"
}
}

Troubleshooting

Models Not Showing

  1. Verify your API key is correct in ~/.local/share/opencode/auth.json
  2. Check your Dedicated Gateway URL is accessible
  3. Run /connect and re-enter your API key

Connection Errors

Ensure your Dedicated Gateway URL follows the pattern https://api.xxx.ig1.ai where xxx is your organization trigram.