OpenCode
Use TensorX models with OpenCode, the open-source terminal-based AI coding agent.
Prerequisites
OpenCode installed
A TensorX API key from app.tensorx.ai
Configuration
Step 1: Connect the Provider
Run /connect in OpenCode, select Other, and enter:
Provider ID
tensorx
API Key
Your TensorX API key
Step 2: Configure opencode.json
Add the following to your project's opencode.json (or ~/.opencode/opencode.json for global config):
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"tensorx": {
"npm": "@ai-sdk/openai-compatible",
"name": "TensorX",
"options": {
"baseURL": "https://api.tensorx.ai/v1",
"apiKey": "{env:TENSORX_API_KEY}"
},
"models": {
"<MODEL_ID>": {
"name": "TensorX model"
}
}
}
}
}Replace <MODEL_ID> with an ID returned by GET /v1/models. Add optional limits only after reading the selected model's metadata from GET /v1/model/info.
Step 3: Set API Key
Set your API key as an environment variable:
Or add to ~/.opencode/.env:
Vision / Image Support
Model selection
Call GET /v1/models with your TensorX API key and use one of the returned IDs. If the integration depends on a capability or token limit, query GET /v1/model/info before selecting the model. See Models for examples.
Tips
For vision tasks, remember to add the
modalitiesconfig shown aboveUse the model ID as the configuration key
Resources
Last updated
Was this helpful?

