Agentes de código
Usa Libremodel en Pi
Pi acepta cualquier endpoint compatible con OpenAI en models.json. Agréganos y todos los modelos aparecen en /model, con su ventana de contexto y sus precios.
1. Instala 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 necesita Node.js 22.19 o más nuevo. Los instaladores de macOS, Linux y Windows lo instalan si falta.
2. Guarda tu API key
Crea una key en API keys y guárdala como LIBREMODEL_API_KEY. En macOS y Linux, agrega la línea a ~/.zshrc o ~/.bashrc para que la tenga cada terminal nueva.
export LIBREMODEL_API_KEY="sk-libremodel-..."[Environment]::SetEnvironmentVariable("LIBREMODEL_API_KEY", "sk-libremodel-...", "User")3. Agrega Libremodel
Guárdalo como ~/.pi/agent/models.json en macOS y Linux, o como %USERPROFILE%\.pi\agent\models.json en Windows. Si el archivo ya existe, agrega el proveedor libremodel en providers, al lado de los que tienes.
{
"$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
}
}
]
}
}
}Cada modelo lleva su ventana de contexto y sus precios. El pie de Pi muestra el contexto usado y el costo acumulado, y /session muestra los tokens y el costo de la sesión.
4. Ábrelo
Abre Pi en la carpeta en la que quieres que trabaje:
pi --model libremodel/deepseek-v4.1-flash-1017Cambia de modelo con /model; presiona Ctrl+S sobre uno para que sea el de las sesiones nuevas. Cambia de esfuerzo con /thinking. Abrir /model vuelve a leer models.json.
Si algo no funciona
Ejecuta esto en la misma terminal desde la que abres la herramienta. No cuesta nada. Si vuelve la lista de modelos, la key está bien. Un 401 quiere decir que LIBREMODEL_API_KEY está vacía o mal en esa terminal: abre una nueva después de guardarla.
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"Si la key está bien y la herramienta recibe un 402, tu saldo no cubre el request. Ver Saldo y créditos.
Notas
Los agentes con subagentes mandan varios requests a la vez. Si la capacidad está ocupada, los que sobran esperan en una cola corta en vez de fallar. Ver Límites y errores.
/thinking ofrece los niveles de la API: low, high y max. Todos los modelos piensan antes de responder, así que no hay off.
Los precios del archivo son el precio «desde» de cada modelo. Lo que se cobró por cada request está en Actividad.