fix(openai): resolve Anthropic compat mapping from normalized model
Anthropic compat requests normalize reasoning suffixes before forwarding, but the account mapping step was still using the raw request model. Resolve billing and upstream models from the normalized compat model so explicit account mappings win over fallback defaults. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -41,6 +41,7 @@ func (s *OpenAIGatewayService) ForwardAsAnthropic(
|
|||||||
}
|
}
|
||||||
originalModel := anthropicReq.Model
|
originalModel := anthropicReq.Model
|
||||||
applyOpenAICompatModelNormalization(&anthropicReq)
|
applyOpenAICompatModelNormalization(&anthropicReq)
|
||||||
|
normalizedModel := anthropicReq.Model
|
||||||
clientStream := anthropicReq.Stream // client's original stream preference
|
clientStream := anthropicReq.Stream // client's original stream preference
|
||||||
|
|
||||||
// 2. Convert Anthropic → Responses
|
// 2. Convert Anthropic → Responses
|
||||||
@@ -60,13 +61,14 @@ func (s *OpenAIGatewayService) ForwardAsAnthropic(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. Model mapping
|
// 3. Model mapping
|
||||||
billingModel := resolveOpenAIForwardModel(account, originalModel, defaultMappedModel)
|
billingModel := resolveOpenAIForwardModel(account, normalizedModel, defaultMappedModel)
|
||||||
upstreamModel := resolveOpenAIUpstreamModel(billingModel)
|
upstreamModel := resolveOpenAIUpstreamModel(billingModel)
|
||||||
responsesReq.Model = upstreamModel
|
responsesReq.Model = upstreamModel
|
||||||
|
|
||||||
logger.L().Debug("openai messages: model mapping applied",
|
logger.L().Debug("openai messages: model mapping applied",
|
||||||
zap.Int64("account_id", account.ID),
|
zap.Int64("account_id", account.ID),
|
||||||
zap.String("original_model", originalModel),
|
zap.String("original_model", originalModel),
|
||||||
|
zap.String("normalized_model", normalizedModel),
|
||||||
zap.String("billing_model", billingModel),
|
zap.String("billing_model", billingModel),
|
||||||
zap.String("upstream_model", upstreamModel),
|
zap.String("upstream_model", upstreamModel),
|
||||||
zap.Bool("stream", isStream),
|
zap.Bool("stream", isStream),
|
||||||
|
|||||||
Reference in New Issue
Block a user