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

# Create Voice Agent Session

> Start a conversation session with an agent and receive a join token for the
session transport (currently LiveKit WebRTC).



## OpenAPI

````yaml post /v1/agent/sessions
openapi: 3.1.0
info:
  title: FishAudio OpenAPI
  version: '1'
servers:
  - description: Fish Audio API
    url: https://api.fish.audio
security: []
tags: []
paths:
  /v1/agent/sessions:
    post:
      tags:
        - Agent Sessions
      summary: Create Agent Session
      description: >-
        Start a conversation session with an agent and receive a join token for
        the

        session transport (currently LiveKit WebRTC). Authenticate with an API
        key to

        start sessions with any agent in your team; without credentials only
        agents

        published as public are reachable, and when the agent restricts origins
        the

        request `Origin` must match its allowed origins.


        This call only issues the join token. The conversation starts when a
        client

        (the web SDK or the widget) joins with it, so create a session when a
        user

        starts a call, one per call. A session that no client joins before

        `expires_at` ends as `failed`.


        `language` (and `overrides.language`) accepts `en`, `ja`, `zh`, `ko`,
        `es`,

        `fr`, `de`, `pt`, `it`, `nl`; anything else is 422. Omit it to use the
        agent's configured

        speaking language.


        `overrides.asr.model` picks the speech recognition model for this
        session,

        nested like the agent config's `asr` section and with the same values as

        `asr.model`. It needs an API key.


        `overrides.llm.fallback` replaces the agent's `llm.fallback` for this

        session, with the same shape and rules; each `custom` model needs its

        `api_key`. It needs an API key and `llm.fallback` in the agent's

        `overrides_allowed`.


        When every concurrent line of your team is in use the answer is 429 with

        `code: concurrency_limit_exceeded`, a `retry_after` in seconds and a

        `Retry-After` header. The limit of a pay as you go team grows with its

        total top-ups, and burst admits sessions above it.
      parameters:
        - in: header
          name: origin
          description: ''
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            default: null
            title: Origin
          deprecated: false
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentSessionCreatePayload'
      responses:
        '201':
          description: Document created, URL follows
          headers: {}
          content:
            application/json:
              schema:
                description: >-
                  Wire twin of @fishaudio/agent-protocol `SessionToken`
                  (session.ts); keep in sync.
                properties:
                  session_id:
                    title: Session Id
                    type: string
                  expires_at:
                    title: Expires At
                    type: string
                  max_duration_seconds:
                    title: Max Duration Seconds
                    type: integer
                  transport:
                    const: livekit
                    title: Transport
                    type: string
                  livekit_url:
                    title: Livekit Url
                    type: string
                  token:
                    title: Token
                    type: string
                required:
                  - session_id
                  - expires_at
                  - max_duration_seconds
                  - transport
                  - livekit_url
                  - token
                type: object
        '400':
          description: Bad request syntax or unsupported method
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '401':
          description: No permission -- see authorization schemes
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '402':
          description: No payment -- see charging schemes
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '403':
          description: Request forbidden -- authorization will not help
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '404':
          description: Nothing matches the given URI
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '409':
          description: Request conflict
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '429':
          description: >-
            The user has sent too many requests in a given amount of time ("rate
            limiting")
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '502':
          description: Invalid responses from another server/proxy
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '503':
          description: The server cannot process the request due to a high load
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: bash
          label: Create Session
          source: |-
            curl --request POST \
              --url https://api.fish.audio/v1/agent/sessions \
              --header 'Authorization: Bearer <token>' \
              --header 'Content-Type: application/json' \
              --data '{
                "agent_id": "<agent-id>"
              }'
