OpenCode can connect to TokenHub through a custom OpenAI-compatible provider. Tencent Cloud's OpenCode documentation uses DeepSeek V4 Pro in its configuration example; this article replaces the model ID and display name with Hy4, based on the Hunyuan API guide for the same platform. This is an adaptation of the documented schema, not a Tencent Cloud example specifically for Hy4, and it has not been tested with an actual API call.
Suitable tasks: Using TokenHub Hy4 in the OpenCode desktop app or CLI to assist with code analysis, writing, and editing.
Unsuitable tasks: Scenarios that require a verified Hy4-specific configuration or production-readiness guarantee. The official OpenCode page does not provide a Hy4 example, and this article has not tested one.
Applicable model version: TokenHub model ID hy4, corresponding to the general-availability version of Hy4.
Applicable client, agent, or API: OpenCode desktop app or CLI; TokenHub's OpenAI-compatible provider.
Recommended reasoning level and parameters: The TokenHub Hunyuan guide says Hy4 defaults to the high reasoning level. The OpenCode integration page does not explain how to override the reasoning level in this custom-provider configuration, so this article does not add any unverified parameters.
The JSON below follows the configuration structure in Tencent Cloud's OpenCode documentation, replacing the example model deepseek-v4-pro with the general-availability model ID hy4 listed in the Hunyuan guide and changing the display name to Hy4. This is a schema-based adaptation, not an official Hy4 configuration as published:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"tencent": {
"npm": "@ai-sdk/openai-compatible",
"name": "Tencent",
"options": {
"baseURL": "https://tokenhub.tencentmaas.com/v1"
},
"models": {
"hy4": {
"name": "Hy4"
}
}
}
}
}Configuration file path: ~/.config/opencode/opencode.json. In the OpenCode CLI, enter /connect, select Tencent, and paste your TokenHub API Key. Then enter /models and select Hy4.
In OpenCode's model management settings, add a custom OpenAI-compatible provider and enter:
| Field | Value |
|---|---|
| Provider ID | tencent |
| Display name | Tencent |
| Base URL | https://tokenhub.tencentmaas.com/v1 |
| API key | TokenHub API Key |
| Model ID | hy4 |
| Model display name | Hy4 |
Save the settings, restart OpenCode, and select Hy4 from the model list. The desktop configuration's hy4 is likewise a substitution in the official DeepSeek example based on the Hunyuan guide.
Create an API Key in TokenHub and confirm that its access scope includes Hy4. Tencent Cloud's official OpenCode documentation requires the key used in its DeepSeek example to include access to DeepSeek V4 Pro; changing the model checked to Hy4 is an adaptation based on the TokenHub model ID.
Configure the OpenCode desktop app or CLI as above, using the base URL https://tokenhub.tencentmaas.com/v1.
Save the API Key through /connect, then select Hy4 under /models. In the desktop app, restart it and select the model instead.
Submit a simple code explanation task and check whether a response arrives. This is a suggested user-side validation workflow; it does not mean this article ran OpenCode or tested a request.
Tencent Cloud's OpenCode documentation was last updated on 2026-08-31. It describes desktop and CLI configuration, uses deepseek-v4-pro as the example model, and gives https://tokenhub.tencentmaas.com/v1 as the base URL.
The document's CLI configuration uses @ai-sdk/openai-compatible and the provider.tencent.models field. In the CLI, /connect configures the API Key and /models switches models.
The TokenHub Hunyuan API guide lists hy4 as the general-availability model ID, distinguishing it from hy4-preview. Hy4 has a 1,024k context window, a maximum input of 960k, and a maximum output of 64k.
The Hunyuan guide says Hy4 defaults to the high reasoning level. These model IDs and parameters were cross-checked, but they do not appear as a Hy4 configuration example on Tencent Cloud's OpenCode page.
The JSON configuration is an inference based on the structure of the official OpenCode example, with the model ID replaced. Tencent Cloud's documentation does not confirm this specific Hy4 configuration or provide compatibility test results for Hy4 with OpenCode.
This article has not verified the OpenCode version, model calls, API key permission errors, streaming output, or tool-calling behavior. If configuration problems arise, first check the current requirements for custom providers in OpenCode and the model permissions in the TokenHub console.
Do not use hy4-preview or model identifiers from other platforms as the TokenHub general-availability model ID. The TokenHub Hunyuan guide uses hy4.
On 2026-11-16, Tabbit was used to review Tencent Cloud's TokenHub OpenCode configuration documentation and Hunyuan API guide. This article adapts the configuration fields from the former using the hy4 model ID published in the latter. OpenCode was not installed, no local configuration was written, and no request was made with an API Key.
Hy4