~/.config/opencode/opencode.json
Native [OI] supportOpenCode with a custom [OI]-compatible provider
OpenCode supports custom providers through @ai-sdk/openai-compatible. Add one provider block, list the catalog ids you want, and switch models per session.
Base URL
https://uncensoredai.dev/v1
- 01
Create the config file
OpenCode reads opencode.json or opencode.jsonc from the project root, or from the global config directory. The provider block below registers UncensoredAI.
opencode.json{ "$schema": "https://opencode.ai/config.json", "provider": { "uncensoredai": { "npm": "@ai-sdk/openai-compatible", "name": "UncensoredAI", "options": { "baseURL": "https://uncensoredai.dev/v1", "apiKey": "{env:UNCENSOREDAI_API_KEY}" }, "models": { "deepseek-v4.1-flash": { "name": "DeepSeek V4.1 Flash" }, "gpt-6-sol": { "name": "GPT-6 Sol" }, "glm-5.3-flash-uncensored": { "name": "GLM-5.3 Flash Uncensored" } } } }, "model": "uncensoredai/deepseek-v4.1-flash" } - 02
Set the key
Keep the key out of the config file by using the env placeholder, then export it.
macOS / Linuxexport UNCENSOREDAI_API_KEY="sk-ua-XXXX-XXXX-XXXX-XXXX"Windows (PowerShell)$env:UNCENSOREDAI_API_KEY = "sk-ua-XXXX-XXXX-XXXX-XXXX" - 03
Pick the provider in the model list
Restart OpenCode and select a model under UncensoredAI. Model ids must match the catalog exactly; OpenCode does not fetch /v1/models automatically.
FAQ
Does OpenCode support arbitrary [OI]-compatible endpoints?+
Yes. The @ai-sdk/openai-compatible provider takes a base URL and API key, so any chat-completions-compatible gateway works.
Why is my model missing from OpenCode?+
The models map must list each id you want; OpenCode does not discover them. Copy exact ids from the model catalog.
