← All applications · Connect apps section on /docs
OpenAIManual setup
OpenCode
OpenCode: configure the API key, model and provider in your terminal.
Published instructions · App version: unverified
Chat, ping, invoke and content-generation examples may send real billable requests. Check the model, balance, rate and minimum before running them. GET /v1/models checks authentication and the catalogue only. Set up environment variables safely
Base URL to paste
OpenAI SDKs generally use a URL ending in /v1; Anthropic SDKs use the root URL. Avoid adding /v1 twice. Protocol compatibility does not guarantee every provider feature.
https://thapi.cloud/v1Prerequisites
- Install opencode
- API keys
Recommended model: gpt-5.6-sol
Quick way — command / config
export STALI_API_KEY="sk-thapi-..."Where to place file / fill Settings
Filemacos
~/.config/opencode/opencode.json
Back up the file; merge provider.thapi and model as shown. Set STALI_API_KEY in the OpenCode process environment.
Filelinux
~/.config/opencode/opencode.json
Same as macOS.
Filewindows
%USERPROFILE%\.config\opencode\opencode.json
Create .config\opencode if needed; save opencode.json. Set $env:STALI_API_KEY before opening OpenCode.
Verify connection
- Run opencode models "thapi" to check the models; select thapi/gpt-5.6-sol before sending a paid test chat.
Troubleshooting
| Symptom | Reason | How to handle |
|---|---|---|
| 404 | baseURL is missing /v1. | https://thapi.cloud/v1 |
Notes
- You can use opencode.json in the project root; project settings override global settings. Other paths require OPENCODE_CONFIG.