Skip to content

feat(deploy): add PTU throughput reservation commands - #218

Closed
gujieye wants to merge 1 commit into
mainfrom
feat/inference-train-command
Closed

gujieye wants to merge 1 commit into
mainfrom
feat/inference-train-command

Conversation

@gujieye

@gujieye gujieye commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds first-class support for PTU (provisioned throughput) reservations to the deploy command family, so users can provision, scale, renew, and release reserved kTPM capacity from the CLI. Existing MU/LORA deployment behavior is preserved.

New capacity deployment subcommands

Command Purpose
deploy capacity list List reserved capacity instances for a deployment
deploy capacity get Show details of a single capacity instance
deploy capacity create Provision a new reserved capacity instance (kTPM, optional prepaid config)
deploy capacity scale Change an instance's reserved kTPM
deploy capacity renew Renew a prepaid capacity instance
deploy capacity delete Release a reserved capacity instance
deploy capacity unsubscribe Emit the Alibaba Cloud billing-center refund link for a prepaid instance (link only, no API call)
deploy overflow Update a deployment's overflow strategy (reserved to pay-as-you-go spillover)
deploy operation get Fetch a capacity operation's status
deploy operation wait Poll a capacity operation until it terminates

High-risk write operations carry bilingual risk prompts and require --yes; writes generate a one-time requestId for idempotency and server-side tracing.

Key type extensions (packages/core/src/deploy)

  • New types in types.ts: ReservationCapacity, PrePaidInfo, CapacityInstance, CapacityOperation.
  • ScaleDeploymentRequest now covers both the legacy MU shape and the new PTU shape (absolute per-instance kTPM, optional prepaid config, order_type).
  • api.ts adds wrappers: listCapacityInstances, getCapacityInstance, getCapacityOperation, createCapacityInstance, scaleCapacityInstance, renewCapacityInstance, deleteCapacityInstance, updateDeploymentOverflow, with unified URL encoding helpers.
  • New reservation.ts centralizes reservation/prepaid flag structures.

Strategy refactor (plans.ts / reservation.ts)

  • ptuStrategy.validateFlags enforces PTU rules with bilingual errors: rejects legacy --capacity/--deploy-spec/--billing-method; validates --charge-type (pre_paid/post_paid, with ptu_default prepaid-only); requires prepaid params and kTPM to be grouped and safe integers.
  • muStrategy auto-selects a matching deploy template from listDeployableModels when not in --dry-run and no explicit --deploy-spec; dry-run / explicit spec skip the catalog call.
  • HTTP client (client/http.ts) centralizes request timeout + abort handling and preserves the caller's abort reason.

Tests

Unit tests:

  • packages/core/tests/deploy-api.test.ts
  • packages/core/tests/deploy-write-api.test.ts
  • packages/core/tests/http.test.ts
  • packages/commands/tests/deploy-capacity-write.test.ts
  • packages/commands/tests/deploy-legacy-write.test.ts
  • packages/commands/tests/deploy-query.test.ts
  • packages/commands/tests/deploy-wait-http.test.ts

E2E tests:

  • packages/commands/tests/e2e/deploy.e2e.test.ts

Docs/skill references (README.md, README.zh.md, skills/bailian-finetune/*) updated for the new PTU semantics.

- Add deploy capacity list/get/create/scale/renew/delete/unsubscribe,
  deploy overflow, and deploy operation get/wait commands
- Extend deploy API and types for reservation capacity (kTPM), prepaid
  info, capacity instances and operations
- Refactor plan strategies to support the PTU reservation model with
  bilingual flag validation; keep MU/LORA legacy behavior
- Centralize request timeout and abort handling in the HTTP client
- Add refundConsolePage URL helper for prepaid unsubscribe links
- Add unit/e2e coverage and update README and finetune skill references
@gujieye
gujieye force-pushed the feat/inference-train-command branch from e1b73a0 to 47c24de Compare September 22, 2026 06:55
@gujieye gujieye closed this Sep 22, 2026
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.

1 participant