Compatible Gateways

OpenCode

Use OpenCode Go and OpenCode Zen compatible endpoints with Anvia.

OpenCode documents provider entries for OpenCode Go and OpenCode Zen. Treat them as OpenAI-compatible gateway-style endpoints when your OpenCode account exposes an API key and base URL.

OpenCode Go

import { AgentBuilder } from "@anvia/core";
import { OpenAIClient } from "@anvia/openai";

const client = new OpenAIClient({
  baseUrl: "https://opencode.ai/zen/go/v1",
  apiKey: process.env.OPENCODE_API_KEY,
});

const model = client.completionModel("opencode-go");

const agent = new AgentBuilder("coding-assistant", model)
  .instructions("Answer coding questions with concise, concrete steps.")
  .build();

const response = await agent.prompt("Explain this TypeScript error.").send();

console.log(response.output);

OpenCode Zen

const client = new OpenAIClient({
  baseUrl: "https://opencode.ai/zen/v1",
  apiKey: process.env.OPENCODE_API_KEY,
});

const model = client.completionModel("opencode-zen");

Get the Model List

If your OpenCode endpoint exposes an OpenAI-compatible model list, call listModels() on the client configured with that base URL.

const client = new OpenAIClient({
  baseUrl: "https://opencode.ai/zen/go/v1",
  apiKey: process.env.OPENCODE_API_KEY,
});

const models = await client.listModels();

console.table(models.data.map((model) => ({ id: model.id, owner: model.ownedBy })));

Notes

  • OpenCode Go and OpenCode Zen are OpenCode-specific provider entries. Keep them on one page unless you need separate setup flows.
  • Verify the exact base URL and model ids in your OpenCode account before deploying.

For current OpenCode provider details, see the OpenCode providers documentation.