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-key is accepted too).
  • Send Content-Type: application/json (transcription uses a form upload), up to 64 MB.
  • Models load and switch by the model in the request. It may be left out when there is only one of that kind.
  • Errors look like {"error":{"message":"…","code":404}}.

Endpoints

EndpointDoes
GET /v1/modelsmodel list. type is llm, image, video, speech or asr
POST /v1/chat/completionschat, with stream
POST /v1/completionstext completion
POST /v1/responsesOpenAI Responses format
POST /v1/messagesAnthropic Messages format
POST /v1/embeddingsembeddings (models that support it)
POST /v1/images/generationspictures
POST /v1/videos/generationsvideos
GET /v1/flowsflows you can ask for
GET /v1/voicessaved voices
GET /v1/images/files/{name}a finished picture or video
POST /v1/audio/speechtext to voice
POST /v1/audio/transcriptionsvoice 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:

ValueEffect
absentallowed
falsenot 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:

FieldMeaning
model, inputrequired
response_formatwav (default) or pcm
streamtrue sends each part as it is made
voicename of a saved voice; unknown names are ignored
speaker_ref_b64, speaker_ref_texta one-off reference recording and its words
instructionsdescribe the voice (some models)
langlanguage code; otherwise judged from the text
seed, speed

Voice to text, /v1/audio/transcriptions (form upload):

FieldMeaning
filerequired. WAV, MP3 or FLAC
modelmodel name
languageoptional

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:

FieldMeaning
rlm_flowflow name or id. "" is basic mode; when absent the group's default flow is used, or the chat flow if no model is given
modela model or model group
prompt, negative_prompt, seedpassed into the flow
nhow many to make (up to 16)
rlm_imagesbase64 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.