OpenCode
Open-source AI coding agent — launch through AntSeed with `antseed opencode`.
OpenCode is an MIT-licensed terminal coding agent built on the Vercel AI SDK. It supports 75+ providers out of the box and lets you register custom ones via opencode.json.
`antseed opencode` creates that custom provider config in a temporary opencode.json, points OpenCode at it for the child process, and deletes it when the session exits. Manual project or global config still works if you want OpenCode to remember AntSeed outside the wrapper.
AntSeed plugs in as a custom provider using the @ai-sdk/openai-compatible adapter — the same one OpenCode recommends for any OpenAI-compatible endpoint (LM Studio, llama.cpp, Atomic Chat, etc.). No ANTHROPIC_BASE_URL: OpenCode reads provider config from JSON.
Each model you want to use must be listed under models. The id has to match what the buyer proxy returns from GET /v1/models — i.e. a service id advertised by your currently-pinned peer.
Run AntSeed first
Every integration assumes a buyer proxy at http://localhost:8377. One-time setup, ~2 minutes.
Step 1
Install OpenCode
- Install OpenCodenpm install -g opencode-ai
- Verify it runsopencode --version
Step 2
Point OpenCode at AntSeed
Recommended: the wrapper resolves the proxy URL, writes a temporary OpenCode config with one AntSeed model, sets `OPENCODE_CONFIG` for the child process, and forwards extra OpenCode args.
Manual equivalent if you want OpenCode to keep AntSeed in its normal project or global config.
Step 3
Pick a model
`antseed opencode --model <service-id>` generates a temporary config for that one id. In manual config, the keys under `models` must exactly match service ids returned by `curl http://localhost:8377/v1/models`.
The exact list of models depends on which peer you pin. Run antseed network browse or open the live network page to see what's available right now.
Verify
Test it
- Confirm the proxy lists the same ids your config referencescurl -s http://localhost:8377/v1/models | jq '.data[].id'Example response"claude-opus-4-7" "claude-sonnet-4-6" "deepseek-v4-flash" "gpt-oss-120b"
Add or remove entries under `models` in `opencode.json` so they match this list.
- Launch OpenCode through the wrapperantseed opencode --model gpt-oss-120b
Extra OpenCode args are forwarded, so `antseed opencode --model gpt-oss-120b run` works too. Manual config equivalent: run `opencode`, then pick one of the AntSeed entries from `/models`.
How OpenCode talks to AntSeed
- Wire format sent by OpenCode:
OpenAI Chat Completions(hits/v1/chat/completionson the buyer proxy) - Best-fit services: any service whose
protocolsarray containsopenai-chat-completions. That's what the peer advertises as natively-supported — zero translation overhead, no transform edge cases. - How to check a peer: run
antseed network peer <peerId> --jsonand look atproviderServiceApiProtocols[provider].services[service]. The browse command exposes the same field per peer. - What happens when protocols don't match: AntSeed's
@antseed/api-adaptertranslates between OpenAI Chat Completions and the service's native protocol on the fly. So a request from OpenCode can still reach a service that only advertisesanthropic-messages— just with a small transform step. - One known caveat: services whose only advertised protocol is
openai-responsesrequire streaming. If OpenCode sends a non-streaming request and the proxy routes it to one of those services, the call fails withHTTP 400: Stream must be set to true. Pick a service whoseprotocolsincludesopenai-chat-completions(or another non-responses protocol) to avoid this.
If it goes wrong
Troubleshooting
- AntSeed doesn't appear in `/connect` or `/models`With `antseed opencode`, pass the service id via `--model`; the wrapper supplies a temporary config. With manual config, make sure `opencode.json` is in your project root (or `~/.config/opencode/opencode.json`) and that the JSON is valid — a stray comma silently disables the whole provider.
- Model is listed but every call returns `model_not_found`The pinned peer doesn't advertise that service id. Run `antseed network peer <peerId>` to see what it actually offers, or pin a different peer.
- OpenCode prompts for an API keyThe proxy ignores auth, but the AI SDK sometimes asks anyway. Either skip the prompt (press enter on empty input) or set `"apiKey": "antseed"` inside `options` in `opencode.json`.
Reference
Links
Same category