Palbase ai · API
/ai/machine-keysMint an enrolment key for a person's own machine
A key that enrols one machine as its owner's, said once. A signed-in user mints one for a machine of their own, with no secret key on the device, when the project's setting user_machines is on (403 user_machines_disabled otherwise; settings.clients is not asked); the project's server mints one for the user it names (owner, a user's id), whatever the setting says; a user whose account was deleted is not one (404 for the server, 403 user_deleted for a token of theirs that still stands). The key waits fifteen minutes for its machine: unused by then it enrols nothing. A user who already holds user_machine_limit machines, a key still waiting counted as one, is refused: 409 machine_limit_reached. Only the machine's owner and the project's server name it as a chat's target, read its state and its harnesses, cordon it and delete it; it takes no work but the chats that name it.
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
os"macos" | "linux" · requiredThe machine's operating system.arch"arm64" | "amd64" · requiredThe machine's processor architecture.ownerstring · optionalThe user the machine will belong to. The project's server names one; a signed-in user's key is their own, and naming anyone else is refused.labelstring · optionalWhat the key is for, as a pool key's label: 128 bytes of UTF-8 at most, shown as it was written.curl -X POST "https://<your-ref>.palbase.studio/ai/machine-keys" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"os":"macos","arch":"arm64"}'Responses
201The key, said once
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
404No such response, job or provider in this project
409The response's state refuses it
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 CreateMachineKey of ai's contract.