Pi
Connect Pi to Yolo Router with a custom OpenAI-compatible provider.
- Pi is installed and can start normally.
- A working Yolo Router endpoint, for example
https://api.yolorouter.com. - A Yolo Router API Key generated from the console.
- The model ID you want to use, for example
deepseek-v4-pro. It must exactly match the model ID in the Yolo Router console.
Pi is a minimal, extensible terminal coding framework. It supports custom OpenAI-compatible providers through its config file. For Yolo Router, set
baseUrlto the/v1endpoint and useopenai-completions.
Setup
Set the API Key env var
The examples below use YOLOROUTER_API_KEY; the Pi config will read this variable.
export YOLOROUTER_API_KEY="sk-yolo-..."$env:YOLOROUTER_API_KEY = "sk-yolo-..."set YOLOROUTER_API_KEY=sk-yolo-...Do not write the real API Key into config files or commit it to your repository.
Edit the Pi config file
Add a yolorouter provider to Pi's config file:
{
"providers": {
"yolo": {
"baseUrl": "https://api.yolorouter.com/v1",
"api": "openai-completions",
"apiKey": "${YOLOROUTER_API_KEY}",
"models": [
{
"id": "deepseek-v4-pro",
"name": "deepseek-v4-pro",
"contextWindow": 200000,
"maxTokens": 128000,
"input": ["text"],
"reasoning": true,
"compat": {
"supportsDeveloperRole": false,
"requiresReasoningContentOnAssistantMessages": true,
"thinkingFormat": "anthropic",
"reasoningEffortMap": {
"minimal": "low",
"low": "low",
"medium": "medium",
"high": "high",
"xhigh": "max"
}
}
}
]
}
}
}Field notes:
baseUrl: your Yolo Router OpenAI-compatible endpoint, with/v1api: always useopenai-completionsapiKey: uses the$YOLOROUTER_API_KEYvariable reference so you do not commit the real Keymodels[].id: must exactly match the model ID in the Yolo Router consolecompat.requiresReasoningContentOnAssistantMessages: keeps reasoning content on historical messages when thinking mode is activereasoningEffortMap: maps Pi effort levels to the target model's supported reasoning levels; omitcompatfor non-reasoning models
Test the connection
Send a test message:
Introduce the model you are using in one sentence.If Pi returns a normal response, the integration is working. You can also check the Yolo Router console for the corresponding request log.
Troubleshooting
yolorouter is not in the provider list
Check the Pi config file path and JSON format. Restart Pi after changing the config.
401 Unauthorized
Make sure YOLOROUTER_API_KEY is exported in the current shell and has no extra spaces.
Reasoning model acts strangely
Verify requiresReasoningContentOnAssistantMessages and thinkingFormat for reasoning models. For non-reasoning models, remove the compat block.
Model not found
Confirm that models[].id exactly matches the model ID in the Yolo Router console.