Skip to main content

BYOK limits and usage integration overview

Connect your enterprise quota and usage system to QwenWork so administrators can manage member limits and view consumption statistics in the console.

Connect your enterprise quota and usage system to QwenWork so administrators can manage member limits and view consumption statistics in the console. This guide applies to K8S versions offering the BYOK limits and usage extension, using protocol /spi/v1. The installed version must support all eight endpoints. Access to this documentation does not mean the installation has enabled the capability.

Start here

GoalRead
First integration: confirm URLs, credentials and user identitiesQuick start
Provide organization, member and daily consumption dataUsage APIs
Receive member limits and return real-time organization quotaQuota APIs
Verify integration results or diagnose failuresValidation and troubleshooting

Call direction

Implement the HTTP endpoints on the right. QwenWork sends requests; the enterprise service validates the token and organization, performs the operation and returns the agreed JSON. The browser does not call the enterprise SPI directly.
IntegrationDirectionCredentials and purpose
OpenAPIEnterprise application → QwenWorkOpen Platform application API key; invokes QwenWork capabilities
Business SPI in this guideQwenWork → Enterprise serviceDedicated SPI token; reads statistics and reads or sets limits
Model BYOKQwenWork → Model providerEndpoint and optional API key from model configuration; executes model requests
Models remain separately configured in model management. The business SPI does not proxy model requests or provide metering and quota enforcement for enterprise models. Once customer quotas are enabled, model requests require a valid external user identity. The enterprise model service must associate consumption with the same identity.

Required endpoints

All eight endpoints share one service URL, token and enable switch. The console cannot enable statistics and quotas separately. The Call timing column describes current host behavior; a successful connectivity check alone does not prove that every endpoint is implemented.
EndpointMethod and pathResponsibilityCall timing
Get latest statistics dateGET /spi/v1/usage/metaLatest complete data dateStatistics refresh and manual connectivity check
Query organization usage overviewGET /spi/v1/usage/overviewHistorical organization usageBuild snapshots by date and five periods
Query member usage listGET /spi/v1/usage/membersHistorical member usageBuild snapshots by reading every page
Query member daily usage trendGET /spi/v1/usage/members/{external_user_id}/trendDaily member trendsRead on demand when viewing a member's trend
Query quota rules and periodGET /spi/v1/quota/contextQuota constraints and current periodValidate quotas and determine period boundaries
Query member quotasPOST /spi/v1/quota/users/queryApplied member quotasExplicit SDK queries; the product does not currently require read-after-write
Set member limitPUT /spi/v1/quota/usersSet one member's absolute limitBackground dispatch and retries of quota changes
Query organization quotaGET /spi/v1/quota/orgReal-time organization total quota and usageOrganization quota queries

Agree on three values before integration

ValueMeaningSynthetic example in this guide
Organization IDQwenWork organization UUID mapped to an enterprise ledger tenant11111111-1111-4111-8111-111111111111
External user IDEnterprise user identifier currently bound in IAM; preserve case and leading zerosemployee-1001
Metering unitStatistics use credit numbers; quotas use minor-unit integer strings500 credit = "5000000" minor
The domains, identities and data in examples are illustrative. Use a test organization, bound test users and dedicated test credentials for integration testing. Next: Prepare the connection and send the first request.