Skip to main content

Customers page

The Customers page lists the end users your application identifies by sending the user field on requests. You can give each customer a budget, a required model region, a default model and a model allowlist, or block a customer so its requests are rejected. Open it at /ui/customers, under ACCESS CONTROL in the left nav. The nav item is shown to the Admin and Admin Viewer roles only (proxyAdminTierRoles). The page checks the role again, so anyone else who opens the URL sees the notice "Customers is only available to admin users." No license feature is needed.

A customer appears on this page when you create it here or when a request first sends its ID in the user field.

On a Spanway Cloud gateway (cloud.enabled) each tenant's customers are kept apart. A user value sent by a tenant's key is stored as <organization_id>/<user>, so two tenants that both send alice never share a row, spend or budget. This page lists the stored IDs as they are, prefix included, because it is only open to proxy admins. See customers on Spanway Cloud.

A real-world scenario​

A SaaS company passes each of its own customers' account ids as the user field. One trial account starts sending far more traffic than its plan allows, so the admin gives that customer a 5 dollar budget on the Customers page, and blocks it when it keeps going.

Steps​

  1. Open Customers under Access Control, or go to /ui/customers, and click + Create Customer.

  2. Enter the customer id your app sends as user, an alias and a budget, and click Create Customer. The API call is in customers.

  3. Send a request as that customer and read the customer's spend.

    curl "http://localhost:4000/customer/info?end_user_id=acct-48213" -H "Authorization: Bearer $SPANWAY_API_KEY"
  4. To stop the customer, open the row's actions menu, choose block and confirm.

Expected result​

The customer's spend grows with each request, requests over the budget are refused with budget_exceeded, and a blocked customer's requests are rejected with customer_blocked.

Customers list​

The header shows the title Customers and the description "End users your application identifies with the user field. Set budgets, rate limits, regions and model limits per customer, or block one to reject its requests." followed by a Read the Customers guide link to customers.

ControlTypeWhat it does
Search boxText inputPlaceholder "Search by ID or alias". Filters the loaded list in the browser to customers whose ID or alias contains the text, ignoring case. The search is kept in the URL as customer_search.
+ Create CustomerButtonOpens the Create Customer dialog. Shown only to users who can manage customers (see the role section below).

The table loads every customer from /customer/list at once and pages and sorts in the browser. It shows 25 rows per page by default and is sorted by Customer ascending.

ColumnMeaning
CustomerThe customer ID in monospace, with the alias under it when one is set. Sortable.
StatusA badge, Active (green) or Blocked (red).
Spend / BudgetThe spend recorded for the customer against its max budget, if it has one. Sortable by spend.
RegionThe allowed model region in upper case, or Any when none is set.
Allowed ModelsThe models the customer may use, or All models when the list is empty.
ActionsA menu button (labelled "Open actions for" the customer ID for screen readers). Shown only to users who can manage customers.

The actions menu holds these items.

ItemWhat it does
EditOpens the Edit Customer dialog for that customer.
BlockShown when the customer is active. Opens the "Block customer?" confirmation.
UnblockShown when the customer is blocked. Opens the "Unblock customer?" confirmation.
DeleteOpens the "Delete customer?" confirmation.

Block, unblock and delete confirmations​

Each action asks for confirmation in a dialog that shows the customer ID. Cancel closes the dialog without changes. When the action succeeds, a toast reads "Customer <id> blocked", "unblocked" or "deleted". When it fails, the dialog stays open and shows the error under a title such as "Could not block the customer".

DialogMessageConfirm button
Block customer?"Requests that send this customer ID in the user field are rejected until you unblock it."Block (destructive style, shows "Blocking..." while working)
Unblock customer?"Requests that send this customer ID in the user field are accepted again."Unblock (shows "Unblocking..." while working)
Delete customer?"The customer is removed. Its spend logs and any linked budget stay. This cannot be undone."Delete (destructive style, shows "Deleting..." while working)

Deleting removes the customer record only. Spend logs and any budget linked to the customer are kept, and the delete cannot be undone.

Create Customer dialog​

The dialog title is Create Customer with the description "Customers are the end users your application passes in the user field. Budgets, rate limits, regions and model limits apply to every request made on their behalf." Every control carries the help text quoted below.

