mirror of
https://github.com/docker/docker-agent.git
synced 2026-11-04 10:02:15 +00:00
An explicitly configured base_url of https://api.openai.com/v1 was being treated as a custom endpoint, so the fast/priority (2x) and ultrafast (6x) service-tier cost multipliers silently fell back to standard rates. Only the resolved client endpoint was checked before; now both the configured and resolved values are compared against the official endpoint. Also narrows Vercel's gpt-6-astra long-context tier boundary from 272001 to 272000 tokens so it matches the exclusive threshold RatesFor expects, and adds published-rate boundary coverage for gpt-5.6-luna and gpt-6-astra plus mixed-tier SQLite persistence tests. Assisted-By: docker-agent
27 lines
612 B
Go
27 lines
612 B
Go
package modelsdev
|
|
|
|
import "slices"
|
|
|
|
func (c *Cost) forModel(id ID) *Cost {
|
|
if c == nil || id.Provider != "vercel" || (id.Model != "openai/gpt-6-astra" && id.Model != "openai/gpt-6-astra-fast") {
|
|
return c
|
|
}
|
|
var out *Cost
|
|
for i, tier := range c.Tiers {
|
|
if tier.Tier.Type != "context" || tier.Tier.Size != 272_001 {
|
|
continue
|
|
}
|
|
if out == nil {
|
|
cloned := *c
|
|
cloned.Tiers = slices.Clone(c.Tiers)
|
|
out = &cloned
|
|
}
|
|
// Vercel's catalogue uses the first long-context token; RatesFor uses an exclusive threshold.
|
|
out.Tiers[i].Tier.Size = 272_000
|
|
}
|
|
if out != nil {
|
|
return out
|
|
}
|
|
return c
|
|
}
|