# AI app generation Source: https://docs.daydream.live/api/ai-oneshot Learn how to use AI tools to one-shot a StreamDiffusion-powered app ## Overview This guide shows how to “one shot” an app using an AI coding assistant. You’ll copy a single set of instructions, open your preferred AI tool, and let it scaffold and wire everything up. You’ll paste a single, comprehensive prompt. We’ve included quick‑launch links that prefill the prompt for tools that support it. ## Prerequisites * **AI tool account**: Claude, ChatGPT, Gemini, or another assistant. * **Local dev environment**: Git, Node.js, and your editor of choice. * **Daydream API key**: See [Authentication](/api/authentication) if your app will call the Daydream API. ## Steps Select from an example to get started. Copy the prompt below. Replace the placeholder for the API key. Use the quick‑launch buttons below to open a new chat with the prompt prefilled (where supported) or paste it manually. Ask the assistant to execute the steps, generate files, run installs, and fix any issues. Approve tool actions if your assistant supports them. ## Select From the Examples Below Webcam Livestream with StreamDiffusion DrawCanvas FluidCanvas Audio-Reactive # Create a New Stream Source: https://docs.daydream.live/api/api-reference/create-stream POST /v1/streams Creates a new video processing stream with the specified configuration This endpoint creates a new video processing stream using the Daydream StreamDiffusion pipeline. You'll specify the pipeline type and model configuration in the request body. ## Request Body Structure ```json theme={null} { "pipeline": "streamdiffusion", "params": { "model_id": "stabilityai/sdxl-turbo", // ... additional parameters } } ``` * **`pipeline`**: The processing pipeline to use. Currently `"streamdiffusion"` is the only public option. * **`params`**: Configuration object containing the model and generation parameters. * **`params.model_id`**: The specific model to use (see table below). ## Available Models | model\_id | Family | ControlNets | IP Adapter | Cached Attention | | --------------------------- | ------ | ----------- | ---------- | ---------------- | | `stabilityai/sd-turbo` | SD2.1 | 6 types | No | No | | `stabilityai/sdxl-turbo` | SDXL | 3 types | Yes | Yes | | `Lykon/dreamshaper-8` | SD1.5 | 4 types | Yes | Yes | | `prompthero/openjourney-v4` | SD1.5 | 4 types | Yes | Yes | **Which model should I use?** * **SD2.1 (`sd-turbo`)**: Fastest, good for real-time effects * **SDXL (`sdxl-turbo`)**: Highest quality, supports IP Adapter for style transfer * **SD1.5 (`dreamshaper-8`, `openjourney-v4`)**: Great for stylized/cartoon effects, supports IP Adapter and Cached Attention ## Example: Create an SDXL Turbo Stream ```bash theme={null} curl -X POST \ "https://api.daydream.live/v1/streams" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${DAYDREAM_API_KEY}" \ -d '{ "pipeline": "streamdiffusion", "params": { "model_id": "stabilityai/sdxl-turbo", "prompt": "anime character" } }' ``` ## Example: Create a Stream with ControlNet ```bash theme={null} curl -X POST \ "https://api.daydream.live/v1/streams" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${DAYDREAM_API_KEY}" \ -d '{ "pipeline": "streamdiffusion", "params": { "model_id": "stabilityai/sdxl-turbo", "prompt": "oil painting portrait", "controlnets": [ { "model_id": "xinsir/controlnet-depth-sdxl-1.0", "preprocessor": "depth_tensorrt", "conditioning_scale": 0.5, "enabled": true } ] } }' ``` For full parameter documentation, see the [Parameters](/api/parameters/SD15) section. ## Legacy Support The `pipeline_id` field (e.g., `"pip_SD15"`) is deprecated but still supported for backward compatibility. New integrations should use `pipeline` + `params.model_id` instead. # Stream Status Source: https://docs.daydream.live/api/api-reference/stream-status GET /v1/streams/{id}/status Check the status of your stream The stream status uses the following url, make sure to include your stream Id. # Update a Stream Source: https://docs.daydream.live/api/api-reference/update-stream PATCH /v1/streams/{id} Updates pipeline parameters for an existing video processing stream Rate limit: 300 requests per minute. This endpoint allows you to update pipeline parameters for an existing stream. You can modify prompts, ControlNet settings, IP Adapter configuration, and other generation parameters. ## Request Body Structure ```json theme={null} { "pipeline": "streamdiffusion", "params": { "model_id": "Lykon/dreamshaper-8", "prompt": "new prompt", // ... only include parameters you want to change } } ``` The `pipeline` field defaults to `"streamdiffusion"` if omitted, so you can just send `params` for most updates. ## Hot-Swap vs Reload Parameters The following parameters can be updated dynamically (no reload required): * `prompt`, `negative_prompt` * `guidance_scale`, `delta` * `num_inference_steps`, `t_index_list` * `seed` * `controlnets.conditioning_scale` * `ip_adapter` settings * `ip_adapter_style_image_url` All other parameters trigger a full pipeline reload (\~30s). ## Example: Update Prompt ```bash theme={null} curl -X PATCH \ "https://api.daydream.live/v1/streams/${STREAM_ID}" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${DAYDREAM_API_KEY}" \ -d '{ "params": { "model_id": "Lykon/dreamshaper-8", "prompt": "cyberpunk cityscape, neon lights" } }' ``` ## Example: Adjust ControlNet Strength ```bash theme={null} curl -X PATCH \ "https://api.daydream.live/v1/streams/${STREAM_ID}" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${DAYDREAM_API_KEY}" \ -d '{ "params": { "model_id": "Lykon/dreamshaper-8", "controlnets": [ { "model_id": "lllyasviel/control_v11f1p_sd15_depth", "preprocessor": "depth_tensorrt", "conditioning_scale": 0.7, "enabled": true } ] } }' ``` For full parameter documentation, see the [Parameters](/api/parameters/SD15) section. # API Keys Source: https://docs.daydream.live/api/api_keys Guide on generating API To use the Daydream API, you need to provide an API key. Follow the steps below on how to generate one. ## Steps Go to Daydream Playground and log in with your credentials. If you do not have an account, sign up for one and sign in. Click on the button on the top left corner that say ` API Dashboard`. API Dashboard Button Click on the `+ New API Key` button on the top right corner of the page Create API Button When the `+ New API Key` button is select, you will be prompted to name the API key. Provide the name for the api key and select the `Generate Key` button. Name API Key Window Copy the api key and select the `Done` button Copy this key now. You will NOT be able to see this API key again. Name API Key Window Once you created the API key, you should see it added to the API Key's dashboard. API Key Dashboard # Authentication Source: https://docs.daydream.live/api/authentication Authenticating with the Daydream API The API uses Bearer token authentication. Include your API key in the Authorization header: ``` Authorization: Bearer YOUR_API_KEY ``` # Code Examples Source: https://docs.daydream.live/api/code-examples Ideas for using the Daydream API and SDKs Here are some examples to inspire building your own applications. ## SDKs Get started quickly with our official SDKs: Server-side stream management with `@daydreamlive/sdk` WebRTC broadcasting and playback with `@daydreamlive/browser` Visual programming and VJ applications Add AI effects to your OBS streams ## Browser SDK Examples The Browser SDK includes working examples you can try immediately: | Example | Description | Demo | | ---------------------------------------------------------------------------------------------------------- | ------------------ | -------------------------------------------------------------------- | | [with-react](https://github.com/daydreamlive/daydream-browser/tree/main/examples/with-react) | Basic React hooks | [Live Demo](https://daydream-browser-kohl.preview.livepeer.monster) | | [with-compositor](https://github.com/daydreamlive/daydream-browser/tree/main/examples/with-compositor) | Canvas composition | [Live Demo](https://daydream-browser-zeta.preview.livepeer.monster) | | [with-screen-share](https://github.com/daydreamlive/daydream-browser/tree/main/examples/with-screen-share) | Screen capture | [Live Demo](https://with-screen-share-lime.preview.livepeer.monster) | | [with-three](https://github.com/daydreamlive/daydream-browser/tree/main/examples/with-three) | Three.js streaming | [Live Demo](https://with-three-git-main.preview.livepeer.monster) | | [with-vanilla](https://github.com/daydreamlive/daydream-browser/tree/main/examples/with-vanilla) | Pure JS (no React) | — | ## Community Examples