API reference
On this page
Basics
The address is http://127.0.0.1:3456/v1, compatible with OpenAI.
- By default it can only be called from this computer; to connect from others see Accounts and remote access.
- With the API key turned on or accounts created, every request needs
Authorization: Bearer <key>(the global key or a personal one;x-api-keyis accepted too). - Send
Content-Type: application/json(transcription uses a form upload), up to 64 MB. - Models load and switch by the
modelin the request. It may be left out when there is only one of that kind. - Errors look like
{"error":{"message":"…","code":404}}.
Endpoints
| Endpoint | Does |
|---|---|
GET /v1/models | model list. type is llm, image, video, speech or asr |
POST /v1/chat/completions | chat, with stream |
POST /v1/completions | text completion |
POST /v1/responses | OpenAI Responses format |
POST /v1/messages | Anthropic Messages format |
POST /v1/embeddings | embeddings (models that support it) |
POST /v1/images/generations | pictures |
POST /v1/videos/generations | videos |
GET /v1/flows | flows you can ask for |
GET /v1/voices | saved voices |
GET /v1/images/files/{name} | a finished picture or video |
POST /v1/audio/speech | text to voice |
POST /v1/audio/transcriptions | voice to text |
Paths under /api/ are for the interface itself and change between versions.
Chat
temperature, top_p, max_tokens, seed and the like go to the engine. Send pictures as image_url (data URLs work) and audio as input_audio.
curl.exe http://127.0.0.1:3456/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"gemma-4-E4B-it-Q8_0","messages":[{"role":"user","content":"Hi"}]}'
Letting the chat model draw
The chat model can call an image model; the reply then contains a picture link. Control it with rlm_draw:
| Value | Effect |
|---|---|
| absent | allowed |
false | not this time |
"model name" | which image model to use |
It stays out of the way when you send your own tools, ask for a fixed output format, or set n above 1.
With a video model installed it can call that too (the reply contains a .webm link and takes several minutes); "rlm_video": false turns it off; a model name chooses which one.
Once a flow is set for chat on the Images or Video tab, chats that do not name a model use that flow.
Pictures
{ "model": "z-image-turbo", "prompt": "a red apple", "size": "768x768" }
data[0].b64_json is a PNG. This endpoint only knows size; other settings go after the description:
a red apple<sd_cpp_extra_args>{"seed":1,"negative_prompt":"blurry","sample_params":{"sample_steps":8}}</sd_cpp_extra_args>
Speech
Text to voice, /v1/audio/speech:
| Field | Meaning |
|---|---|
model, input | required |
response_format | wav (default) or pcm |
stream | true sends each part as it is made |
voice | name of a saved voice; unknown names are ignored |
speaker_ref_b64, speaker_ref_text | a one-off reference recording and its words |
instructions | describe the voice (some models) |
lang | language code; otherwise judged from the text |
seed, speed |
Voice to text, /v1/audio/transcriptions (form upload):
| Field | Meaning |
|---|---|
file | required. WAV, MP3 or FLAC |
model | model name |
language | optional |
The reply is {"text":"…"}.
Video
{ "model": "<video model or group>", "prompt": "a fox running", "width": 832, "height": 480, "frames": 33 }
Fields: model, prompt, negative_prompt, width, height, frames, fps, steps, seed, n, rlm_flow. The reply comes when the work is done (it can take minutes); each item of data[] has b64_json and url.
Choosing a flow
The picture and video endpoints can run flows:
| Field | Meaning |
|---|---|
rlm_flow | flow name or id. "" is basic mode; when absent the group's default flow is used, or the chat flow if no model is given |
model | a model or model group |
prompt, negative_prompt, seed | passed into the flow |
n | how many to make (up to 16) |
rlm_images | base64 pictures that replace the flow's input pictures, in order |
Chat requests can use rlm_draw_flow and rlm_video_flow for the flows used when the model draws or makes video.
Several machines at once
Model groups (Enterprise) spread API requests over machines: put the group name in model for chat, pictures, video, speech or transcription, and work goes only to members. Pictures and video run one at a time per machine, as many at once as there are free machines, and the rest wait; send requests in parallel or use n. The window still runs one flow at a time.
If this page differs from the Traditional Chinese version, the Traditional Chinese version prevails.