feat: MoA supports Anthropic Messages format (MOA_{NAME}_API_FORMAT=anthropic)

Kimi coding plan and GLM both use Anthropic-compatible API, not OpenAI.
queryModel now dispatches to /v1/messages or /chat/completions based on
apiFormat config per reference model.
This commit is contained in:
Eyejoker
2026-03-31 01:49:34 +09:00
parent a89ab757b6
commit da27d30079
3 changed files with 62 additions and 30 deletions

View File

@@ -183,7 +183,10 @@ function parseMoaReferenceModels(): MoaModelConfig[] {
const baseUrl = getEnv(`${prefix}_BASE_URL`) || '';
const apiKey = getEnv(`${prefix}_API_KEY`) || '';
if (!model || !baseUrl || !apiKey) return null;
return { name, model, baseUrl, apiKey };
const rawFormat = getEnv(`${prefix}_API_FORMAT`) || '';
const apiFormat: 'openai' | 'anthropic' =
rawFormat === 'anthropic' ? 'anthropic' : 'openai';
return { name, model, baseUrl, apiKey, apiFormat };
})
.filter((m): m is MoaModelConfig => m !== null);
}