Skip to content

feat(usage): add Volcengine Coding Plan quota query (AK/SK signing)#4460

Open
FlintyLemming wants to merge 1 commit into
farion1231:mainfrom
FlintyLemming:feat/volcengine-coding-plan-usage
Open

feat(usage): add Volcengine Coding Plan quota query (AK/SK signing)#4460
FlintyLemming wants to merge 1 commit into
farion1231:mainfrom
FlintyLemming:feat/volcengine-coding-plan-usage

Conversation

@FlintyLemming

@FlintyLemming FlintyLemming commented Jun 20, 2026

Copy link
Copy Markdown

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 GetCodingPlanUsage is 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 in usage_script the same way ZenMux stores its credentials.

Signing logic is ported from the reference implementation at ai-plan-insight and verified byte-for-byte against the Python source in a unit test.

Screenshots

用量查询设置

iShot_2026-06-21_00 02 58

主页面

iShot_2026-06-21_00 03 48

Changes

Rust

  • services/coding_plan.rs: Volcengine provider detection + Signature V4 signing (zero new deps — hex/percent-encode hand-written), query_volcengine, QuotaUsage parser (5h / weekly / monthly windows).
  • services/subscription.rs: new TIER_MONTHLY constant.
  • provider.rs / commands/coding_plan.rs / commands/provider.rs: UsageScript gains accessKeyId/secretAccessKey; get_coding_plan_quota threads optional AK/SK; TOKEN_PLAN branch passes them for Volcengine.

Frontend

  • config/codingPlanProviders.ts: volcengine entry. Detection is scoped to ark.cn-beijing.volces.com/api/coding so 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: monthlysubscription.monthlyLimit label.
  • i18n: 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.
  • Manual: built .app, selected 火山 Coding Plan in the Token Plan provider row, AK/SK fields + console link render; empty → clear error, not a silent failure.

Notes

  • Tray summary intentionally shows only the 5h / weekly windows (compact line); the monthly window appears in the provider-card footer badge.
  • BytePlus (international) is out of scope — the reference only supports cn-beijing.

🤖 Generated with Claude Code

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>
@farion1231

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants