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

> ## Agent Instructions
> For AgentScope Python, use https://docs.agentscope.io/stable/en/index for new projects. For existing projects, check the installed agentscope version and use matching versioned documentation.
> The /latest/ alias points to the newest documentation and may move ahead of /stable/ when a development version exists. Do not mix AgentScope 1.x and 2.x APIs.
> State the AgentScope version when providing installation commands or code examples. ReMe uses its own continuously updated /reme/latest/ documentation.

# Mint a short-lived realtime ASR WebSocket token

> Authorize one credential and model before opening a WebSocket.

The returned token is scoped to the requested credential and model and
expires after a short interval.

Args:
    body (`RealtimeASRTokenRequest`):
        The credential and realtime ASR model to authorize.
    user_id (`str`):
        The authenticated viewer's user ID.
    access (`ResourceAccessService`):
        The service used to authorize and resolve the credential.
    download_secret (`str`):
        The server secret used to sign the capability token.

Returns:
    `RealtimeASRTokenResponse`:
        The signed token and its expiration timestamp.

Raises:
    `HTTPException`:
        If the credential is unavailable to the viewer or does not
        support the requested realtime model.



## OpenAPI

````yaml /en/versions/2.0.12/deploy/openapi.json post /asr/realtime/token
openapi: 3.1.0
info:
  title: AgentScope
  version: 2.0.12
servers: []
security: []
paths:
  /asr/realtime/token:
    post:
      tags:
        - asr
      summary: Mint a short-lived realtime ASR WebSocket token
      description: |-
        Authorize one credential and model before opening a WebSocket.

        The returned token is scoped to the requested credential and model and
        expires after a short interval.

        Args:
            body (`RealtimeASRTokenRequest`):
                The credential and realtime ASR model to authorize.
            user_id (`str`):
                The authenticated viewer's user ID.
            access (`ResourceAccessService`):
                The service used to authorize and resolve the credential.
            download_secret (`str`):
                The server secret used to sign the capability token.

        Returns:
            `RealtimeASRTokenResponse`:
                The signed token and its expiration timestamp.

        Raises:
            `HTTPException`:
                If the credential is unavailable to the viewer or does not
                support the requested realtime model.
      operationId: create_realtime_asr_token_asr_realtime_token_post
      parameters:
        - name: x-user-id
          in: header
          required: true
          schema:
            type: string
            description: >-
              Caller's user ID. Temporary header-based identity; will be
              replaced by JWT auth.
            title: X-User-Id
          description: >-
            Caller's user ID. Temporary header-based identity; will be replaced
            by JWT auth.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RealtimeASRTokenRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RealtimeASRTokenResponse'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    RealtimeASRTokenRequest:
      properties:
        credential_id:
          type: string
          minLength: 1
          title: Credential Id
        model:
          type: string
          minLength: 1
          title: Model
      type: object
      required:
        - credential_id
        - model
      title: RealtimeASRTokenRequest
      description: Request a capability for one realtime ASR configuration.
    RealtimeASRTokenResponse:
      properties:
        token:
          type: string
          title: Token
          description: Pass as the WebSocket token query.
        expires_at:
          type: integer
          title: Expires At
          description: Unix timestamp after which the token is refused.
      type: object
      required:
        - token
        - expires_at
      title: RealtimeASRTokenResponse
      description: Short-lived capability accepted by the realtime ASR socket.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````

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