feat(usage): add Volcengine Coding Plan quota query (AK/SK signing)#4460
feat(usage): add Volcengine Coding Plan quota query (AK/SK signing)#4460FlintyLemming wants to merge 1 commit into
Conversation
Add a fifth Token Plan provider alongside Kimi / Zhipu / MiniMax / ZenMux. Volcengine's GetCodingPlanUsage is an Ark control-plane API that requires HMAC-SHA256 AK/SK signing — not the Ark API Key used for coding — so the user supplies Access Key ID + Secret Access Key (stored in usage_script, mirroring the ZenMux pattern), with an inline link to the IAM key management console. - Rust: HMAC-SHA256 Signature V4 signing (ported from ai-plan-insight, verified byte-for-byte against the Python reference in a unit test), query_volcengine, QuotaUsage parser (5h/weekly/monthly), new TIER_MONTHLY constant. - Provider detection scopes to ark.cn-beijing.volces.com/api/coding so the DouBaoSeed (/api/compatible) preset on the same host is not misrouted. - Frontend: volcengine entry in CODING_PLAN_PROVIDERS, AK/SK inputs + console link in UsageScriptModal, monthlyLimit tier label across en/zh/zh-TW/ja. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e03a9663a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let client = crate::proxy::http_client::get(); | ||
| let body = "{}"; | ||
| let url = format!( | ||
| "https://{VOLCENGINE_ARK_HOST}/?Action=GetCodingPlanUsage&Version=2024-01-01" |
There was a problem hiding this comment.
Use the seat usage action for Volcengine quota
When querying Volcengine Coding Plan, this sends Action=GetCodingPlanUsage, but the official Coding Plan API Explorer exposes the usage actions as GetSeatInfoUsage/ListSeatInfoUsages (with ListSeatInfos for seats), not GetCodingPlanUsage. In this Volcengine path, even valid AK/SK credentials will be signed for an unknown action and return an API error instead of quota data, so the new provider never shows usage; please switch the action and corresponding response parsing to the published seat-usage endpoint.
Useful? React with 👍 / 👎.
Summary
Adds 火山方舟 Coding Plan as a fifth provider under the Token Plan usage query (alongside Kimi / Zhipu / MiniMax / ZenMux).
Unlike the existing providers, Volcengine's quota endpoint
GetCodingPlanUsageis an Ark control-plane API that authenticates with HMAC-SHA256 AK/SK signing — not the Ark API Key used for coding. So the user supplies an Access Key ID + Secret Access Key (with an inline link to the IAM key-management console), stored inusage_scriptthe same way ZenMux stores its credentials.Signing logic is ported from the reference implementation at
ai-plan-insightand verified byte-for-byte against the Python source in a unit test.Screenshots
用量查询设置
主页面
Changes
Rust
services/coding_plan.rs: Volcengine provider detection + Signature V4 signing (zero new deps —hex/percent-encode hand-written),query_volcengine,QuotaUsageparser (5h / weekly / monthly windows).services/subscription.rs: newTIER_MONTHLYconstant.provider.rs/commands/coding_plan.rs/commands/provider.rs:UsageScriptgainsaccessKeyId/secretAccessKey;get_coding_plan_quotathreads optional AK/SK; TOKEN_PLAN branch passes them for Volcengine.Frontend
config/codingPlanProviders.ts: volcengine entry. Detection is scoped toark.cn-beijing.volces.com/api/codingso the DouBaoSeed (/api/compatible) preset on the same host is not misrouted.components/UsageScriptModal.tsx: AK/SK inputs + IAM console link, wired into test / save / auto-inject.components/SubscriptionQuotaFooter.tsx:monthly→subscription.monthlyLimitlabel.en/zh/zh-TW/ja(AK/SK hints +monthlyLimit).Testing
cargo test coding_plan— 33 pass, incl.volcengine_signing_matches_reference_algorithm(Rust signature == Python reference for identical fixed input).pnpm typecheck— clean.pnpm test:unit— 338/338 pass..app, selected 火山 Coding Plan in the Token Plan provider row, AK/SK fields + console link render; empty → clear error, not a silent failure.Notes
cn-beijing.🤖 Generated with Claude Code