---
title: "Complete sends the messages of a chat to the AI and asks it to generate a new message."
method: POST
path: "/v1/ai/complete"
---

# Complete sends the messages of a chat to the AI and asks it to generate a new message.

`POST /v1/ai/complete`

## Request body

- V1CompleteRequest
  - `messages` V1CompletionMessage[] — Input message(s) for the AI to complete.
    - `content` V1ContentBlock[]
      - `text` string
      - `toolCall` V1ToolCall
        - `id` string
        - `input` object
        - `name` string
      - `toolResult` V1ToolResult
        - `content` string
        - `id` string
        - `isError` boolean
    - `data` string
    - `role` string
  - `outputJsonSchema` string
  - `tools` V1Tool[]
    - `description` string
    - `displayName` string
    - `inputSchema` string
    - `meta` object
    - `name` string
    - `outputSchema` string

## Response `200`

A successful response.

- V1CompleteResponse
  - `cachedInputTokens` integer — Number of cache-read (discounted) input tokens; a subset of input_tokens.
  - `inputTokens` integer — Number of full-rate (non-cached) tokens in the input.
  - `message` V1CompletionMessage
    - `content` V1ContentBlock[]
      - `text` string
      - `toolCall` V1ToolCall
        - `id` string
        - `input` object
        - `name` string
      - `toolResult` V1ToolResult
        - `content` string
        - `id` string
        - `isError` boolean
    - `data` string
    - `role` string
  - `outputTokens` integer — Number of tokens in the output.
  - `provider` string — The LLM provider that served the completion (e.g. "claude", "openai", "gemini").

## Other responses

- `default` — An unexpected error response.

## Changes

- **2026-06-24** (v1) `e47705c6c629` — 2 info
  - added the optional property `cachedInputTokens` to the response with the `200` status
  - added the optional property `provider` to the response with the `200` status
- **2025-12-11** (v1) `f317ff96998d` — 2 warning
  - removed the optional property `cachedInputTokens` from the response with the `200` status
  - removed the optional property `provider` from the response with the `200` status

[Change history](https://skmtc.dev/rilldata/apis/rill-admin-api/changes/v1/ai/complete/post.md)

---

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