opencode
Register LuluTokens as a custom provider in opencode.json.
opencode reads its providers from a JSON config. Adding LuluTokens means declaring one custom provider that uses the OpenAI-compatible SDK and lists the models you want in the picker.
Configure
Pick a config file
| Path | Scope |
|---|---|
~/.config/opencode/opencode.json | All projects |
opencode.json in the repo root | This project only (commit it, minus secrets) |
Declare the provider
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"lulutokens": {
"npm": "@ai-sdk/openai-compatible",
"name": "LuluTokens",
"options": {
"baseURL": "https://api.lulutokens.ai/v1",
"apiKey": "{env:LULUTOKENS_API_KEY}"
},
"models": {
"deepseek-v4-pro": { "name": "DeepSeek V4 Pro" },
"qwen3.7-max": { "name": "Qwen3.7 Max" }
}
}
},
"model": "lulutokens/deepseek-v4-pro"
}The {env:...} form keeps the key out of the file, so a project-level
opencode.json is safe to commit.
Add one entry per model you want in the picker. The key of each entry must match
the model ID exactly as it appears in GET /v1/models; name is only the label.
Start opencode
export LULUTOKENS_API_KEY="sk-..."
opencodeUse /models inside opencode to confirm the LuluTokens models are listed, and
switch between them.
Storing the key in opencode instead
If you would rather not manage the environment variable, drop the apiKey line
and let opencode hold the credential:
opencode auth loginChoose Other, enter lulutokens as the provider ID, and paste the key.
Per-model overrides
Anything the model needs beyond defaults goes on its entry — for example a smaller context window for a model that is documented as supporting less than opencode assumes:
"models": {
"deepseek-v4-pro": {
"name": "DeepSeek V4 Pro",
"limit": { "context": 64000, "output": 8000 }
}
}Troubleshooting
| Symptom | Fix |
|---|---|
Provider missing from /models | JSON syntax error — run opencode from a terminal and read the startup warning |
401 | LULUTOKENS_API_KEY is not set in the shell that launched opencode |
404 | baseURL is missing /v1 |
| Model answers but tools never run | The model has no tool-calling support; pick one that does |