---
title: "Chat with the model"
url: "https://developer.kong-sales-engineering.com/apis/kong-gpt/versions/7cdae724-17c9-4c8b-b7b1-c60303c1a31e/operations/chat"
---

> Full API specification: https://developer.kong-sales-engineering.com/apis/kong-gpt/versions/7cdae724-17c9-4c8b-b7b1-c60303c1a31e.md

# Chat with the model

`POST` `/chat`

Operation ID: `chat`

This endpoint allows you to chat with the model by sending a series of messages.

## Header parameters

- `X-LLM` (string, required)

## Request body (required)

Content types: `application/json`

## Responses

- `200` - Successful response
- `400` - Bad request
- `500` - Server error

## OpenAPI definition

```yaml
openapi: 3.1.0
info:
  title: Kong AI Gateway API
  version: 1.0.0
servers:
  - url: https://shared-services.kong-sales-engineering.com/portal/kongai
  - url: https://shared-services-hybrid.kong-sales-engineering.com/portal/kongai
paths:
  /chat:
    post:
      operationId: chat
      tags:
        - Chat
      summary: Chat with the model
      description: This endpoint allows you to chat with the model by sending a series
        of messages.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                messages:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - system
                          - user
                          - assistant
                      content:
                        type: string
              required:
                - messages
            examples:
              example:
                value:
                  messages:
                    - role: system
                      content: You are a scientist.
                    - role: user
                      content: What is the theory of relativity?
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
        "400":
          description: Bad request
        "500":
          description: Server error
      parameters:
        - name: X-LLM
          in: header
          required: true
          schema:
            type: string
            enum:
              - openai
              - azure
              - cohere
              - bedrock
security:
  - basicAuth: []
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
```
