feat(service): record upstream model across all gateway paths

Propagate UpstreamModel through ForwardResult and OpenAIForwardResult in Anthropic direct, API-key passthrough, Bedrock, and OpenAI gateway flows. Extract optionalNonEqualStringPtr and optionalTrimmedStringPtr into usage_log_helpers.go. Store upstream_model only when it differs from the requested model.

Also introduces anthropicPassthroughForwardInput struct to reduce parameter count.
This commit is contained in:
Ethan0x0000
2026-03-17 19:25:35 +08:00
parent 51547fa216
commit 2e4ac88ad9
6 changed files with 107 additions and 45 deletions

View File

@@ -98,6 +98,9 @@ type UsageLog struct {
AccountID int64
RequestID string
Model string
// UpstreamModel is the actual model sent to the upstream provider after mapping.
// Nil means no mapping was applied (requested model was used as-is).
UpstreamModel *string
// ServiceTier records the OpenAI service tier used for billing, e.g. "priority" / "flex".
ServiceTier *string
// ReasoningEffort is the request's reasoning effort level.