---
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.

---

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