Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Daydream

Scalekit connector
Open markdown

The Daydream connector lets your AI agent act in each user's Daydream account. Each user connects their own Daydream access token once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 12 tools.

Tools
12
What they doRead · write · destructive
7 · 4 · 17 read4 write1 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Daydream connection

    In AgentKit > Connections, create a Daydream connection. The name you give it is the connection_name your code passes. See Configure connections.

    Console steps with screenshots

    Register your Daydream API key with Scalekit so it can authenticate requests to the Daydream API on behalf of your users.

    1. Create a Daydream API key

      • Sign in to your Daydream account and open the API keys tab.

        Daydream account API keys tab with the Create key button

      • Click Create an API key, enter a Name such as Scalekit, and click Create key.

        Create an API key dialog with the Name field

      • Copy the key from the Your new key dialog.

        Your new key dialog showing the key once

    2. Create a connection in Scalekit

      • In the Scalekit dashboard, go to AgentKit > Connections > Create Connection.
      • Search for Daydream and click Create.
      • Note the Connection name. Use it as connection_name in your code (for example, daydream).
    3. Add a connected account

      • Open the connection, click Connected Accounts > Add account.
      • Enter Your User’s ID and the API Key, then click Save.

      To add the account from your backend:

      await scalekit.actions.upsertConnectedAccount({
      connectionName: 'daydream',
      identifier: 'user_123',
      credentials: { token: 'YOUR_DAYDREAM_KEY' },
      });
  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'daydream'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Daydream:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'daydream_get_usage',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their Daydream credentials there. If your app already has a user's credentials, add the account from your backend instead, as the console steps above show. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • daydream_get_songGet one song: its status (queued, rendering, done or failed), its place in line while queued, its settings, and when done its versions in takes.Read-only

    Get Song

    Get one song: its status (queued, rendering, done or failed), its place in line while queued, its settings, and when done its versions in takes. Each take has an MP3 link, a WAV link and, for songs with stems, five FLAC stems (drums, bass, guitar, keys, other) once stems_ready is true; stems appear a few seconds after the song is done, so poll again if they are missing. A sound effect (kind sfx) has an MP3 and a WAV per version and no stems. The file links need no authorization. Use it to poll a song made with daydream_create_song, every 2 seconds, until status is done or failed. Fails with 404 when the id is not a song on this account.

    Inputs

    idstringrequired
    The song's id, returned by daydream_create_song or daydream_list_songs. Example: sng_4hT2kq9XbV1nLm0pQe3rZa
  • daydream_get_song_mp3Check that one version's MP3 (192 kbps, stereo, 48 kHz) exists, with GET /v1/songs/{id}/{n}.mp3.Read-only

    Get Song MP3

    Check that one version's MP3 (192 kbps, stereo, 48 kHz) exists, with GET /v1/songs/{id}/{n}.mp3. The song must be done. On success Daydream answers with a redirect to the file and this tool returns an empty result, so it confirms that the file exists; it does not return the file or its link. Fails with 404 when there is no such file. To download the file, use takes[n].mp3_url from daydream_get_song.

    Inputs

    idstringrequired
    The song's id, returned by daydream_create_song or daydream_list_songs. Example: sng_4hT2kq9XbV1nLm0pQe3rZa
    nintegerrequired
    Which version of the song: 1 or 2 (2 exists only when the song was made with variations: 2). Example: 1one of 12
  • daydream_get_song_partCheck that one segment of a version's mix exists as an MP3, with GET /v1/songs/{id}/{n}.part{k}.mp3, to play a song as it comes while it is still rendering.Read-only

    Get Song Part

    Check that one segment of a version's mix exists as an MP3, with GET /v1/songs/{id}/{n}.part{k}.mp3, to play a song as it comes while it is still rendering. The segments that are up are listed in the song's parts (each with n, k, count, seconds, ready and mp3_url); parts is empty once the song is done, and the files to keep are then in takes. On success Daydream answers with a redirect to the file and this tool returns an empty result, so it confirms that the file exists; it does not return the file or its link. Fails with 404 when there is no such segment. To download the file, use parts[].mp3_url from daydream_get_song.

    Inputs

    idstringrequired
    The song's id, returned by daydream_create_song or daydream_list_songs. Example: sng_4hT2kq9XbV1nLm0pQe3rZa
    kintegerrequired
    The segment, counting from 1. The song's parts says how many segments the version has (count) and which are ready. Example: 1
    nintegerrequired
    Which version of the song: 1 or 2 (2 exists only when the song was made with variations: 2). Example: 1one of 12
  • daydream_get_song_wavCheck that one version's WAV (16-bit, stereo, 48 kHz) exists, with GET /v1/songs/{id}/{n}.wav.Read-only

    Get Song WAV

    Check that one version's WAV (16-bit, stereo, 48 kHz) exists, with GET /v1/songs/{id}/{n}.wav. The song must be done. On success Daydream answers with a redirect to the file and this tool returns an empty result, so it confirms that the file exists; it does not return the file or its link. Fails with 404 when there is no such file. To download the file, use takes[n].wav_url from daydream_get_song.

    Inputs

    idstringrequired
    The song's id, returned by daydream_create_song or daydream_list_songs. Example: sng_4hT2kq9XbV1nLm0pQe3rZa
    nintegerrequired
    Which version of the song: 1 or 2 (2 exists only when the song was made with variations: 2). Example: 1one of 12
  • daydream_get_stem_flacCheck that one stem of one version (FLAC, lossless, 16-bit, stereo, 48 kHz) exists, with GET /v1/songs/{id}/{n}/{stem}.flac.Read-only

    Get Stem FLAC

    Check that one stem of one version (FLAC, lossless, 16-bit, stereo, 48 kHz) exists, with GET /v1/songs/{id}/{n}/{stem}.flac. Stems are drums, bass, guitar, keys and other, and they add up to the mix. The song must be done and its stems_ready true. On success Daydream answers with a redirect to the file and this tool returns an empty result, so it confirms that the file exists; it does not return the file or its link. Fails with 404 when there is no such file or the version has no stems. To download the file, use takes[n].stems.<stem> from daydream_get_song.

    Inputs

    idstringrequired
    The song's id, returned by daydream_create_song or daydream_list_songs. Example: sng_4hT2kq9XbV1nLm0pQe3rZa
    nintegerrequired
    Which version of the song: 1 or 2 (2 exists only when the song was made with variations: 2). Example: 1one of 12
    stemstringrequired
    Which stem: drums, bass, guitar, keys or other. Example: drumsone of drumsbassguitarkeysother
  • daydream_get_usageGet how many songs the account has used and has left this month: the plan, the monthly limit (null when unlimited), songs used, and when the count resets.Read-only

    Get Usage

    Get how many songs the account has used and has left this month: the plan, the monthly limit (null when unlimited), songs used, and when the count resets. Songs made through the API are paid with credits, 5 per song.

    Inputs

    This tool takes no inputs.

  • daydream_list_songsList the account's songs, newest first, with the same fields as daydream_get_song.Read-only

    List Songs

    List the account's songs, newest first, with the same fields as daydream_get_song. Returns songs and next_cursor; pass next_cursor as cursor to get the next page, and stop when next_cursor is null.

    Inputs

    cursorstring
    The next_cursor value from the previous page. Leave out for the first page.
    limitinteger
    Songs per page, 1 to 100. Default 20. Example: 20
  • daydream_buy_packStart a purchase of a pack of 10 songs for 0.50 USD (POST /v1/packs).Write

    Buy Pack

    Start a purchase of a pack of 10 songs for 0.50 USD (POST /v1/packs). Daydream answers HTTP 402 payment_required with a payment challenge (WWW-Authenticate for MPP, PAYMENT-REQUIRED for x402; USDC on Tempo or Base, or a card through Link's agent wallet); the purchase completes only when the same request is sent again with that payment, and the answer is an access_token that makes 10 songs when sent as the Bearer key on POST /v1/songs. This tool sends the request without a payment, so it returns the 402 challenge and does not charge anything. To buy credits for the connected account, use the credit packs at https://labs.daydream.live/account/#credits instead.

    Inputs

    This tool takes no inputs.