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

# LLM

`POST /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

## Changes

- **2025-12-13** `0dfb43d02786` — 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 `detail` response's property type/format changed from ``/`` to `object`/`` for status `400`
  - the `detail` response's property type/format changed from ``/`` to `object`/`` for status `401`
  - …13 more
- **2025-10-30** `0e0e976fd9e0` — 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 `detail` response's property type/format changed from `object`/`` to ``/`` for status `400`
  - the `detail` response's property type/format changed from `object`/`` to ``/`` for status `401`
  - …13 more
- **2025-10-30** `0dfb43d02786` — 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 `detail` response's property type/format changed from ``/`` to `object`/`` for status `400`
  - the `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/livepeer-ai-runner/changes/llm/post.md)

---

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