Palbase ai · API
/ai/chatsStart a chat
The project's server's alone: its backend, with the secret key, starts a chat with a named agent or a definition of its own, and names its members. A signed-in user is answered 403 server_only, whatever the project lets them (settings.clients is what they do in the chats they are in).
Called by a signed-in user of your app, with their token and the publishable key; or your server, with the project's secret key.
Request body
agentstring · requiredThe agent it talks to: one of the project's by name — its backend's, or one it keeps, whose published version each turn takes, or name@N to stay on version N — or, with a definition of the chat's own, the server's name for it.definitionobject · optionalWhat an agent is: its instructions, model, tools and subagents, its own variables and setup script, and the shape of its one-shot answers.membersobject[] · optionalWho is in it (the server's to say; 64 at most).metadataobject · optionalThe caller's own labels (16 at most, snake_case keys).poolstring · optionalThe project's runner pool its workspace runs on (GET /ai/pools), by its id or its name; one the project has not: 400. None: the platform's own Linux machines. A chat that names one works in a workspace.titlestring · optionalIts title (256 bytes at most).workspace_idstring · optionalStandalone workspaces module id (ws_<24hex>).targetobject · optionalauto_failoverobject · optionalliveboolean · optionalAttach a Realtime pipe automatically at creation (defaults to settings.auto_pipe_chats).curl -X POST "https://<your-ref>.palbase.studio/ai/chats" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"agent":"string"}'Responses
201The chat
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
defaultAn error: the envelope names it (`error`) and explains it (`error_description`).
Operation CreateChat of ai's contract.