---
title: "Inference: Completion"
method: POST
path: "/completions"
tags: ["completions"]
---

# Inference: Completion

`POST /completions`

## Request

- Base URL: `https://inference-api.nousresearch.com/v1`
- URL: `https://inference-api.nousresearch.com/v1/completions`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/nousresearch/apis/nous-research-inference-api/docs/completions/post.ts> (a function with typed inputs; its response is checked against the schema)

Compatible with OpenAI's Completions API.

## Request body

- object
  - `model` string, required: The model to use for the request.
  - `prompt` string, required: The input prompt to generate completions for.
  - `max_tokens` integer: The maximum number of tokens to generate. Must be between 1 and 32000.
  - `temperature` number: Sampling temperature to use. Must be between 0.0 and 2.0.
  - `stream` boolean: Whether to stream responses incrementally.

## Response `200`

Successful Response

- object
  - `id` string: Unique identifier for the response.
  - `object` string
  - `created` integer: Timestamp of response creation.
  - `model` string: The model used.
  - `choices` object[]
    - `text` string: The generated text.
    - `index` integer
    - `logprobs` unknown
    - `finish_reason` string

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/nousresearch/apis/nous-research-inference-api.md) - [All operations](https://skmtc.dev/nousresearch/apis/nous-research-inference-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nousresearch/apis/nous-research-inference-api/revisions/6817833021cd?raw)
