OpenAI-compatible clients
Connect OpenAI-compatible clients and coding agents through the meinGPT API
meinGPT exposes an OpenAI-compatible API. You can run OpenAI-compatible clients and coding agents against your meinGPT models. This page shows the setup using OpenCode and Pi as examples; other clients are configured the same way.
Prerequisites
- A personal API key: in your meinGPT settings, open "meinGPT API" and create a key.
- The client of your choice, installed locally (e.g. OpenCode or Pi).
- The API base URL:
https://app.meingpt.com/api/openai/v1
Configure the client
In both cases you register meinGPT as a custom provider: base URL, API key, and the models you want to use – for a coding agent, one is usually enough. Valid model IDs are the models enabled for your organization; you can find them via the /models endpoint or the model overview in meinGPT.
Create an opencode.json in your project:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"meingpt": {
"npm": "@ai-sdk/openai-compatible",
"name": "meinGPT",
"options": {
"baseURL": "https://app.meingpt.com/api/openai/v1",
"apiKey": "YOUR_API_KEY"
},
"models": {
"claude-sonnet-4-6": {
"name": "Claude Sonnet 4.6",
"limit": { "context": 200000, "output": 64000 }
}
}
}
}
}Then start OpenCode with the model:
opencode -m meingpt/claude-sonnet-4-6The limit field tells OpenCode the model's context window (context) and maximum output length (output), which lets it show context utilization. Without these values the utilization indicator stays at 0%. You can find the right values per model in the model overview in meinGPT.
Add more models under models.
Pi registers providers via an extension. Create the file ~/.pi/extensions/meingpt.ts:
export default function (pi) {
pi.registerProvider("meingpt", {
baseUrl: "https://app.meingpt.com/api/openai/v1",
apiKey: "YOUR_API_KEY",
api: "openai-completions",
models: [
{
id: "claude-sonnet-4-6",
name: "Claude Sonnet 4.6",
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 200000,
maxTokens: 64000,
},
],
});
}Then start Pi with the provider and model:
pi --provider meingpt --model claude-sonnet-4-6Add more models to the extension's models array.
Not every model supports the function calls (tool calls) a coding agent uses. Search models such as Perplexity Sonar reject those requests with an error – use a model like Claude, GPT, or Gemini instead.
Optional: pull in every model (OpenCode)
OpenCode reads available models from the /models endpoint, but for custom providers it only shows models it recognizes itself. If you want every enabled model in the picker without adding them one by one, you can generate the models block from the API once (it needs curl and python3) and re-run it when needed. The /models endpoint does not return context windows, so for models generated this way the utilization indicator stays at 0% until you add limit by hand:
KEY="YOUR_API_KEY"
curl -s -H "Authorization: Bearer $KEY" \
https://app.meingpt.com/api/openai/v1/models \
| KEY="$KEY" python3 -c '
import sys, json, os
data = json.load(sys.stdin)["data"]
models = {m["id"]: {"name": m["id"]} for m in data if m["id"] != "text-embedding-3-large"}
print(json.dumps({
"$schema": "https://opencode.ai/config.json",
"provider": {"meingpt": {
"npm": "@ai-sdk/openai-compatible",
"name": "meinGPT",
"options": {"baseURL": "https://app.meingpt.com/api/openai/v1", "apiKey": os.environ["KEY"]},
"models": models,
}}
}, indent=2))
' > opencode.jsonFor Pi, add the models you want to the extension's models array.