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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user