Agentes de código
Usa Libremodel en OpenCode
OpenCode acepta cualquier proveedor compatible con OpenAI. Agréganos a su archivo de configuración y todos los modelos aparecen en /models, con sus límites y precios.
1. Instala OpenCode
curl -fsSL https://opencode.ai/install | bashnpm install -g opencode-ai2. 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 ~/.config/opencode/opencode.json para usarlo en todos lados, o como opencode.json en un solo proyecto. Si el archivo ya existe, agrega el proveedor libremodel al lado de los que tienes.
{
"$schema": "https://opencode.ai/config.json",
"model": "libremodel/deepseek-v4.1-flash-1017",
"provider": {
"libremodel": {
"npm": "@ai-sdk/openai-compatible",
"name": "Libremodel",
"options": {
"baseURL": "https://api.libremodel.ai/v1",
"apiKey": "{env:LIBREMODEL_API_KEY}"
},
"models": {
"kimi-k3.1-pro-uncensored": {
"name": "Kimi K3.1 Pro Uncensored",
"tool_call": true,
"interleaved": {
"field": "reasoning_content"
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 131072
},
"cost": {
"input": 3,
"output": 9,
"cache_read": 0.3
},
"variants": {
"low": {
"reasoningEffort": "low"
},
"high": {
"reasoningEffort": "high"
},
"max": {
"reasoningEffort": "max"
}
}
},
"deepseek-v4.1-flash-1017-uncensored": {
"name": "DeepSeek V4.1 Flash Uncensored",
"tool_call": true,
"interleaved": {
"field": "reasoning_content"
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 131072
},
"cost": {
"input": 0.25,
"output": 0.9,
"cache_read": 0.04
},
"variants": {
"off": {
"reasoningEffort": "off"
},
"low": {
"reasoningEffort": "low"
},
"high": {
"reasoningEffort": "high"
},
"max": {
"reasoningEffort": "max"
}
}
},
"glm-5.3-flash-uncensored": {
"name": "GLM 5.3 Flash Uncensored",
"tool_call": true,
"interleaved": {
"field": "reasoning_content"
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 131072
},
"cost": {
"input": 0.3,
"output": 1.2,
"cache_read": 0.06
},
"variants": {
"low": {
"reasoningEffort": "low"
},
"high": {
"reasoningEffort": "high"
},
"max": {
"reasoningEffort": "max"
}
}
},
"kimi-k3.1-pro": {
"name": "Kimi K3.1 Pro",
"tool_call": true,
"interleaved": {
"field": "reasoning_content"
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 131072
},
"cost": {
"input": 1,
"output": 6,
"cache_read": 0.25
},
"variants": {
"low": {
"reasoningEffort": "low"
},
"high": {
"reasoningEffort": "high"
},
"max": {
"reasoningEffort": "max"
}
}
},
"deepseek-v4.1-flash-1017": {
"name": "DeepSeek V4.1 Flash",
"tool_call": true,
"interleaved": {
"field": "reasoning_content"
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 262144
},
"cost": {
"input": 0.04,
"output": 0.3,
"cache_read": 0.004
},
"variants": {
"off": {
"reasoningEffort": "off"
},
"low": {
"reasoningEffort": "low"
},
"high": {
"reasoningEffort": "high"
},
"max": {
"reasoningEffort": "max"
}
}
},
"minimax-m3.1-flash": {
"name": "MiniMax M3.1 Flash",
"tool_call": true,
"interleaved": {
"field": "reasoning_content"
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 131072
},
"cost": {
"input": 0.05,
"output": 0.2,
"cache_read": 0.005
},
"variants": {
"low": {
"reasoningEffort": "low"
},
"high": {
"reasoningEffort": "high"
},
"max": {
"reasoningEffort": "max"
}
}
}
}
}
}
}4. Ábrelo
opencodeCambia de modelo con /models y de esfuerzo con ctrl+t.
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.