Some AI services don’t have their own CLI tools. For convenience, you can use a unified CLI terminal such as OpenCode.
Configuration Sample
Configuration location: ~/.config/opencode/opencode.json
HaiHub provides an OpenAI-compatible API. Here is the complete configuration for this example.
{
"$schema": "https://opencode.ai/config.json",
"model": "haihub/Kimi-K2.5",
"provider": {
"haihub": {
"npm": "@ai-sdk/openai-compatible",
"name": "HaiHub",
"options": {
"baseURL": "https://api.model.haihub.cn/v1",
"apiKey": "{env:HAIHUB_API_KEY}"
},
"models": {
"Kimi-K2.5": {
"name": "Kimi K2.5"
},
"Qwen3.5-397B-A17B-FP8": {
"name": "Qwen3.5-397B-A17B-FP8"
},
"DeepSeek-V4-Pro": {
"name": "DeepSeek-V4-Pro"
}
}
}
}
}
haihubis a provider name you choose. Setmodeltohaihub/model-name.- The API is OpenAI-compatible, so set
npmto@ai-sdk/openai-compatible. - Instead of hardcoding the secret key in
apiKey, use{env:HAIHUB_API_KEY}to read theHAIHUB_API_KEYenvironment variable. You can choose any variable name.
Then add your secret key to ~/.zshrc:
export HAIHUB_API_KEY="sk-xxx"
