cloud
Sets up assistant-ui Cloud persistence and authorization with the assistant-cloud package and AssistantCloud client. Use when adding cross-session thread/message persistence, multi-device chat history, file uploads, or auth to an assistant-ui app: passing the cloud option to useChatRuntime (with AssistantChatTransport from @assistant-ui/react-ai-sdk), configuring AssistantCloud with authToken (JWT), apiKey plus userId/workspaceId (server-side), or anonymous mode, and wiring auth providers like N
Security Assessment
Detected risks:
About cloud
A setup skill for assistant-ui Cloud persistence and authorization, using the `assistant-cloud` package and the `AssistantCloud` client. It applies when adding cross-session thread and message persistence, multi-device chat history, file uploads, or authentication to an assistant-ui application. The cloud instance is passed as the `cloud` option to `useChatRuntime` alongside `AssistantChatTransport` from `@assistant-ui/react-ai-sdk`, and wrapped with `AssistantRuntimeProvider`. For the thread-list sidebar UI itself, a separate thread-list skill is used. The doc directs consulting assistant-ui.com/llms.txt for the latest API.
`AssistantCloud` supports three authentication modes. The recommended JWT approach supplies an async `authToken` callback that returns the session access token. A server-side API-key approach uses `apiKey` together with `userId` and `workspaceId`. An anonymous mode (`anonymous: true`) suits public apps. All modes take a `baseUrl`, typically from the `NEXT_PUBLIC_ASSISTANT_BASE_URL` environment variable, with `ASSISTANT_API_KEY` reserved for server-side use. The skill references additional guides for persistence, authorization patterns, self-hosted custom persistence, and auth integrations including better-auth and Clerk.
The Cloud API exposes thread operations—`cloud.threads.list()`, `create()`, `update(threadId, ...)`, and `delete(threadId)`—plus message access via `cloud.threads.messages(threadId).list()`. File uploads use `cloud.files.generatePresignedUploadUrl({ filename })`, which returns a signed URL the client PUTs the file to, along with a public URL. The doc also notes common gotchas: threads that do not persist usually mean the `cloud` option was not passed to the runtime or authentication is misconfigured, and auth errors typically mean `authToken` is not returning a valid token or `baseUrl` is incorrect. Installation is via `npm install assistant-cloud`.
FAQ
How do I install and wire up Cloud persistence?
Run `npm install assistant-cloud`, create an `AssistantCloud` client with a `baseUrl` and auth, and pass it as the `cloud` option to `useChatRuntime` together with `AssistantChatTransport`, all under `AssistantRuntimeProvider`.
What authentication options are available?
Three: a JWT token via an async `authToken` callback (recommended), a server-side `apiKey` with `userId` and `workspaceId`, or anonymous mode (`anonymous: true`) for public apps.
How are file uploads handled?
Call `cloud.files.generatePresignedUploadUrl({ filename })`, which returns a signed URL and a public URL, then PUT the file to the signed URL via fetch.
Why are my threads not persisting?
Most often the `cloud` option was not passed to the runtime, or authentication is not configured correctly. The doc lists these as the primary gotchas to check.
Which environment variables does it use?
`NEXT_PUBLIC_ASSISTANT_BASE_URL` for the base URL and `ASSISTANT_API_KEY` for server-side API-key auth only.
Install cloud
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
assistant-ui/skills