Skip to main content
POST
Generate

Overview

Generate a response for a given prompt with a provided model. This is the basic text completion endpoint, compatible with the Ollama /api/generate format.

Request

Headers

string
required
Bearer token: Bearer YOUR_API_KEY
string
required
application/json

Body

string
required
The model name to use. See available models.Example: "gemma3:27b", "deepseek-v3.2", "kimi-k2:1t"
string
required
The prompt to generate a response for.
boolean
default:"true"
If true, responses are streamed as they are generated. If false, the full response is returned in one request.
string
System message to set the behavior of the assistant.
object
Model parameter overrides. Supports the following fields:
  • temperature (float) — sampling temperature (0–2)
  • top_p (float) — nucleus sampling
  • top_k (integer) — top-k sampling
  • num_predict (integer) — max tokens to generate
  • stop (array of strings) — stop sequences
array
The context returned from a previous request, used to keep a short conversational memory.
boolean
default:"false"
If true, no formatting is applied to the prompt. Use only when applying your own custom prompt template.

Response

string
The model used for generation.
string
ISO 8601 timestamp of when the response was generated.
string
The generated text. Empty if streaming is in progress.
boolean
true when generation is complete.
string
Reason generation stopped. One of: stop, length, error.
array
An encoding of the conversation for use in the next request (to keep memory).
integer
Total time in nanoseconds.
integer
Number of tokens generated.

Examples