components:
  schemas:
    AgentSessionCreatePayload:
      additionalProperties: false
      properties:
        agent_id:
          title: Agent Id
          type: string
        name:
          anyOf:
            - maxLength: 128
              type: string
            - type: 'null'
          default: null
          title: Name
        timezone:
          anyOf:
            - maxLength: 64
              type: string
            - type: 'null'
          default: null
          description: >-
            IANA timezone (like `Asia/Tokyo`) for the agent's sense of local
            date and time in this session. Overrides the agent's configured
            timezone, which defaults to UTC. Invalid names are rejected with
            422.
          title: Timezone
        client_timezone:
          anyOf:
            - maxLength: 64
              type: string
            - type: 'null'
          default: null
          description: >-
            The end user's device timezone as an IANA name (like `Asia/Tokyo`),
            used as a fallback hint: it applies only when neither `timezone` nor
            the agent's configured timezone is set, and invalid values are
            ignored rather than rejected. The Web SDK fills it automatically
            from the browser for public agents. When your backend creates the
            session, forward the value from your client.
          title: Client Timezone
        context:
          anyOf:
            - $ref: '#/components/schemas/AgentSessionContextPayload'
            - type: 'null'
          default: null
          description: >-
            Per-session overrides of the agent's context switches
            (`context.current_time` in the agent config). A switch you leave out
            follows the agent.
        overrides:
          anyOf:
            - $ref: '#/components/schemas/AgentSessionOverridesPayload'
            - type: 'null'
          default: null
        dynamic_variables:
          anyOf:
            - additionalProperties:
                anyOf:
                  - type: string
                  - type: integer
                  - type: number
                  - type: boolean
              maxProperties: 500
              type: object
            - type: 'null'
          default: null
          title: Dynamic Variables
        end_user_id:
          anyOf:
            - maxLength: 256
              type: string
            - type: 'null'
          default: null
          description: >-
            Your identifier for the end user, stored verbatim. Returned on
            session reads and webhooks, and filterable with `GET
            /v1/agent/sessions?end_user_id=`.
          title: End User Id
        metadata:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/JsonValue'
              type: object
            - type: 'null'
          default: null
          title: Metadata
        llm_extra_body:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/JsonValue'
              type: object
            - type: 'null'
          default: null
          title: Llm Extra Body
        tool_events:
          default: true
          title: Tool Events
          type: boolean
        record_audio:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Record Audio
      required:
        - agent_id
      title: AgentSessionCreatePayload
      type: object
    AgentSessionContextPayload:
      additionalProperties: false
      description: |-
        Per-session overrides of the agent's context switches (the config's
        `context` section). A switch left out follows the agent.
      properties:
        current_time:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          description: >-
            Whether the agent knows the current date and time in this session.
            Omit it to follow the agent's `context.current_time`. `false`
            withholds both from this session, `true` injects them even when the
            agent has them off.
          title: Current Time
      title: AgentSessionContextPayload
      type: object
    AgentSessionOverridesPayload:
      additionalProperties: false
      description: >-
        Wire twin of @fishaudio/agent-protocol `SessionOverrides` (session.ts).


        Every field must be allow-listed in Agent.overrides_allowed;
        unauthorized

        fields fail session creation loudly rather than being silently dropped.
      properties:
        first_message:
          anyOf:
            - maxLength: 10000
              type: string
            - type: 'null'
          default: null
          title: First Message
        first_message_prompt:
          anyOf:
            - maxLength: 10000
              type: string
            - type: 'null'
          default: null
          title: First Message Prompt
        first_message_start:
          anyOf:
            - enum:
                - agent_first
                - wait_for_caller
              type: string
            - type: 'null'
          default: null
          description: >-
            When the opener plays in this session instead of the agent's
            `prompt.first_message_start`: `agent_first` or `wait_for_caller`.
            Rides the same `first_message` override switch. `wait_for_caller` is
            rejected with 422 when the agent's opener is off and the session
            brings no `first_message` or `first_message_prompt`.
          title: First Message Start
        first_message_max_wait_ms:
          anyOf:
            - maximum: 5000
              minimum: 1000
              type: integer
            - type: 'null'
          default: null
          description: >-
            Milliseconds (1000-5000) a `wait_for_caller` session waits before it
            speaks anyway, instead of the agent's
            `prompt.first_message_max_wait_ms`.
          title: First Message Max Wait Ms
        first_message_interruptible:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          description: >-
            Whether the caller can cut the opener off in this session, instead
            of the agent's `prompt.first_message_interruptible`. `false`
            protects it: it always plays to the end and what the caller says
            meanwhile is dropped. Omit it or send `null` to keep the agent's
            value.
          title: First Message Interruptible
        system_prompt:
          anyOf:
            - maxLength: 500000
              type: string
            - type: 'null'
          default: null
          description: >-
            Limited to 64000 tokens (o200k_base), 32000 when `llm.model` is
            `google/gemma-4-26b-a4b-it` (the agent's), same budget as the
            configured prompt it replaces.
          title: System Prompt
        voice_id:
          anyOf:
            - maxLength: 256
              type: string
            - type: 'null'
          default: null
          description: >-
            The voice this session speaks instead of the agent's: a Voice
            Library voice or one of your clones by id, or one of the live3
            speech model's own voices by its lowercase name (clara, nora, ...).
            A name on a session that runs on Fish TTS speaks the Voice Library
            counterpart of that voice.
          title: Voice Id
        language:
          anyOf:
            - enum:
                - en
                - ja
                - zh
                - ko
                - es
                - fr
                - de
                - pt
                - it
                - nl
                - ar
                - hi
                - id
                - tr
                - ru
                - bg
                - sr
                - hr
                - cs
                - sk
                - pl
                - uk
                - ro
                - hu
                - el
                - sv
                - da
                - 'no'
                - fi
                - et
                - lv
                - lt
                - ca
                - he
                - fa
                - ur
                - kk
                - ka
                - hy
                - bn
                - ta
                - te
                - kn
                - mr
                - gu
                - pa
                - ne
                - th
                - vi
                - ms
                - tl
                - af
              type: string
            - type: 'null'
          default: null
          title: Language
        asr:
          anyOf:
            - $ref: '#/components/schemas/AgentSessionAsrOverridesPayload'
            - type: 'null'
          default: null
        llm:
          anyOf:
            - $ref: '#/components/schemas/AgentSessionLlmOverridesPayload'
            - type: 'null'
          default: null
      title: AgentSessionOverridesPayload
      type: object
    JsonValue: {}
    AgentSessionAsrOverridesPayload:
      additionalProperties: false
      description: Per-session subset of the agent config's asr section, same field names.
      properties:
        model:
          anyOf:
            - enum:
                - deepgram:nova-3
                - elevenlabs:scribe_v2_realtime
                - elevenlabs:scribe_v2_medical
                - fish_audio:transcribe-stream-1
                - fish_audio:transcribe-stream-2
                - fish_audio:transcribe-stream-1-dev
              type: string
            - type: 'null'
          default: null
          description: >-
            Speech recognition model for this session, same values as the
            agent's `asr.model`.
          title: Model
      title: AgentSessionAsrOverridesPayload
      type: object
    AgentSessionLlmOverridesPayload:
      additionalProperties: false
      description: Per-session subset of the agent config's llm section, same field names.
      properties:
        fallback:
          anyOf:
            - $ref: '#/components/schemas/AgentLLMFallbackPayload'
            - type: 'null'
          default: null
          description: >-
            Replaces the agent's `llm.fallback` for this session, same shape and
            rules. Each `custom` entry needs its `api_key`.
      title: AgentSessionLlmOverridesPayload
      type: object
    AgentLLMFallbackPayload:
      additionalProperties: false
      description: 'Replaces the whole fallback: `mode` and `models` travel together.'
      properties:
        mode:
          enum:
            - platform
            - manual
            - 'off'
          title: Mode
          type: string
        models:
          anyOf:
            - items:
                $ref: '#/components/schemas/AgentLLMFallbackModelPayload'
              type: array
            - type: 'null'
          default: null
          description: Fallback models in order, 1 to 3. Only with mode `manual`.
          title: Models
        primary:
          anyOf:
            - $ref: '#/components/schemas/AgentLLMTimeoutsPayload'
            - type: 'null'
          default: null
          description: The agent's own model's timeouts. Only with mode `manual`.
      required:
        - mode
      title: AgentLLMFallbackPayload
      type: object
    AgentLLMFallbackModelPayload:
      additionalProperties: false
      description: |-
        One fallback, write model: `model` or `custom`, under the same rules as
        llm.model / llm.custom.
      properties:
        model:
          anyOf:
            - enum:
                - google/gemini-3.5-flash-lite
                - google/gemini-3.6-flash
                - google/gemini-3.8-flash
                - google/gemini-3.6-flash-priority
                - google/gemini-3.8-flash-priority
                - google/gemini-3.5-flash-lite-priority
                - google/gemini-4-hydrogen
                - google/gemini-4-neon
                - google/gemini-4-hydrogen-priority
                - google/gemini-4-neon-priority
                - google/gemini-2.5-flash
                - google/gemma-4-26b-a4b-it
                - anthropic/claude-haiku-4.5
                - anthropic/claude-sonnet-4.6
                - anthropic/claude-sonnet-5.5
                - anthropic/claude-opus-5.5
                - anthropic/claude-fable-5.1
                - anthropic/claude-fable-5.2
                - openai/gpt-5.6-luna
                - openai/gpt-6-luna
                - openai/gpt-5
                - openai/gpt-6.1-sol
                - openai/gpt-6.1-terra
                - openai/gpt-6-astra
                - openai/gpt-6.2-sol
                - openai/gpt-4o
                - openai/gpt-4.1
                - openai/gpt-5.6-luna-fast
                - openai/gpt-6-luna-fast
                - openai/gpt-6.1-terra-fast
                - openai/gpt-6.1-sol-fast
                - openai/gpt-6-astra-fast
                - openai/gpt-6.2-sol-fast
                - openai/gpt-4o-fast
                - openai/gpt-4.1-fast
              type: string
            - type: 'null'
          default: null
          title: Model
        custom:
          anyOf:
            - $ref: '#/components/schemas/AgentLLMCustomPayload'
            - type: 'null'
          default: null
          description: >-
            A customer endpoint, with the same rules as `llm.custom`. Omit
            `api_key` to keep the stored key of the fallback with the same
            `base_url` and `model`.
        ttft_timeout_ms:
          anyOf:
            - maximum: 30000
              minimum: 500
              type: integer
            - type: 'null'
          default: null
          description: >-
            Milliseconds the model gets to start its reply (first text or tool
            call). Past it, the reply moves to the next fallback model. Not set:
            defaults to 5000 ms (5 seconds).
          title: Ttft Timeout Ms
        total_timeout_ms:
          anyOf:
            - maximum: 120000
              minimum: 1000
              type: integer
            - type: 'null'
          default: null
          description: >-
            Milliseconds the model gets to finish its reply. Past it, a reply
            nothing of which was spoken yet moves to the next fallback model;
            one already being spoken fails like any failed reply. At least
            `ttft_timeout_ms` when both are set. Not set: no limit.
          title: Total Timeout Ms
        parallel:
          anyOf:
            - $ref: '#/components/schemas/AgentLLMParallelPayload'
            - type: 'null'
          default: null
          description: >-
            First entry only: request this model together with the agent's own
            model. Both requests bill their tokens.
      title: AgentLLMFallbackModelPayload
      type: object
    AgentLLMTimeoutsPayload:
      additionalProperties: false
      description: >-
        The agent's own model's timeouts, write model. Unset ttft_timeout_ms =

        5000 ms (5 seconds); unset total_timeout_ms = no limit. The two are
        compared

        only when both are set.
      properties:
        ttft_timeout_ms:
          anyOf:
            - maximum: 30000
              minimum: 500
              type: integer
            - type: 'null'
          default: null
          description: >-
            Milliseconds the model gets to start its reply (first text or tool
            call). Past it, the reply moves to the next fallback model. Not set:
            defaults to 5000 ms (5 seconds).
          title: Ttft Timeout Ms
        total_timeout_ms:
          anyOf:
            - maximum: 120000
              minimum: 1000
              type: integer
            - type: 'null'
          default: null
          description: >-
            Milliseconds the model gets to finish its reply. Past it, a reply
            nothing of which was spoken yet moves to the next fallback model;
            one already being spoken fails like any failed reply. At least
            `ttft_timeout_ms` when both are set. Not set: no limit.
          title: Total Timeout Ms
      title: AgentLLMTimeoutsPayload
      type: object
    AgentLLMCustomPayload:
      additionalProperties: false
      description: >-
        Write model: full base_url policy + caps; stored values come only from
        here.
      properties:
        base_url:
          maxLength: 2000
          minLength: 1
          title: Base Url
          type: string
        model:
          maxLength: 256
          minLength: 1
          title: Model
          type: string
        api_key:
          anyOf:
            - maxLength: 4096
              minLength: 1
              type: string
            - type: 'null'
          default: null
          description: >-
            Sent to your endpoint as the Authorization bearer token; write-only,
            reads return null. Required when introducing `custom`; omit to keep
            the stored key when updating.
          title: Api Key
        headers:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          default: null
          description: >-
            Extra headers sent on every request to your endpoint, such as
            `x-vercel-protection-bypass`. Reads return the stored map. Omit to
            keep the stored headers, `{}` clears them.
          title: Headers
      required:
        - base_url
        - model
      title: AgentLLMCustomPayload
      type: object
    AgentLLMParallelPayload:
      additionalProperties: false
      properties:
        kick_in_ms:
          default: 1500
          description: >-
            The agent's own model keeps the reply if its first token comes
            within this many milliseconds; past it, this fallback's reply is
            used. The other request is cancelled.
          maximum: 10000
          minimum: 300
          title: Kick In Ms
          type: integer
      title: AgentLLMParallelPayload
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.