🎨 优化上游ai兼容性,修复newapi返回token为空的问题

This commit is contained in:
2026-03-04 02:29:28 +08:00
parent ae73298bbf
commit a0d98b4761
4 changed files with 20 additions and 0 deletions

View File

@@ -10,6 +10,8 @@ type ClaudeMessageResponse struct {
StopReason string `json:"stop_reason,omitempty"` // end_turn, max_tokens, stop_sequence
StopSequence string `json:"stop_sequence,omitempty"`
Usage ClaudeUsage `json:"usage"`
// 统一格式的用量统计(与 OpenAI chat.completions 对齐)
StandardUsage *ChatCompletionUsage `json:"standard_usage,omitempty"`
}
type ClaudeContentBlock struct {

View File

@@ -8,6 +8,8 @@ type ChatCompletionResponse struct {
Model string `json:"model"`
Choices []ChatCompletionChoice `json:"choices"`
Usage ChatCompletionUsage `json:"usage"`
// 统一格式的用量统计(用于各种上游的标准化)
StandardUsage *ChatCompletionUsage `json:"standard_usage,omitempty"`
// 扩展字段:正则脚本执行日志
RegexLogs *RegexExecutionLogs `json:"regex_logs,omitempty"`
}