Coding agents
Use Libremodel in Pi
Pi takes any OpenAI-compatible endpoint in models.json. Add us and every model shows up in /model, with its context window and prices.
1. Install Pi
curl -fsSL https://pi.dev/install.sh | shpowershell -c "irm https://pi.dev/install.ps1 | iex"npm install -g --ignore-scripts @earendil-works/pi-coding-agentPi needs Node.js 22.19 or newer. The macOS, Linux and Windows installers install it if it is missing.
2. Set your API key
Create a key in API keys and save it as LIBREMODEL_API_KEY. On macOS and Linux, add the line to ~/.zshrc or ~/.bashrc so every new terminal has it.
export LIBREMODEL_API_KEY="sk-libremodel-..."[Environment]::SetEnvironmentVariable("LIBREMODEL_API_KEY", "sk-libremodel-...", "User")3. Add Libremodel
Save this as ~/.pi/agent/models.json on macOS and Linux, or %USERPROFILE%\.pi\agent\models.json on Windows. If the file exists, add the libremodel provider under providers, next to the ones you have.
{
"$schema": "https://pi.dev/schemas/models.schema.json",
"providers": {
"libremodel": {
"name": "Libremodel",
"baseUrl": "https://api.libremodel.ai/v1",
"api": "openai-completions",
"apiKey": "$LIBREMODEL_API_KEY",
"compat": {
"supportsReasoningEffort": true,
"thinkingFormat": "openai"
},
"models": [
{
"id": "kimi-k3.1-pro-uncensored",
"name": "Kimi K3.1 Pro Uncensored",
"reasoning": true,
"thinkingLevelMap": {
"off": null,
"minimal": null,
"low": "low",
"medium": null,
"high": "high",
"max": "max"
},
"input": [
"text",
"image"
],
"contextWindow": 1048576,
"maxTokens": 131072,
"cost": {
"input": 3,
"output": 9,
"cacheRead": 0.3,
"cacheWrite": 3
}
},
{
"id": "deepseek-v4.1-flash-1017-uncensored",
"name": "DeepSeek V4.1 Flash Uncensored",
"reasoning": true,
"thinkingLevelMap": {
"off": "off",
"minimal": null,
"low": "low",
"medium": null,
"high": "high",
"max": "max"
},
"input": [
"text",
"image"
],
"contextWindow": 1048576,
"maxTokens": 131072,
"cost": {
"input": 0.25,
"output": 0.9,
"cacheRead": 0.04,
"cacheWrite": 0.25
}
},
{
"id": "glm-5.3-flash-uncensored",
"name": "GLM 5.3 Flash Uncensored",
"reasoning": true,
"thinkingLevelMap": {
"off": null,
"minimal": null,
"low": "low",
"medium": null,
"high": "high",
"max": "max"
},
"input": [
"text",
"image"
],
"contextWindow": 1048576,
"maxTokens": 131072,
"cost": {
"input": 0.3,
"output": 1.2,
"cacheRead": 0.06,
"cacheWrite": 0.3
}
},
{
"id": "kimi-k3.1-pro",
"name": "Kimi K3.1 Pro",
"reasoning": true,
"thinkingLevelMap": {
"off": null,
"minimal": null,
"low": "low",
"medium": null,
"high": "high",
"max": "max"
},
"input": [
"text",
"image"
],
"contextWindow": 1048576,
"maxTokens": 131072,
"cost": {
"input": 1,
"output": 6,
"cacheRead": 0.25,
"cacheWrite": 1
}
},
{
"id": "deepseek-v4.1-flash-1017",
"name": "DeepSeek V4.1 Flash",
"reasoning": true,
"thinkingLevelMap": {
"off": "off",
"minimal": null,
"low": "low",
"medium": null,
"high": "high",
"max": "max"
},
"input": [
"text",
"image"
],
"contextWindow": 1048576,
"maxTokens": 262144,
"cost": {
"input": 0.04,
"output": 0.3,
"cacheRead": 0.004,
"cacheWrite": 0.04
}
},
{
"id": "minimax-m3.1-flash",
"name": "MiniMax M3.1 Flash",
"reasoning": true,
"thinkingLevelMap": {
"off": null,
"minimal": null,
"low": "low",
"medium": null,
"high": "high",
"max": "max"
},
"input": [
"text",
"image"
],
"contextWindow": 1048576,
"maxTokens": 131072,
"cost": {
"input": 0.05,
"output": 0.2,
"cacheRead": 0.005,
"cacheWrite": 0.05
}
}
]
}
}
}Each model carries its context window and prices. The footer of Pi shows the context used and the accumulated cost, and /session shows the tokens and cost of the session.
4. Start it
Start Pi in the folder you want it to work in:
pi --model libremodel/deepseek-v4.1-flash-1017Switch models with /model; press Ctrl+S on one to make it the default for new sessions. Change reasoning effort with /thinking. Opening /model reloads models.json.
Troubleshooting
Run this in the same terminal you start the tool from. It costs nothing. A list of models means the key is fine. A 401 means LIBREMODEL_API_KEY is empty or wrong in that terminal; open a new one after saving it.
curl -s https://api.libremodel.ai/v1/models -H "Authorization: Bearer $LIBREMODEL_API_KEY"curl.exe -s https://api.libremodel.ai/v1/models -H "Authorization: Bearer $env:LIBREMODEL_API_KEY"If the key is fine and the tool gets a 402, your balance does not cover the request. See Billing and credits.
Notes
Agents that run subagents send several requests at once. When capacity is busy, the extra ones wait in a short queue instead of failing. See Limits and errors.
/thinking offers the levels of the API: low, high and max. Every model thinks before it answers, so there is no off.
The prices in the file are each model's starting price. What each request was charged is in Activity.