Overview
OpenCode is a versatile, terminal-based AI coding assistant. By default, it connects to standard model providers, but it also allows you to define custom providers using an OpenAI-compatible API interface.
As an IsekaiDimension user, you can configure OpenCode to route requests through our AI router platform. This gives you access to hundreds of models (GPT, Claude, Llama, Mistral, and more) using a single API key and unified endpoint.
This guide provides step-by-step instructions for setting up IsekaiDimension as a custom provider in OpenCode.
Prerequisites
Before you begin, ensure you have the following:
- OpenCode installed (v0.1 or newer).
- An active IsekaiDimension account.
- Your IsekaiDimension API Key (available in the IsekaiDimension Dashboard under Settings → API Keys).
- Basic familiarity with editing JSON/JSONC files.
Step-by-Step Instructions
Step 1: Locate or Create the OpenCode Configuration File
OpenCode uses a configuration file to manage providers and settings.
- Global configuration (applies to all projects):
- macOS/Linux:
~/.config/opencode/opencode.jsonc - Windows:
%USERPROFILE%\.config\opencode\opencode.jsonc
- macOS/Linux:
- Project-specific configuration:
.opencode.jsoncin the root of your working directory.
If the file does not exist, create a new file named opencode.jsonc.
Step 2: Define the IsekaiDimension Provider
Open the configuration file in a text editor and add a provider object (if one does not already exist). Inside it, define a new provider using the OpenAI-compatible type.
Use the following configuration snippet:
{
"provider": {
"isekai": {
"type": "openai",
"baseUrl": "https://ai.ixdm.co.id/v1",
"apiKey": "$IXDM_API_KEY",
"models": {
"gpt-4o": { "name": "Isekai GPT-4o" },
"claude-3-5-sonnet": { "name": "Isekai Claude 3.5 Sonnet" }
}
}
}
}
Step 3: Map Your Desired Models
Under the models object, list the specific model IDs you want to use via IsekaiDimension. The key (e.g., "gpt-4o") must match the exact model ID provided by IsekaiDimension’s router, and the name value is the friendly label shown in OpenCode.
(You can find the full list of available model IDs in the IsekaiDimension Router Documentation.)
Step 4: Use Environment Variables for Security (Recommended)
Instead of hardcoding your API key directly into the JSON file (as shown above with "$ISEKAI_API_KEY"), export it as an environment variable in your shell:
# macOS / Linux
export ISEKAI_API_KEY="sk-your-actual-key-here"
# Windows (PowerShell)
$env:ISEKAI_API_KEY="sk-your-actual-key-here"
OpenCode automatically resolves $VARIABLE references in its config file.
Step 5: Save and Restart OpenCode
- Save the
opencode.jsoncfile. - If OpenCode is currently running, quit the session (
Ctrl+Cor type/exit). - Relaunch OpenCode in your terminal by running:
opencode
Step 6: Select the IsekaiDimension Provider
Once OpenCode is running:
- Open the model selection menu (typically by pressing
Ctrl+Por typing/modelin the chat interface). - Select isekai as the active provider.
- Choose one of the mapped models (e.g., Isekai GPT-4o).
Example: Full Configuration File
Here is an example of a complete opencode.jsonc file using IsekaiDimension alongside other default providers:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"isekai": {
"type": "openai",
"baseUrl": "https://api.isekaidimension.com/v1",
"apiKey": "$ISEKAI_API_KEY",
"models": {
"gpt-4o": { "name": "Isekai GPT-4o" },
"claude-3-5-sonnet": { "name": "Isekai Claude 3.5 Sonnet" },
"llama-3.1-70b": { "name": "Isekai Llama 3.1 70B" }
}
}
}
}
Troubleshooting
| Issue | Solution |
|-------|----------|
| 401 Unauthorized | Ensure your IsekaiDimension API key is valid, active, and correctly set in your environment or config. |
| Connection Error / 404 | Verify that baseUrl is set exactly to https://api.isekaidimension.com/v1 (do not add /chat/completions or trailing slashes). |
| Model Not Found | Confirm the model ID in your opencode.jsonc matches the exact ID string from the IsekaiDimension model catalog. |
| Config Not Loading | Ensure your JSON/JSONC syntax is valid. If using comments, make sure the file extension is .jsonc and your OpenCode version supports it. |
Verification
To confirm everything is working:
- Ask OpenCode a test question (e.g., "Hello, what model are you running?").
- Log in to your IsekaiDimension Dashboard and navigate to Usage Logs.
- You should see the request routed through the IsekaiDimension platform in real time.
For further assistance, contact IsekaiDimension Support or refer to the official OpenCode documentation.