Skip to main content

Endpoint

The /generate endpoint provides a simplified text generation interface for quick testing and development. For production use, prefer the OpenAI-compatible /v1/chat/completions endpoint.

Request Body

string
required
The input text prompt to generate from.
integer
required
The maximum number of tokens to generate.
boolean
default:"false"
Whether to ignore the end-of-sequence token and continue generation.

Response Format

The endpoint returns a streaming response using Server-Sent Events (SSE). Each event contains incremental text output:
The stream ends with a data: [DONE] message.

Example

Basic Generation

Response:

Notes

The /generate endpoint is primarily for testing and debugging. For production applications, use the /v1/chat/completions endpoint which provides more features and OpenAI API compatibility.
This endpoint does not support chat-style messages or advanced sampling parameters like temperature or top_p. Use /v1/chat/completions for full control over generation.