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

# Playground chat completion

> Creates a chat completion in the playground. Requires `ai.operate` or `ai.manage` permission.
Uses the same request/response format as the API key chat completion endpoint.



## OpenAPI

````yaml /spec/ai-playground.yaml post /api/v1/{workspaceID}/playground/chat/completions
openapi: 3.0.1
info:
  title: AI - Playground
  description: >-
    Playground endpoints for testing AI inference with JWT authentication and
    RBAC/DAC authorization.

    These endpoints mirror the API key inference endpoints but require
    user-level permissions.


    Required permissions: `ai.operate` or `ai.manage`


    Parameters:

    - `workspaceID`: The ID of the workspace to use

    - `teamID`: To access services in a team (query param or `x-teamid` header)


    Authentication: JWT Bearer token sent via the `Authorization` header.
  termsOfService: '#'
  contact:
    email: info@liara.ir
  version: 1.0.0
servers:
  - url: https://ai.liara.ir
security:
  - jwt: []
tags:
  - name: Playground Chat
    description: Playground chat completion endpoints
  - name: Playground Images
    description: Playground image generation and editing endpoints
externalDocs:
  description: Find out more about Liara AI
  url: https://liara.ir
paths:
  /api/v1/{workspaceID}/playground/chat/completions:
    post:
      tags:
        - Playground Chat
      summary: Playground chat completion
      description: >-
        Creates a chat completion in the playground. Requires `ai.operate` or
        `ai.manage` permission.

        Uses the same request/response format as the API key chat completion
        endpoint.
      operationId: playgroundChatCompletion
      parameters:
        - name: workspaceID
          in: path
          required: true
          description: The workspace ID
          schema:
            type: string
            pattern: ^[a-f0-9]{24}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlaygroundChatRequest'
      responses:
        '200':
          description: Successful response (non-streaming)
          content:
            application/json:
              schema:
                type: object
        '401':
          description: Missing authentication
          content: {}
        '402':
          description: Payment required
          content: {}
        '403':
          description: Forbidden - insufficient permissions or workspace frozen
          content: {}
        '503':
          description: Service unavailable (feature disabled)
          content: {}
components:
  schemas:
    PlaygroundChatRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: Model ID
        messages:
          type: array
          items:
            type: object
            required:
              - role
            properties:
              role:
                type: string
                enum:
                  - user
                  - assistant
                  - system
                  - developer
                  - tool
              content:
                oneOf:
                  - type: string
                  - type: array
                    items:
                      type: object
        stream:
          type: boolean
          default: false
        temperature:
          type: number
        max_tokens:
          type: integer
        tools:
          type: array
          items:
            type: object
  securitySchemes:
    jwt:
      type: apiKey
      description: 'Enter the token with the `Bearer: ` prefix, e.g. "Bearer abcde12345"'
      name: Authorization
      in: header

````