provider configuration. When connecting to the powertokens platform, start with an OpenAI-compatible custom provider that points opencode at the platform /v1/chat/completions compatible endpoint.
This page is for opencode text-agent workflows. Some image, speech, and video task models in /v1/models also declare openai, but that does not mean they are text Chat Completions models for opencode.
If you need to choose the endpoint first, see Text model protocols and endpoints.
Choose a path
| Goal | opencode provider | Base URL | Recommended model |
|---|---|---|---|
| Recommended text path | custom provider + @ai-sdk/openai-compatible | https://api.powertokens.ai/v1 | glm-5.2 |
| MiniMax text path | custom provider + @ai-sdk/openai-compatible | https://api.powertokens.ai/v1 | MiniMax-M3 |
| Claude/Anthropic path | @ai-sdk/anthropic custom provider | https://api.powertokens.ai/v1 | Use only when you need to validate /v1/messages |
Prepare the API key
Store thepowertokens platform API key in an environment variable:
/connect in the opencode TUI and save credentials there. The provider ID in opencode.json must match the provider ID used by /connect.
OpenAI-compatible provider example
Create or update.opencode/opencode.json in your project:
POST /v1/chat/completions endpoint.
Model choice
Useglm-5.2 as the OpenAI-compatible default. Use MiniMax-M3 for MiniMax scenarios. When you need BytePlus or Seed text models, prefer the OpenAI-compatible provider.
Do not add image-generation, openai-video, TTS, Kling, Vidu, or Wan task models to an opencode text provider. For the full text model matrix, see Text model protocols and endpoints.
Anthropic provider example
For Claude/Anthropic Messages, configure a separate@ai-sdk/anthropic custom provider. This path uses the platform /v1/messages endpoint; validate the current opencode version and target model end to end before relying on it.
glm-5.2 as the default Anthropic-path model. Use MiniMax-M3 for MiniMax-path validation. deepseek-v3-2-251201 passed opencode Anthropic-provider tool-workflow validation. Seed models except seed-1-6-flash-250715 also passed re-validation and can be selected for real-task validation. Do not use seed-1-6-flash-250715 as an opencode Anthropic-provider default.
Verify
First confirm opencode can read the provider and models:powertokens/glm-5.2 or powertokens-anthropic/glm-5.2, then send:
Capability boundaries
- The opencode
@ai-sdk/openai-compatibleprovider covers text Chat Completions semantics only. - A model declaring
openaiinsupported_endpoint_typesis not automatically suitable for opencode text-agent use; exclude image, speech, video, and task models. - Reasoning models such as
MiniMax-M3may return thinking content or consume extra output tokens. Validate the display behavior with real tasks. - A model declaring
anthropicinsupported_endpoint_typesis not automatically suitable for the opencode Anthropic provider. opencode sends tool metadata and uses streaming output, so validate the full tool workflow. deepseek-v3-2-251201passed an opencode Anthropic-provider task with tool use.seed-1-6-flash-250715is not supported by its upstream provider on/v1/messages; prefer the OpenAI-compatible provider.- Do not write a real API key into
.opencode/opencode.jsonor commit it to your repository.