---
title: "Create chat completion (proxy)"
method: POST
path: "/liteforms/chat_proxy"
tags: ["Liteforms"]
---

# Create chat completion (proxy)

`POST /liteforms/chat_proxy`

Sends a message to the OpenAI chat completions endpoint, waits for the response to resolve, and returns the response. This will fail if the user has exceeded their usage limit.
				
1:1 proxy with OpenAI's completion endpoint https://platform.openai.com/docs/api-reference/chat/create

## Request body

- LiteformsChatProxyBody
  - `model` 'gpt-3.5-turbo' | 'gpt-3.5-turbo-0613' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4-32k' | 'gpt-4-32k-0613' | 'gpt-4o' — The OpenAI model to use.
  - `messages` object[], required
    - `role` 'system' | 'user' | 'assistant' | 'function', required
    - `content` string, required — The content of the message.
    - `name` string — The name of the author of this message. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.
  - `presence_penalty` number — Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
  - `frequency_penalty` number — Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
  - `temperature` number — The temperature of the model. Must be between 0 and 1.
  - `top_p` number — The top_p of the model. Must be between 0 and 1.
  - `max_tokens` number — The maximum number of tokens to return.

## Response `200`

Successful response

- LiteformsChatProxyResponse
  - `data` object, required
    - `id` string, required
    - `object` string, required
    - `created` number, required
    - `model` string, required
    - `choices` object[], required
      - `message` object
        - `role` string, required
        - `content` string
      - `finish_reason` string
      - `index` number
    - `usage` object
      - `total_tokens` number, required
      - `completion_tokens` number, required
      - `prompt_tokens` number, required
  - `response` object, required
    - `dbLoadTime` number, required
    - `chatgptLoadTime` number, required
    - `totalTime` number, required
  - `usage` object, required
    - `totalSeconds` number, required — The number of seconds of usage so far.
    - `totalSecondsRemaining` number, required — The number of seconds remaining. Once this value equals zero, the rest of the API calls will fail.
    - `totalGPTTokens` number, required — The number of GPT tokens used so far.
    - `totalSTTSeconds` number, required — The number of STT seconds used so far.
    - `totalTTSSeconds` number — The number of TTS seconds used so far.
    - `totalTTSChars` number, required — The number of TTS characters used so far.
    - `totalImagesCreated` number, required — The number of images created.
    - `startedAt` string, date-time, required — The date the usage period started.
    - `resetsAt` string, date-time, required — The date the usage period will reset.

## Other responses

- `401` — Invalid authentication credentials.
- `408` — The server timed out waiting for the request.
- `412` — Usage has exceeded the monthly limit.
- `500` — An unspecified error occurred.

---

[API](https://skmtc.dev/blocks/apis/looking-glass-api.md) · [All operations](https://skmtc.dev/blocks/apis/looking-glass-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/blocks/looking-glass-api/revisions/c79a9a0e44b0/schema)
