OpenCode
Connect OpenCode to the iCreat API
OpenCode is an open-source terminal AI coding assistant. With iCreat's OpenAI-compatible API, you can use authorized models inside OpenCode.
Prerequisites
- An iCreat API Key
- The API Key must include the target model, e.g.
gpt-5.5(see available IDs on the Model Plaza) - OpenCode installed
- Network access to
https://api.icreat.ai
Install OpenCode
macOS / Linux
Recommended — official install script:
curl -fsSL https://opencode.ai/install | bashOr via npm:
npm install -g opencode-aiOn macOS, you can also use Homebrew:
brew install anomalyco/tap/opencodeWindows
OpenCode officially recommends WSL. You can also install with:
npm install -g opencode-aiVerify installation:
opencode --versionConfigure OpenCode
OpenCode supports project-level and global configuration:
- Project-level:
opencode.jsonoropencode.jsoncin the project root - Global:
~/.config/opencode/opencode.jsonon macOS / Linux - Windows:
%USERPROFILE%\.config\opencode\opencode.json
Global configuration is recommended so all projects can reuse the same settings. If you use project-level config, do not commit your API Key to the repository.
Config file
Save the following as opencode.json or opencode.jsonc:
{
"$schema": "https://opencode.ai/config.json",
"model": "icreat/gpt-5.5",
"provider": {
"icreat": {
"npm": "@ai-sdk/openai-compatible",
"name": "iCreat AI",
"options": {
"baseURL": "https://api.icreat.ai/llm/openai/v1",
"apiKey": "{env:ICREAT_API_KEY}"
},
"models": {
"gpt-5.5": {
"name": "GPT-5.5"
}
}
}
}
}Field reference:
| Field | Description |
|---|---|
provider.icreat |
Custom provider identifier; can stay as shown |
npm |
OpenCode uses the OpenAI-compatible adapter to connect to iCreat |
baseURL |
iCreat OpenAI-compatible base URL; must end with /v1 |
apiKey |
Read the API Key from the ICREAT_API_KEY environment variable |
model |
Default model in the form icreat/<model-id> |
models |
Models available in the OpenCode model picker; IDs must match iCreat user model codes |
Note
Use
https://api.icreat.ai/llm/openai/v1forbaseURL. Do not use legacy grouped paths, and do not omit the trailing/v1. OpenCode appends paths such as/chat/completionsautomatically.
Set the API Key
macOS / Linux
export ICREAT_API_KEY="<sk-your-token>"To persist across terminal sessions, add the line to ~/.zshrc or ~/.bashrc, then run:
source ~/.zshrcWindows PowerShell
$env:ICREAT_API_KEY = "<sk-your-token>"To persist on Windows, add a system environment variable named ICREAT_API_KEY, then open a new terminal.
Launch
Start OpenCode from your project directory:
cd your-project-folder
opencodeOn first use, run:
/modelsSelect gpt-5.5 under iCreat AI, or rely on the default model in your config file.
OpenCode also supports /connect for provider credentials, but for iCreat we recommend the ICREAT_API_KEY environment variable — simpler and avoids storing secrets in OpenCode credential files.
Verify the connection
Send this in OpenCode:
Reply with: OpenCode is connected to iCreat AI.If you receive a normal response, the setup is working.
You can also inspect the loaded config:
opencode debug configCheck Usage Logs in the iCreat console for model, token usage, and billing details.
FAQ
OpenCode cannot find the model
Check:
- Model IDs in
modelsmatch iCreat user model codes modeluses the correct provider prefix, e.g.icreat/gpt-5.5- Your API Key is authorized for that model
401 or Unauthorized
Confirm the API Key is set in the current terminal:
macOS / Linux
test -n "$ICREAT_API_KEY" && echo "ICREAT_API_KEY is set"Windows PowerShell
if ($env:ICREAT_API_KEY) { "ICREAT_API_KEY is set" }Also verify the key is not expired, deleted, or wrapped in extra whitespace.
Wrong request URL
baseURL should be:
https://api.icreat.ai/llm/openai/v1Do not use legacy grouped paths, and do not omit the trailing /v1.
Slow responses
- Confirm your network can reach
https://api.icreat.ai - Try a faster model
- Check service status and usage logs in the iCreat console
Security
- Do not commit API Keys inside
opencode.jsonto Git - Do not expose API Keys in screenshots, logs, or public chats
- Create a dedicated API Key for OpenCode to track usage and revoke access easily
- If a key is leaked, delete it in the console and create a new one immediately
