Pi Coding Agent + APIMaster.ai
Configurez Pi Coding Agent avec models.json et auth.json pour l'API compatible OpenAI d'APIMaster sur Windows et macOS.
Pi Coding Agent est un agent de codage en terminal. Ajoutez le fournisseur apimaster via ~/.pi/agent/models.json pour utiliser l'API compatible OpenAI d'APIMaster.
Obtenez d'abord une clé API. Les identifiants de modèles correspondent au marketplace et à
GET /v1/models.
Répertoire de configuration
| Plateforme | Chemin |
|---|---|
| Windows | C:\Users\<username>\.pi\agent\ |
| macOS / Linux | ~/.pi/agent/ |
Fichiers : models.json (fournisseur + modèles), auth.json (stockage facultatif de clé API).
models.json
Le niveau supérieur doit être providers. Utilisez UTF-8 sans BOM sur Windows.
{
"providers": {
"apimaster": {
"baseUrl": "https://apimaster.ai/v1",
"api": "openai-completions",
"apiKey": "$APIMASTER_API_KEY",
"models": [
{ "id": "claude-haiku-4-5", "name": "Claude Haiku 4.5 via apimaster", "reasoning": true, "contextWindow": 128000, "maxTokens": 16384 },
{ "id": "claude-opus-4-7", "name": "Claude Opus 4.7 via apimaster", "reasoning": true, "contextWindow": 128000, "maxTokens": 16384 },
{ "id": "claude-opus-4-8", "name": "Claude Opus 4.8 via apimaster", "reasoning": true, "contextWindow": 128000, "maxTokens": 16384 },
{ "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6 via apimaster", "reasoning": true, "contextWindow": 128000, "maxTokens": 16384 },
{ "id": "gpt-5.4", "name": "GPT 5.4 via apimaster", "reasoning": true, "contextWindow": 128000, "maxTokens": 16384 },
{ "id": "gpt-5.5", "name": "GPT 5.5 via apimaster", "reasoning": true, "contextWindow": 128000, "maxTokens": 16384 },
{ "id": "minimax-m3", "name": "MiniMax M3 via apimaster", "reasoning": true, "contextWindow": 128000, "maxTokens": 16384 }
]
}
}
}
auth.json (facultatif)
{
"apimaster": {
"type": "api_key",
"key": "your_apimaster_key"
}
}
Variables d'environnement
Windows (PowerShell, session) :
$env:APIMASTER_API_KEY="your_apimaster_key"
Windows (persistant) :
[Environment]::SetEnvironmentVariable("APIMASTER_API_KEY", "your_apimaster_key", "User")
macOS / Linux :
export APIMASTER_API_KEY="your_apimaster_key"
echo 'export APIMASTER_API_KEY="your_apimaster_key"' >> ~/.zshrc
Vérification
pi --list-models
pi --provider apimaster --model gpt-5.5
Dépannage
models.jsondoit utiliser la racineproviders— pas un objetapiKeynu.- Le BOM UTF-8 sur Windows casse
JSON.parse— enregistrez sans BOM. - Modèles manquants — vérifiez le chemin
~/.pi/agent/models.json(ou l'équivalent du profil utilisateur Windows).