Skip to main content
POST
One endpoint for every model. Pass text or a document as input; what comes back depends on the model: generated text, a classification, extracted fields, redacted output, and more. The input and output shapes vary by model, so open a model page for a prefilled playground. For the messages-style route, see Chat completions. Install the official SDK from npm or PyPI (pip install zerogpu-api). Source: zerogpu/SDK. Handle errors the same way as API error codes.

Authentication

Send your API key in the x-api-key header or, OpenAI-compatible, as Authorization: Bearer <key>. The x-project-id header is optional; send it only to scope a request to a specific project. See the Quickstart for both forms in each language.

Streaming

Set "stream": true to receive the response as server-sent events (text/event-stream) instead of one JSON body. Pass -N so curl prints each event as it arrives:
cURL
Each event is a data: line holding a JSON object with a type and a sequence_number:
Events arrive in this order: Reasoning models also send response.reasoning_text.delta or response.reasoning_summary_text.delta events before the answer. Most models end the stream with data: [DONE]; treat response.completed as the end of the response and ignore [DONE]. Task models (classifiers and extractors) don’t stream and return 400 with code stream_not_supported. Each model page says whether the model supports streaming.

Tool calling

Pass function definitions in tools. Each tool has a type of function, a name, a description, and its arguments as a JSON Schema in parameters:
cURL
When the model calls a tool, output contains a function_call item. arguments is a JSON-encoded string, so parse it before use:
Some models return an empty message item before the function_call, so find the call by its type rather than by position. Run the function yourself, then send the result back. Pass input as an array with the original message, the function_call item, and a function_call_output item with the same call_id, and include tools again:
cURL
The model answers with a message that uses the result, for example “The current weather in Paris is 18°C with light rain.” With "stream": true, a tool call arrives as response.function_call_arguments.delta events followed by response.function_call_arguments.done. Models without tool support return 400 with code tools_not_supported; each model page says whether the model supports tool calling.

Authorizations

x-api-key
string
header
required

Your ZeroGPU API key. Create one in the dashboard under API keys. Send it on every request.

Headers

x-project-id
string

Optional project identifier. Scopes the request to a specific project when provided.

Body

application/json
model
enum<string>
required

Model identifier. Open a model page for a dedicated playground with the correct body for that model.

Available options:
llama-3.1-8b-instruct-fast,
llama-3.2-3b-instruct-fast,
qwen3-30b-a3b-fp8,
llama-guard-4-12b,
LFM2.5-1.2B-Instruct,
LFM2.5-1.2B-Thinking,
gpt-oss-120b,
qwen3.6-35b-a3b,
deepseek-v4.1-flash,
glm-5.3-flash,
gpt-5.4-nano,
gpt-5.6-luna,
gpt-6-luna,
gpt-4.1-mini,
deberta-v3-small,
gliner2.5-base-v1,
gliner2.5-multi-v1,
gliner2.5-decide-v1,
zlm-v1-iab-classify-edge,
zlm-v1-signal-extract,
zlm-v2-iab-classify-edge-enriched,
zlm-v1-iab-domain-classifier,
zlm-v1-tool-decisions,
unlimited-ocr
Example:

"llama-3.1-8b-instruct-fast"

input
required

The text or document to send, as a plain string. To return a tool result, send an array of input items instead: the conversation so far, the model's function_call item, and a function_call_output item with the same call_id.

Required string length: 1 - 131072
stream
boolean
default:false

If true, the response is sent as server-sent events (text/event-stream) instead of one JSON body. See Streaming for the events. Supported on text-generation models; task models (classifiers, extractors) return 400 with code stream_not_supported.

tools
object[]

Function tools the model may call. When it calls one, output contains a function_call item; see Tool calling. Models without tool support return 400 with code tools_not_supported.

text
object

Response format configuration.

instructions
string

Optional system-style instructions applied on top of input, for models that support them.

metadata
object

Optional model-specific parameters, passed through to the model. For example, the GLiNER2.5 models accept usecase together with labels or schema. See the relevant model page for supported keys.

Response

Success. A JSON response object, or a stream of server-sent events when stream is true.

The generated model response.

id
string

Unique identifier for the response.

Example:

"resp_abc123"

object
string

Object type. Always response.

Example:

"response"

created
integer

Unix timestamp (seconds) when the response was created.

Example:

1710000000

model
string

The model used for inference.

Example:

"llama-3.1-8b-instruct-fast"

output
(object | Function call · object)[]

Output items produced by the model: message items, and a function_call item for each tool the model calls. Reasoning models may also return a reasoning item. Read items by type, not by position.

A single output item from the model.

usage
object

Token usage statistics for the request.