Reference · HTTP API

API surface

Rapid-MLX exposes an OpenAI-shaped HTTP API at http://localhost:8000/v1 by default. If a tool speaks OpenAI, it speaks Rapid-MLX. Point the base URL at your local server and pass any non-empty API key.

Live OpenAPI schema. Every running server exposes its own machine-readable schema at GET /openapi.json and an interactive Swagger UI at GET /docs. The list below is the human-readable summary; the JSON schema is the source of truth.

Endpoints

methodpathdescription
GET/v1/modelsList available models — alias, parser bindings, capability flags.
POST/v1/chat/completionsChat completions — tools, vision, streaming, reasoning_content all supported.
POST/v1/responsesOpenAI Responses API — streaming with item-by-item events, reasoning items, tool calls.
POST/v1/completionsLegacy text completion (no chat template).
POST/v1/embeddingsEmbeddings — requires the [embeddings] install extra and an embedding alias (e.g. embeddinggemma-300m-6bit).
POST/v1/audio/speechText-to-speech (Kokoro, Chatterbox, VibeVoice, VoxCPM, Dia) — requires the [audio] extra.
POST/v1/audio/transcriptionsSpeech-to-text (Whisper, Parakeet) — requires the [audio] extra.
GET/v1/healthHealth probe.
GET/metricsPrometheus-format counters and histograms.
GET/openapi.jsonOpenAPI 3 schema for everything above.
GET/docsSwagger UI (interactive).

What's the same as OpenAI

What is on by default in 0.9

Two features flipped from opt-in to on-by-default in 0.9 because they help every multi-user workload and cost nothing on the single-user path.

Where it diverges

Examples

List models

$ curl http://localhost:8000/v1/models | jq .data[0]
{
  "id": "qwen3.5-4b-4bit",
  "object": "model",
  "tool_call_parser": "hermes",
  "reasoning_parser": "qwen3",
  "is_hybrid": false,
  "is_moe": false,
  "supports_spec_decode": false
}

Streaming chat completion

from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="x")
stream = client.chat.completions.create(
    model="qwen3.5-4b-4bit",
    messages=[{"role": "user", "content": "Hello"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

Embeddings

# first install: pip install 'rapid-mlx[embeddings]'
$ rapid-mlx serve embeddinggemma-300m-6bit --port 8001 &
$ curl http://localhost:8001/v1/embeddings \
    -H "Content-Type: application/json" \
    -d '{"model": "embeddinggemma-300m-6bit", "input": "ping"}'

Audio (TTS)

# first install: pip install 'rapid-mlx[audio]'
$ rapid-mlx serve kokoro-tts --audio-mode --port 8002 &
$ curl http://localhost:8002/v1/audio/speech \
    -H "Content-Type: application/json" \
    -d '{"model": "kokoro-tts", "voice": "af_heart", "input": "hello"}' \
    -o speech.wav

Where to next

For the full request/response field reference, hit the live Swagger UI at http://localhost:8000/docs on your own server — it stays in sync with the running build, including any flags wired up by recent releases. The engine README covers CLI flags, environment variables, and the rapid-mlx launch <client> bootstrap targets.