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

# Create Realtime Session



## OpenAPI

````yaml /openapi.yaml post /v1/realtime/sessions
openapi: 3.1.0
info:
  title: Kupe API
  version: 0.1.0
  description: >-
    Public Kupe REST API. Authenticate with `Authorization: Bearer sk-kupe-...`
    (project API key) or a Supabase user JWT. API-key callers can GET /v1/me for
    the org_id and project_id scoped to the key.
servers:
  - url: https://x.kupe.in
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Me
    description: Current principal — org and project scoped to an API key.
  - name: Agents
    description: Agent CRUD, versions, tools, analyses, memories, and tests.
  - name: Realtime
    description: Mint an ephemeral Realtime session for the WebSocket.
  - name: Sessions
    description: LiveKit web sessions and telephony call sessions.
  - name: Inbound
    description: Bind an agent to a phone number with availability windows.
  - name: Campaigns
    description: 'Outbound batches: contacts, schedule, start/pause/resume.'
  - name: Recipient lists
    description: Reusable contact lists that attach to campaigns.
  - name: Tools
    description: Org tool catalog (webhooks, MCP, Composio-backed).
  - name: Composio
    description: Connect third-party apps and attach actions as tools.
  - name: Analyses
    description: Post-call analysis configs and session results.
  - name: Databases
    description: Call databases, rows, export, and agent attachments.
  - name: Knowledge bases
    description: Files and RAG search for agent context.
  - name: Audio assets
    description: Ambient audio presets and project uploads.
  - name: Phones
    description: Search, buy, and manage telephony numbers.
  - name: Voices
    description: Catalog voices, clones, preview, and speak.
  - name: Providers
    description: STT, LLM, and TTS catalog (defaults + enabled models).
  - name: Logs
    description: Session transcripts, recordings, and tool-call events.
  - name: Billing
    description: Wallet balance and invoices (not checkout).
  - name: Usage
    description: Cost summary and daily usage (no per-service breakdown).
  - name: Orgs
    description: Organizations.
  - name: Projects
    description: Projects inside an org.
  - name: Members
    description: Org membership.
  - name: API keys
    description: Project API keys (`sk-kupe-...`).
  - name: Feature flags
    description: Workspace feature flags.
  - name: Health
    description: Liveness and readiness probes.
paths:
  /v1/realtime/sessions:
    post:
      tags:
        - Realtime
      summary: Create Realtime Session
      operationId: create_realtime_session_v1_realtime_sessions_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRealtimeSessionBody'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RealtimeSessionOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            from kupe import Kupe

            client = Kupe()
            session = client.realtime.sessions.create(
                agent_id="agt_...",
                voice="priya",
            )
            with client.realtime.connect(session) as rt:
                rt.send_text("Hi — remind them EMI is due tomorrow.")
                for event in rt:
                    if event.type == "response.output_audio_transcript.done":
                        print(event.transcript)
        - lang: typescript
          label: TypeScript
          source: |-
            import { Kupe } from "kupe-sdk";

            const kupe = new Kupe();
            const session = await kupe.realtime.sessions.create({
              agent_id: "agt_...",
              voice: "priya",
            });
            const rt = await kupe.realtime.connect(session);
        - lang: bash
          label: cURL
          source: |-
            curl -X POST https://x.kupe.in/v1/realtime/sessions \
              -H "Authorization: Bearer sk-kupe-YOUR_KEY" \
              -H "Content-Type: application/json" \
              -d '{"agent_id":"agt_...","voice":"priya"}'
components:
  schemas:
    CreateRealtimeSessionBody:
      properties:
        agent_id:
          type: string
          title: Agent Id
        org_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Org Id
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Id
        voice:
          anyOf:
            - type: string
            - type: 'null'
          title: Voice
        variables:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Variables
      type: object
      required:
        - agent_id
      title: CreateRealtimeSessionBody
    RealtimeSessionOut:
      properties:
        id:
          type: string
          title: Id
        object:
          type: string
          title: Object
          default: realtime.session
        model:
          type: string
          title: Model
          default: kupe-realtime
        modalities:
          items:
            type: string
          type: array
          title: Modalities
        instructions:
          type: string
          title: Instructions
          default: ''
        voice:
          type: string
          title: Voice
          default: ''
        input_audio_format:
          type: string
          title: Input Audio Format
          default: pcm16
        output_audio_format:
          type: string
          title: Output Audio Format
          default: pcm16
        tools:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Tools
        client_secret:
          $ref: '#/components/schemas/RealtimeClientSecret'
        websocket_url:
          type: string
          title: Websocket Url
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
      type: object
      required:
        - id
        - client_secret
        - websocket_url
      title: RealtimeSessionOut
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RealtimeClientSecret:
      properties:
        value:
          type: string
          title: Value
        expires_at:
          type: integer
          title: Expires At
      type: object
      required:
        - value
        - expires_at
      title: RealtimeClientSecret
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: Project API key (`sk-kupe-...`) or a Supabase user JWT.

````