> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neynar.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt a deployment with streaming response

> Sends a prompt to a specific miniapp generator deployment and returns a streaming response using Server-Sent Events. The response is a continuous stream of Server-Sent Events, not a single JSON payload. Each event contains a JSON object with type, message, and other fields specific to the message type. Requires authentication via API key in the request header. Note: Studio CU is tracked based on LLM token usage, not per API call.

<Info>
  The Miniapp Studio API is an allowlisted API and not publicly available. [Contact the Neynar team](https://neynar.com/slack) for more information.
</Info>

## Streaming Response Types

This endpoint uses Server-Sent Events (SSE) for streaming responses, which is why the OpenAPI specification only shows an empty 200 response. The actual streaming response returns the following message types (all exported by `@anthropic-ai/claude-code` except `ErrorMessage`):

* **SDKAssistantMessage**: Claude's responses with type `'assistant'`
* **SDKUserMessage**: User prompts with type `'user'`
* **SDKResultMessage**: Final results with type `'result'` and subtypes:
  * `'success'`
  * `'error_max_turns'`
  * `'error_during_execution'`
* **SDKSystemMessage**: System messages with type `'system'` and subtype `'init'`
* **ErrorMessage**: Custom error type with:
  * type: `'error'`
  * message
  * timestamp

## Node.js SDK

🔗 **SDK Method:** [promptDeploymentStream](/nodejs-sdk/studio-apis/promptDeploymentStream)

Use this API endpoint with the Neynar Node.js SDK for typed responses and better developer experience.


## OpenAPI

````yaml post /v2/studio/deployment/prompt/stream
openapi: 3.0.4
info:
  contact:
    email: team@neynar.com
    name: Neynar
    url: https://neynar.com/
  description: >-
    The Neynar API allows you to interact with the Farcaster protocol among
    other things. See the [Neynar docs](https://docs.neynar.com/reference) for
    more details.
  title: Neynar API
  version: 3.174.0
servers:
  - url: https://api.neynar.com
security:
  - ApiKeyAuth: []
tags:
  - description: Operations related to user
    externalDocs:
      description: More info about user
      url: https://docs.neynar.com/reference/user-operations
    name: User
  - description: Operations related to signer
    externalDocs:
      description: More info about signer
      url: https://docs.neynar.com/reference/signer-operations
    name: Signer
  - description: Operations related to cast
    externalDocs:
      description: More info about cast
      url: https://docs.neynar.com/reference/cast-operations
    name: Cast
  - description: Operations related to feed
    externalDocs:
      description: More info about feed
      url: https://docs.neynar.com/reference/feed-operations
    name: Feed
  - description: Operations related to reaction
    externalDocs:
      description: More info about reaction
      url: https://docs.neynar.com/reference/reaction-operations
    name: Reaction
  - description: Operations related to notifications
    externalDocs:
      description: More info about notifications
      url: https://docs.neynar.com/reference/notifications-operations
    name: Notifications
  - description: Operations related to channels
    externalDocs:
      description: More info about channels
      url: https://docs.neynar.com/reference/channel-operations
    name: Channel
  - description: Operations related to follows
    externalDocs:
      description: More info about follows
      url: https://docs.neynar.com/reference/follows-operations
    name: Follows
  - description: Operations related to storage
    externalDocs:
      description: More info about storage
      url: https://docs.neynar.com/reference/storage-operations
    name: Storage
  - description: Operations related to mini apps
    name: Frame
  - description: Operations for building AI agents
    name: Agents
  - description: Operations related to fname
    name: fname
  - description: Operations related to a webhook
    name: Webhook
  - description: >-
      Securely communicate and perform actions on behalf of users across
      different apps
    externalDocs:
      description: More info about farcaster actions
      url: https://docs.neynar.com/docs/farcaster-actions-spec
    name: Action
  - description: Operations related to a subscriptions
    name: Subscribers
  - description: Operations related to a mute
    name: Mute
  - description: Operations related to a block
    name: Block
  - description: Operations related to a ban
    name: Ban
  - description: Operations related to onchain data
    name: Onchain
  - description: Operations related to login
    name: Login
  - description: Operations related to retrieving metrics
    name: Metrics
  - description: Operations related to mini app host notifications
    externalDocs:
      description: More info about mini app host notifications
      url: https://docs.neynar.com/docs/app-host-notifications
    name: App Host
paths:
  /v2/studio/deployment/prompt/stream:
    post:
      tags:
        - studio
      summary: Prompt a deployment with streaming response
      description: >-
        Sends a prompt to a specific miniapp generator deployment and returns a
        streaming response using Server-Sent Events. The response is a
        continuous stream of Server-Sent Events, not a single JSON payload. Each
        event contains a JSON object with type, message, and other fields
        specific to the message type. Requires authentication via API key in the
        request header. Note: Studio CU is tracked based on LLM token usage, not
        per API call.
      operationId: prompt-deployment-stream
      requestBody:
        content:
          application/json:
            schema:
              properties:
                conversation_id:
                  description: >-
                    Optional conversation ID to continue an existing chat. If
                    not provided, a new conversation will be created.
                  format: uuid
                  type: string
                deployment_id:
                  description: Deployment ID (UUID). Required if name not provided.
                  format: uuid
                  type: string
                fid:
                  description: >-
                    Farcaster ID of the user; if not provided, namespace must be
                    provided
                  example: 3
                  format: int32
                  minimum: 0
                  type: integer
                images:
                  description: >-
                    Optional images for multimodal messages. Each image is
                    base64-encoded.
                  items:
                    properties:
                      data:
                        description: >-
                          Base64-encoded image data or data URL
                          (data:image/png;base64,...)
                        type: string
                      mediaType:
                        description: MIME type of the image, e.g. image/png
                        enum:
                          - image/jpeg
                          - image/png
                          - image/gif
                          - image/webp
                        type: string
                    required:
                      - mediaType
                      - data
                    type: object
                  type: array
                name:
                  description: >-
                    Kubernetes deployment name. Required if deployment_id not
                    provided.
                  type: string
                namespace:
                  description: >-
                    Optional Kubernetes namespace. If not provided, will query
                    for the active namespace for the given FID.
                  type: string
                prompt:
                  description: Prompt string to send to the deployment
                  type: string
                session_id:
                  description: >-
                    Optional Claude SDK session ID to resume an existing Claude
                    Code session. Enables session-based conversation continuity.
                  type: string
                system_prompt_variant:
                  description: >-
                    System prompt variant to use. Defaults to stable if not
                    provided.
                  enum:
                    - canary
                    - beta
                    - stable
                  type: string
              required:
                - prompt
              type: object
        required: true
      responses:
        '200':
          description: Success
        '202':
          content:
            application/json:
              schema:
                properties:
                  conversation_id:
                    description: The conversation ID
                    format: uuid
                    type: string
                  queued:
                    description: Indicates the message was queued to the active session
                    enum:
                      - true
                    type: boolean
                  session_id:
                    description: The session ID the message was queued to
                    type: string
                required:
                  - queued
                  - session_id
                  - conversation_id
                type: object
          description: '202'
        '400':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                required:
                  - error
                type: object
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                required:
                  - error
                type: object
          description: Resource not found
        '413':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                required:
                  - error
                type: object
          description: Content Too Large
        '500':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                required:
                  - error
                type: object
          description: Server Error
      security:
        - ApiKeyAuth: []
      externalDocs:
        url: https://docs.neynar.com/reference/prompt-deployment-stream
components:
  securitySchemes:
    ApiKeyAuth:
      description: API key to authorize requests
      in: header
      name: x-api-key
      type: apiKey
      x-default: NEYNAR_API_DOCS

````