Tensic can act as the model provider for OpenCode and other coding agents. One click creates an inference project with the models you choose, a project API key and the commands to run in your terminal. All requests then show up in that project's logs, with token usage and cost.
Connect OpenCode with "Connect an app"
This is the fastest way to connect OpenCode. Tensic creates a new inference project for you.
- On the Tensic Home page, click Connect an app and choose OpenCode.
- In the Connect OpenCode dialog, set:
- Team: the team that owns the new project. The project uses that team's models and budget.
- Project name: any name. Tensic normalises it, and the dialog shows the final name (for example
opencode_test). This name also becomes the provider name in OpenCode. - Models to serve: the models OpenCode can use. The first model you pick becomes the default, but callers can choose any of the listed models on each request.
- Click Create and connect. Tensic creates the inference project and a project API key.
- The dialog now says the project is ready and shows two commands, with your key already filled in:
Copy them now. This is the only time the full key is shown. It cannot be retrieved later.export TENSIC_API_KEY=<your key> opencode auth login https://<your-instance>/projects/<project-id> - If you'd rather use a config file, click Prefer a static config? Show the opencode.json block and copy the JSON into your OpenCode configuration.
- Click Open project to go to the new project, or Done.
Everything in the dialog except the key itself is also on the project's API and Connect pages.
Run the commands and pick a Tensic model in OpenCode
- Open a terminal and paste the
export TENSIC_API_KEY=…command. This puts the key in an environment variable for the current shell. - Run the
opencode auth login https://<your-instance>/projects/<project-id>command. OpenCode reads the project's discovery file, stores the key and adds the project as a provider, with all of its models. You don't need to edit any YAML or run any scripts. - Start
opencode. - Open the model picker (Select model). The Tensic project appears as its own provider group, named after the project (for example
opencode_test), with the models you selected. - Pick a model and send a test prompt, for example "write me the Fibonacci series in Python".
The provider is registered at login, so you don't need to run /connect in OpenCode for it.
Connect an existing project with the tensic CLI
Every project has a Connect page (the Connect button at the top of the project). Under Coding agents, the tensic CLI writes each agent's own config file. The agent then needs no flags and no wrapper script. There are tabs for Claude Code, OpenCode, Codex, Grok and Hermes.
- Open the project and click Connect.
- Under Coding agents, select the tab for your agent, for example OpenCode.
- Run the three commands shown. The project ID is already filled in:
The first command installs the tensic CLI. The second logs in to the project. The third configures the agent.curl -fsSL https://<your-instance>/install.sh | bash tensic login --project <project-id> tensic opencode on - When
tensic loginasks for a key, paste a project API key. If you don't have one yet, create one on the project's Access tab (see Teams, access and API keys). - To undo, run
tensic opencode off(or the matching command for your agent). This restores the agent's own settings exactly as they were.
The same page also lists the project's OpenAI base URL, Anthropic base URL and served Models, for tools you configure by hand.
Use OpenCode's built-in discovery instead of the CLI
If you'd rather not install anything, use OpenCode's own discovery mechanism. On the project's Connect page, click Prefer not to install anything? Use OpenCode's own discovery, or scroll to OpenCode discovery.
- OpenCode reads an unauthenticated discovery file at
GET /projects/<project-id>/.well-known/opencode. At login, it sets the project up as a provider: base URL, auth and every served model, with no manual config. - The OpenCode tab shows the two steps: create a project API key and export it as
TENSIC_API_KEY, then runopencode auth login https://<your-instance>/projects/<project-id>. - The opencode.json tab shows a static config block you can paste yourself.
- The cURL tab shows how to fetch the discovery file directly.
Below that, Agent descriptor (GET /projects/<project-id>/.well-known/agents) is the file the tensic CLI reads. It lists both base URLs, the served models with their context windows and which model to use for background work. It is unauthenticated and publishes no prices.
Discovery is specific to OpenCode. Other coding agents don't have an equivalent, so use the tensic CLI for them.
Show request prices in OpenCode
OpenCode can show what each request costs, but only if the discovery file includes prices. Tensic publishes the prices you set on the project, never the underlying model cost.
- Open the project and go to the Pricing tab.
- Enter the price you want to expose for each model, then save.
- Fetch the discovery file again (or log in again from OpenCode). It now contains the prices you entered.
The discovery file is open to anyone without authentication. That's how the well-known mechanism works. Only put prices there that you're happy to publish.
Check OpenCode traffic in the project logs
Every request OpenCode sends through Tensic is logged in the project, unless logging is turned off for it. This helps with debugging, and it also shows how a coding agent works: its system message, the messages it sends and the tools it calls.
- Open the project (it has the name you gave it in Connect an app).
- Click Logs.
- Each model call is one row, showing when it happened, finish reason, tools called, request size, model, tokens and latency/status. A tool loop produces several rows for one user request.
- Expand a row to see the request (system and user messages), the last user message and the response.
For the full log view, token and cost breakdown, redaction and retention, see Budgets, limits and logs.
Common questions
Do I have to create a project before connecting OpenCode?
No. Connect an app creates a new inference project, the API key and the commands in one step. To use a project you already have, open it and click Connect.
I closed the dialog without copying the key. What now?
The full key is only shown once. Create a new key on the project's Access tab, export it as TENSIC_API_KEY and run the login command again.
Which coding agents are supported?
The Connect page has tensic CLI instructions for Claude Code, OpenCode, Codex, Grok and Hermes. OpenCode can also use its own discovery file.
Why don't I see the Tensic models in OpenCode?
Check that TENSIC_API_KEY is set in the same shell and that opencode auth login finished successfully. The provider appears under the project's name in the model picker.
Can I choose which model OpenCode uses?
Yes. All models you selected under Models to serve appear in OpenCode. The first one is the default.
How do I stop routing an agent through Tensic?
Run tensic <agent> off, for example tensic opencode off. This restores the agent's own settings.
Does the discovery file expose my costs?
No. It only contains the prices you set on the project's Pricing tab. Model costs are never published there.