OpenCode
OpenCode accepts custom OpenAI-compatible providers in its config file, so you can add OpenPike as one and call any chat completions model through it.
| OpenPike endpoint | POST /v1/chat/completions |
| Base URL | https://api.openpike.dev/v1 |
| Key | A virtual key, from an environment variable or /connect |
| Models | provider/model names, listed in the config |
| Tags | headers in the provider config |
1. Create a key for OpenCode
Section titled “1. Create a key for OpenCode”On the Keys page, create a virtual key with the tag agent=opencode, and set it as an environment variable:
export OPENPIKE_API_KEY="opk_live_..."$env:OPENPIKE_API_KEY = "opk_live_..."2. Configure OpenCode
Section titled “2. Configure OpenCode”Add a provider in opencode.jsonc (in your project, or in OpenCode’s global config). The provider ID, here openpike, is what you use in model references:
{ "$schema": "https://opencode.ai/config.json", "providers": { "openpike": { "name": "OpenPike", "env": ["OPENPIKE_API_KEY"], "package": "@opencode/ai/providers/openai-compatible", "settings": { "baseURL": "https://api.openpike.dev/v1" }, "headers": { "x-openpike-tags": "agent=opencode" }, "models": { "deepseek-flash": { "name": "DeepSeek Flash", "modelID": "deepseek/deepseek-flash" }, "gpt-5.4-mini": { "name": "GPT-5.4 mini", "modelID": "openai/gpt-5.4-mini" } } } }, "model": "openpike/deepseek-flash"}envnames the variable OpenCode reads the key from. You can also run/connectand enter it there.modelIDis the name OpenCode sends, which must be OpenPike’sprovider/modelname. The key above it is OpenCode’s own short name.headersaddsx-openpike-tagsto every request.
3. Check it works
Section titled “3. Check it works”Start OpenCode, pick a model with /models (it is listed as openpike/deepseek-flash), and send a prompt. The request shows in OpenPike’s Logs under the agent opencode.
Claude models are not available through this provider, because OpenPike serves them in the Anthropic format only.
Example
Section titled “Example”A runnable copy of this setup, with a .env.example, is in the OpenPike examples repo.