FieldTypeWhat it does
Customer IDText, required"The value your application sends as the user field on each request." Leading and trailing spaces are trimmed. Empty shows "Please enter a customer ID".
AliasTextA human friendly name, shown under the ID in the table. Left out when blank.
BudgetDropdownBudget set on this customer (default) gives the customer its own budget from the fields below. Picking a budget from the Budgets page shares that budget and hides the fields below, because the gateway accepts one or the other.
Max Budget (USD)Number as text"Blank means no cap. Once spend reaches this amount the customer's requests are refused until the budget resets, while the key keeps working for everyone else." Must be blank or a number of zero or more.
Budget ResetDropdownNever resets (default), Daily, Weekly or Monthly. "How often spend goes back to zero. Never keeps the cap as a lifetime total." Sent only when Max Budget (USD) has a value.
First Reset AtDate and time"Leave empty to reset one period after the budget is created."
Requests per Minute, Tokens per MinuteNumberBlank means no limit. Extra requests get a 429 and can retry. The limits count every key that sends this customer id.
Tokens per Day (batch)Number"Batch submissions count against this instead of the per minute limits."
Max Parallel RequestsNumberBlank means no limit. Requests beyond this many at once get a 429.
Per-Model BudgetsEditorOptional caps on one model over its own window, on top of the overall budget. Needs a license.
Allowed Model RegionDropdownAny region (default), EU, United Kingdom, Switzerland, US, Canada or Asia Pacific. "Keeps this customer's requests on deployments in one region, for data residency."
Default ModelText"Stored with the customer for your reference. Routing does not use it, so it does not change which model serves a request." It must name a model on the gateway. Left out when blank.
Allowed ModelsText"Comma separated. Leave empty to allow every model." Spaces around names are trimmed and duplicates removed.
MCP Servers / Access GroupsPicker"Restricts the MCP servers this customer's requests may use. Leave empty for no restriction."
Vector StoresPicker"Restricts the vector stores this customer's requests may search. Leave empty for no restriction."

Create Customer submits the form and Cancel closes it. Both buttons are disabled while the request runs. A new customer is always created unblocked. On success the toast reads "Customer <id> created". On failure the dialog shows "Could not create the customer" with the error from the server.

Edit Customer dialog​

The title is Edit Customer: followed by the customer ID. The dialog first loads the customer from /customer/info and shows a spinner, or "Could not load the customer" with the error if the load fails. It shows Customer ID, Alias, Budget, Allowed Model Region, Default Model, Allowed Models, MCP Servers / Access Groups and Vector Stores, with these differences.

FieldDifference when editing
Customer IDShown but disabled. The ID cannot be changed.
BudgetOpens on the budget the customer is linked to, and its help says "Linked to budget <id>." Saving keeps that link and never changes the budget. Pick another budget to move the customer onto it. Change the amount, rate limits and reset schedule of a linked budget on the Budgets page, where the change applies to every customer that uses it.
Max Budget (USD)Shown only when Budget is switched to Budget set on this customer. Cannot be 0 ("Max budget must be more than zero. Block the customer to stop its requests"), and a budget that is already set cannot be cleared, only changed.
Budget Reset, First Reset At, rate limits and Per-Model BudgetsNot shown. Edit them on the Budgets page.
Allowed Model RegionOnce a region is set, Any region is no longer offered, so you can switch regions but not remove the requirement.
Alias and Default ModelClearing a value that was set saves it as empty.
Allowed ModelsAlways saved. Emptying the field clears the allowlist, which allows every model.

Saving keeps the customer's blocked status unchanged. Save Customer submits and the toast reads "Customer <id> updated". On failure the dialog shows "Could not save the customer" with the server error.

Empty, error and disabled states​

When there are no customers, the table shows "No customers yet" with "Customers appear once you create one or a request sends a user field." While the list loads, it shows "Loading customers…". If /customer/list fails, the table is replaced by an error box titled "Could not load customers" with the server message. Check that the gateway is connected to its database, since the customer endpoints return an error without one.

A search that matches nothing shows the same empty message, so clear the search box if the list looks empty. Form buttons are disabled while a save is in flight.

Differences by role and license​

RoleWhat they get
Admin (proxy_admin)The full page with + Create Customer and the actions menu on every row.
Admin Viewer (proxy_admin_viewer)The list and search only. + Create Customer and the row actions are hidden because the session is view only. The backend also blocks write requests from this role, since it only lets an Admin Viewer make non read requests to an explicit allowlist that the customer write routes are not on.
Org Admin, Internal User, Internal Viewer and other rolesNo nav item. Opening the URL shows "Customers is only available to admin users." The backend also answers /customer/list with "Admin-only endpoint" for anyone other than an Admin or Admin Viewer, and rejects the customer write routes for non admin roles unless a custom role allows them.

The page does not need a license feature.

Errors​

What you seeWhat it meansFix
No + Create Customer buttonYour role may not manage customers.Ask a proxy admin.
budget_exceeded for the customerThe customer spent its budget.Raise it in Edit Customer.
customer_model_access_deniedThe customer's model allowlist does not include the model.Add the model.
customer_blockedThe customer is blocked.Use Unblock in the row menu.
A customer created with the wrong idCustomer ids must match the user value your app sends.Create it again with the exact value.

See Customers and end users for how customer budgets, regions and blocking work on requests, Cost tracking for how customer spend is recorded, and Access control for roles.