Repository navigation
Conversation
Add estimated_cost to OpenAI model listings and single-model responses from the existing usage pricing table. Search aliases share base rates; context tiers include cached input and use a strict input-size threshold. Validation: internal/api, internal/pricing and internal/requestdb tests passed with the repository's pinned Darwin ARM64 static libraries. TestModelEstimatedCost fails with the original openAIModelObject (no estimated_cost), and passes with this change at 200000/200001 input tokens. Unknown model prices remain omitted.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 17, 2026
BUKOWSKIREAL
pushed a commit
to BUKOWSKIREAL/magpie-gemini-web
that referenced
this pull request
Nov 17, 2026
Map AIStudio2API estimated_cost into model prices, including cached input and context tiers. Prefer those rates over public catalog estimates only when the host advertises the complete modelCost capability. Older hosts and backends retain the existing zero-price placeholder. Validation: 344 Node tests and 39 Bun Studio tests pass; diff interrogation and package dry-run pass. The new regression fails against the original adapter's all-zero prices, and checks both capability states through the actual plugin entrypoint. Independent read-only review found no issues. A sanitized five-request ledger replay through the adapter and a patched Magpie binary calculates $0.69533715 from the backend rates. Backend protocol: Mag1cFall/AIStudio2API#184.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动 / Changes
OpenAI 模型列表与单模型响应提供
estimated_cost,客户端可以复用用量页的输入、输出、缓存输入单价和长上下文分档。搜索型号沿用基础型号的价格,未计价模型省略该字段。数据直接来自
internal/pricing的现有价格表。tiers[].above使用严格大于的输入阈值,输入含缓存命中,输出含思考 token。配套适配:magpie-gemini-web #68、Magpie #6922,使用同一份价格计算账号卡与请求用量的估算费用。验证 / Verification
go test ./internal/api ./internal/pricing ./internal/requestdb通过,使用仓库 CI 固定的 Darwin ARM64 SpiderMonkey/libwebp 静态库。openAIModelObject运行新测试,报has no estimated_cost;新实现通过。