OpenCode
Register PromptsForLess as a custom OpenCode provider in opencode.json, pick a model and run your first agent task.
OpenCode works with PromptsForLess as a custom Chat Completions provider. The first schema below follows the OpenCode 1.x provider guide. OpenCode 2 uses a different schema, so check your installed version first.
Add your provider
Store your key from the dashboard as PFL_API_KEY. Then merge this into opencode.json in your project or user configuration. The key stays in your environment.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"promptsforless": {
"npm": "@ai-sdk/openai-compatible",
"name": "PromptsForLess",
"options": {
"baseURL": "https://api.promptsforless.com/v1",
"apiKey": "{env:PFL_API_KEY}"
},
"models": {
"deepseek-v4.1-flash": {
"name": "DeepSeek V4.1 Flash"
}
}
}
}
}Add more entries under models for any other IDs from the catalog. For agent work, pick models with tool calling.
OpenCode 2 configuration
OpenCode 2's provider reference uses providers, package and settings:
{
"$schema": "https://opencode.ai/config.json",
"providers": {
"promptsforless": {
"name": "PromptsForLess",
"env": ["PFL_API_KEY"],
"package": "@opencode/ai/providers/openai-compatible",
"settings": {
"baseURL": "https://api.promptsforless.com/v1"
},
"models": {
"deepseek-v4.1-flash": {
"name": "DeepSeek V4.1 Flash"
}
}
}
}
}Pick a model and test
Start OpenCode from the terminal that has your key. Open /models and choose promptsforless/deepseek-v4.1-flash. The promptsforless/ prefix names your local provider; the ID sent to our API is deepseek-v4.1-flash.
Send a short prompt, then ask it to read a file in a small test repository. Once that works, let it edit files and run shell tools. If you set context and output limits, copy them from the model's page in the catalog.
Troubleshooting
| Symptom | Fix |
|---|---|
| Configuration is rejected | Match the schema to your OpenCode major version. |
| Provider has no models | Check the models entry, the key and your /models selection. |
| Authentication fails | Check that the OpenCode process can read PFL_API_KEY. |
| Agent stalls after a tool call | Pick a model with tool calling. |
Use the quickstart to test the API directly, or compare models.