Agentes de código
Use a Libremodel no OpenCode
O OpenCode aceita qualquer provedor compatível com a OpenAI. Adicione a gente ao arquivo de configuração dele e todos os modelos aparecem em /models, com os seus limites e preços.
1. Instale o OpenCode
curl -fsSL https://opencode.ai/install | bashnpm install -g opencode-ai2. Salve a sua API key
Crie uma key em API keys e salve-a como LIBREMODEL_API_KEY. No macOS e no Linux, adicione a linha ao ~/.zshrc ou ao ~/.bashrc para que todo terminal novo já a tenha.
export LIBREMODEL_API_KEY="sk-libremodel-..."[Environment]::SetEnvironmentVariable("LIBREMODEL_API_KEY", "sk-libremodel-...", "User")3. Adicione a Libremodel
Salve isto como ~/.config/opencode/opencode.json para usar em todos os lugares, ou como opencode.json em um único projeto. Se o arquivo já existir, adicione o provedor libremodel ao lado dos que você já tem.
{
"$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. Abra o OpenCode
opencodeTroque de modelo com /models e de esforço com ctrl+t.
Se algo não funcionar
Rode isto no mesmo terminal em que você abre a ferramenta. Não custa nada. Se voltar a lista de modelos, a key está certa. Um 401 quer dizer que LIBREMODEL_API_KEY está vazia ou errada nesse terminal: abra um novo depois de salvá-la.
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"Se a key estiver certa e a ferramenta receber um 402, o seu saldo não cobre o request. Veja Saldo e créditos.