渠道模型列表与测试端点,修复探测无配额误判

This commit is contained in:
2026-07-14 19:33:33 +08:00
parent 79c9e4d9b9
commit 1da2197a6c
11 changed files with 688 additions and 22 deletions
+4 -3
View File
@@ -149,11 +149,12 @@ func capStrings(caps []generativeai.ModelCapabilityEnum) []string {
return out
}
// GenAiProbeChat 实现 Client:经 OpenAI 兼容面(直通同链路)发一次极小请求探测渠道;配额探测专用的最小聊天(maxTokens=1),返回 HTTP 状态码;
// modelName 决定请求格式(cohere.* 走 COHERE)。
// GenAiProbeChat 实现 Client:经 OpenAI 兼容面(直通同链路)发一次极小请求探测渠道;
// 配额探测专用的最小聊天,返回 HTTP 状态码。max_output_tokens 取 16:
// openai.gpt-oss 系列要求 >=16,其余模型均兼容,成本差异可忽略。
func (c *RealClient) GenAiProbeChat(ctx context.Context, cred Credentials, region, modelOcid, modelName string) (int, error) {
body, err := json.Marshal(map[string]any{"model": modelName, "input": "hi",
"max_output_tokens": 1, "store": false})
"max_output_tokens": 16, "store": false})
if err != nil {
return 0, err
}