---
title: "Create a chat completion"
url: "https://kongnet.kongai.uk/apis/kongnet-llm-gateway-1/versions/5f03924a-b7f2-442c-ac33-5b613c7921c5/operations/createChatCompletion"
---

> Full API specification: https://kongnet.kongai.uk/apis/kongnet-llm-gateway-1/versions/5f03924a-b7f2-442c-ac33-5b613c7921c5.md

# Create a chat completion

`POST` `/llm/chat/completions`

Operation ID: `createChatCompletion`

## Request body (required)

Content types: `application/json`

## Responses

- `200` - Completion
- `400` - Blocked by a guardrail
- `401` - Missing or invalid key
- `429` - Token budget used up, see the X-AI-RateLimit headers

## OpenAPI definition

```yaml
openapi: 3.0.3
info:
  title: KongNet LLM Gateway
  version: 1.0.0
servers:
  - url: http://localhost:8010
    description: Demo data plane
paths:
  /llm/chat/completions:
    post:
      operationId: createChatCompletion
      summary: Create a chat completion
      tags:
        - LLM
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              properties:
                model:
                  type: string
                  enum:
                    - support-gpt
                    - support-claude
                    - support-gemini
                    - support-oss
                    - support-sonnet
                    - support-haiku
                    - support-gpt-mini
                    - support-gemini-pro
                    - support-qwen
                    - support-gemma
                    - support-auto
                    - support-faq
                messages:
                  type: array
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        enum:
                          - system
                          - user
                          - assistant
                      content:
                        type: string
                stream:
                  type: boolean
      responses:
        "200":
          description: Completion
        "400":
          description: Blocked by a guardrail
        "401":
          description: Missing or invalid key
        "429":
          description: Token budget used up, see the X-AI-RateLimit headers
security:
  - apikey: []
components:
  securitySchemes:
    apikey:
      type: apiKey
      in: header
      name: apikey
```
