---
title: "Playground chat completion"
method: POST
path: "/api/v1/{workspaceID}/playground/chat/completions"
tags: ["Playground Chat"]
---

# Playground chat completion

`POST /api/v1/{workspaceID}/playground/chat/completions`

## Request

- Base URL: `https://ai.liara.ir`
- URL: `https://ai.liara.ir/api/v1/{workspaceID}/playground/chat/completions`
- Auth: API key in header `Authorization`

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.

## Path parameters

- `workspaceID` string, required

## Request body

- PlaygroundChatRequest
  - `model` string, required: Model ID
  - `messages` object[], required
    - `role` 'user' | 'assistant' | 'system' | 'developer' | 'tool', required
    - `content` union
      - string
      - object[]
  - `stream` boolean
  - `temperature` number
  - `max_tokens` integer
  - `tools` object[]

## Response `200`

Successful response (non-streaming)

- object

## Other responses

- `401`: Missing authentication
- `402`: Payment required
- `403`: Forbidden - insufficient permissions or workspace frozen
- `503`: Service temporarily unavailable.

---

[API](https://skmtc.dev/liara-cloud/apis/ai-playground.md) - [All operations](https://skmtc.dev/liara-cloud/apis/ai-playground/llms.txt) - [OpenAPI document](https://skmtc.dev/liara-cloud/apis/ai-playground/revisions/865035acf0a0?raw)
