---
title: "LLM"
method: POST
path: "/api/generate/llm"
tags: ["generate"]
---

# LLM

`POST /api/generate/llm`

Generate text using a language model.

## Request body

- LLMRequest
  - `messages` LLMMessage[], required
    - `role` string, required
    - `content` string, required
  - `model` string
  - `temperature` number
  - `max_tokens` integer
  - `top_p` number
  - `top_k` integer
  - `stream` boolean

## Response `200`

Successful Response

- LLMResponse
  - `id` string, required
  - `model` string, required
  - `created` integer, required
  - `usage` LLMTokenUsage, required
    - `prompt_tokens` integer, required
    - `completion_tokens` integer, required
    - `total_tokens` integer, required
  - `choices` LLMChoice[], required
    - `index` integer, required
    - `finish_reason` string
    - `delta` LLMMessage
      - `role` string, required
      - `content` string, required
    - `message` LLMMessage
      - `role` string, required
      - `content` string, required

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `422` — Validation Error
- `500` — Internal Server Error
- `default` — Error

## Changes

- **2025-10-30** `dfc937fc0d2c` — 12 breaking, 5 info
  - the `choices/items/delta` response's property type/format changed from `object`/`` to ``/`` for status `200`
  - the `choices/items/message` response's property type/format changed from `object`/`` to ``/`` for status `200`
  - the `oneOf[subschema #1: HTTPError]/detail` response's property type/format changed from `object`/`` to ``/`` for status `400`
  - the `oneOf[subschema #1: HTTPError]/detail` response's property type/format changed from `object`/`` to ``/`` for status `401`
  - …13 more
- **2025-10-30** `f5d01b71ba9a` — 5 breaking, 12 info
  - the `choices/items/delta` response's property type/format changed from ``/`` to `object`/`` for status `200`
  - the `choices/items/message` response's property type/format changed from ``/`` to `object`/`` for status `200`
  - the `oneOf[subschema #1: HTTPError]/detail` response's property type/format changed from ``/`` to `object`/`` for status `400`
  - the `oneOf[subschema #1: HTTPError]/detail` response's property type/format changed from ``/`` to `object`/`` for status `401`
  - …13 more
- …earlier changes not shown

[Full history](https://skmtc.dev/livepeer/apis/untitled-api/changes/api/generate/llm/post.md)

---

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