Palbase ai · API
/ai/usageWhat the project's use of models cost
Every use, newest first: a response's tokens, the web searches its turn ran, a chat's voice, an embeddings call, a picture job, a video, speech to text and back, a machine's minutes — with its cost at the provider's list price and whose connection paid. A use under the project's own key is billed by the provider, not by Palbase.
Called by your server, with the project's secret key.
Query
limitinteger · optionalAt most this many (1–500, default 50).cursorstring · optionalThe next_cursor of the previous page.kindstring · optionalOnly uses of this kind.metadatastring · optionalLabels each use listed carries, as a JSON object ({"product":"p1"}): a product's spend, a task's. A turn's use carries its labels and, for a chat's turn, its chat's labels and the chat, frozen as the turn ends; so do the web searches the turn ran. A chat's voice carries its chat's labels and the chat, frozen as it starts. A machine's minutes are its workspace's, which serves many turns, and carry none.curl -X GET "https://<your-ref>.palbase.studio/ai/usage" \
-H "apikey: $PALBASE_SECRET_KEY"Responses
200A page of uses
400The request is malformed, or names what this module does not offer (the error names which)
401No valid credential
403A publishable key or a user's session: everything here is the project's server's, called with the secret key
429The project's request rate, or the provider's for its connection, is used up — or the project holds as much as it may at once: 32 open streams at one of the module's servers (too_many_streams), 2 pictures being made (too_many_images), 512 MiB of pictures kept here for their day (image_storage_full), or the service — or the project's share of it — holds as much of its requests at once as it takes: their bodies, an embedding request's vectors, the pictures being made (busy). Retry-After says when to try again
503The model service or the database did not answer; retry shortly
defaultAn error: the envelope names it (`error`) and explains it (`error_description`).
Operation ListUsage of ai's contract.