fix openai image request handling

This commit is contained in:
meteor041
2026-04-23 09:53:57 +08:00
parent 6449da6c8d
commit 00778dca31
8 changed files with 484 additions and 20 deletions

View File

@@ -128,6 +128,21 @@ func TestGetModelPricing_Gpt54NanoUsesDedicatedStaticFallbackWhenRemoteMissing(t
require.Zero(t, got.LongContextInputTokenThreshold)
}
func TestGetModelPricing_ImageModelDoesNotFallbackToTextModel(t *testing.T) {
imagePricing := &LiteLLMModelPricing{InputCostPerToken: 3}
textPricing := &LiteLLMModelPricing{InputCostPerToken: 9}
svc := &PricingService{
pricingData: map[string]*LiteLLMModelPricing{
"gpt-image-2": imagePricing,
"gpt-5.4": textPricing,
},
}
got := svc.GetModelPricing("gpt-image-3")
require.Same(t, imagePricing, got)
}
func TestParsePricingData_PreservesPriorityAndServiceTierFields(t *testing.T) {
raw := map[string]any{
"gpt-5.4": map[string]any{