Connect OpenCode to the models your key can use
Set up Hostlinku as an OpenAI-compatible provider and verify the model list before running your first coding task.
A model can appear in the Hostlinku public catalog and still be outside the Service Mode of your API key. Check the authenticated catalog first when setting up a new OpenCode profile or switching an existing one to a different mode. It gives you model IDs you can verify before any agent request.
Verify the key in the environment OpenCode will use
Create a key for the intended Service Mode in Console and set it in the environment as HOSTLINKU_API_KEY. In a Bash shell that has the variable set, list model IDs with the command below. Keep the key in your environment or a secret manager.
curl -fsS https://api.hostlinku.com/v1/models -H "Authorization: Bearer $HOSTLINKU_API_KEY" | jq -r '.data[].id'From API key to a verified OpenCode model
HOSTLINKU_API_KEY- Source
- Key created for the intended Service Mode
- Scope
- Environment that launches OpenCode
Key is available
Query the model catalog with that key.
Key is missing
Check the launcher’s environment before querying the API.
Add one model to your provider configuration
Merge the Hostlinku provider into your OpenCode configuration and preserve the providers you already use. The example uses the DeepSeek V4.1 Flash Hyper ID. If your key returns a different model, use its exact ID in both the top-level model setting and the provider’s model map.
{ "model": "hostlinku/deepseek-v4-1-flash-hyper", "provider": { "hostlinku": { "npm": "@ai-sdk/openai-compatible", "name": "Hostlinku", "options": { "baseURL": "https://api.hostlinku.com/v1", "apiKey": "{env:HOSTLINKU_API_KEY}" }, "models": { "deepseek-v4-1-flash-hyper": { "name": "DeepSeek V4.1 Flash Hyper" } } } }}This minimal setup gives you a manually maintained model list. A provider plugin can populate the list from the authenticated /v1/models API when it implements discovery for the connected key. Teams that keep separate keys for different modes can use that distinction when deciding how to maintain their profiles.
Try a small task before opening a long session
Open OpenCode, use /models to check your selection, and try a small explanation request. When invoking a model by ID, include the hostlinku/ prefix. If it fails, compare the configured ID with the catalog response from the same key and check that your app inherited the environment variable. For longer sessions, fill in the selected model’s supported context, output, and reasoning settings. OpenCode setup guide
Sources
- OpenCode setup guide · Hostlinku Docs