Manage product users
Look up and update your customers, then read their usage, credits, and allowance.
Product Users are your customers. You can create or update them automatically inline during inference or manage them explicitly using your Organization Service Key (zrv_svc_...).
Look up a product user
Read a product user's live profile, configured spending cap, available credits, and monthly token usage without accidental creations or mutations.
import { ZorveusServiceClient } from "@zorveus/sdk";
const service = new ZorveusServiceClient({
apiKey: "zrv_svc_your_service_key",
});
// Fetch full user profile, active cap, credits, and monthly usage
const user = await service.productUsers.getByExternalId({
appId: "app_support_123",
externalUserId: "usr_sara_101",
});
console.log("Display name:", user.display_name);
console.log("Available allowance:", user.getTotalAvailableToSpend());Check whether a user has money to spend
For an active user under a known enforced cap, use user.has_available_allowance() in Python or user.hasAvailableAllowance() in TypeScript. Both check whether total available allowance is greater than zero without another API call.
To get the amount as well, use user.get_total_available_to_spend_decimal() in Python or user.getTotalAvailableToSpend() in TypeScript. See the amount check and SDK shortcuts for examples and the uncapped-key rules.
Read credits separately
The credit summary contains credit grants only. It does not include remaining base allowance. To decide whether a capped user can attempt inference, follow Check available allowance.
import { ZorveusServiceClient } from "@zorveus/sdk";
const service = new ZorveusServiceClient({
apiKey: "zrv_svc_your_service_key",
});
const creditSummary = await service.productUsers.getCreditSummaryByExternalId({
appId: "app_support_123",
externalUserId: "usr_sara_101",
});
console.log("Available Credits:", creditSummary.available_credits);Update a product user
To update user profile details outside of inference requests:
import { ZorveusServiceClient } from "@zorveus/sdk";
const service = new ZorveusServiceClient({
apiKey: "zrv_svc_your_service_key",
});
const user = await service.productUsers.createOrUpdate({
appId: "app_support_123",
externalUserId: "usr_sara_101",
displayName: "Sara Connor",
email: "sara@example.com",
});