Pools, Cloud Fallback & Model API
Configure logical model pools, collaborator sharing, cache-aware routing, :external cloud fallback, /v1/* endpoints, keepalive, transcription, and Cloudflare Tunnel limits.
Clients never address individual nodes or runtimes directly through /v1/*. Instead, they call pools—logical routing groups that load-balance across local runtimes, preserve KV-cache locality, support collaborator contributions, and optionally overflow to cloud providers.
Logical Pools and Aliases
Every pool has a callable ID of the form owner/pool (for example alice/qwen3-coder):
owner/pool(local only): Routes strictly to active local pool members (your own runtimes and any runtimes contributed by people you shared the pool with). Request data never leaves your server.owner/pool:external: Tries local members first, and may overflow to configured cloud provider members—or a share holder’s own provider key—only when local capacity cannot serve the request and every consent check passes. The:externalsuffix must be lowercase and used once.- Model-name aliases: If a client or harness hard-codes a model name such as
gpt-4oorclaude-sonnet-4-5, bind a personal alias (globally across your keys or scoped to one API key) to any pool you can call. Aliases appear in/v1/modelsalongside callable pool IDs.
GET /v1/models returns only the pools your API key can call that currently have at least one active member on a ready instance and connected node (saturated pools remain listed). It also advertises capability hints when known: supports_tools, supports_reasoning, supports_audio_transcription, and supports_realtime_transcription.
Sharing Pools by Email
Share any pool from its Sharing tab by email address. Each share grants one or both permissions:
- Consume (
canUse): The recipient can call your pool through their own API keys. - Contribute (
canContribute): The recipient can attach their own served models to your pool to add capacity.
Either party can revoke or withdraw at any time. Sharing a pool never grants control over another user’s nodes, nor does it expose the pool owner’s cloud provider labels, URLs, or internal instance IDs. Per-share controls let the pool owner set:
- Priority class (
background,normal, orhigh) for queued requests. - Warm-session protection override (
protectionPercentor0for unprotected). - Monthly spend cap (
monthlyCap) on owner-paid:externalfallback (exhaustion returns429 grantee_spend_capwithout leaking amounts or cap IDs; local members keep serving).
If a pool owner’s account is banned or pending deletion, their pools immediately disappear from /v1/models and return 404 to all callers until access is restored.
Cache-Aware Routing and Warm-Session Protection
WMP maximizes local KV-cache reuse without storing any prompt content (only tenant-scoped HMAC digests, session IDs, and integer token counts):
- Conversation continuity: Automatically identifies conversations via the first valid client carrier (
conversation,conversation_id, OpenAIprompt_cache_key, headersx-conversation-id,session_id,session-id,x-session-id,x-claude-code-session-id, or Anthropicmetadata.user_id_session_<uuid>) or falls back to a 64-node prefix digest chain. - Cache-holder wait: When a request’s warm prefix lives on a busy local member, WMP holds the request briefly before spilling to a cold member—estimating saved prefill time from recent cold-prefill speeds, capped at 30 seconds (2 seconds until measured).
- Residency spreading: New conversations with no warm match spread across members according to normalized KV fill (token mode for vLLM/SGLang, slot mode for llama.cpp) and member weights (
affinity.residencyWeight). - Warm-session protection: Recently used large sessions (default: within 5 minutes and at least 8,192 tokens; half window on llama.cpp) are protected from eviction by new conversations under
equal_share(default),fixed_percent, orfirst_comefairness. In token mode, confirmed eviction misses automatically lower the effective KV budget in 5% steps (up to 50% cut, decaying linearly over 30 minutes).
Cloud Provider Fallback (owner/pool:external)
Data leaves your server for a cloud provider only when all required conditions hold both at request arrival and inside the database transaction immediately before egress:
WMP_PUBLIC_PROVIDER_EGRESS_ENABLED=trueon the server (on by default; setfalseas a global kill switch, returning403 external_providers_disabled).- The request explicitly names
owner/pool:external(API keys have no separate cloud toggle; MCPmodel_testnever permits:externaland returns400 external_not_supported_for_mcp). - The pool’s Cloud mode (human-only setting on the pool’s Cloud tab) covers the caller:
- Off (
OFF, default): No owner-paid fallback. - For me (
OWNER): Owner only. - For me and people I share with (
OWNER_AND_SHARES): Owner and share holders (bounded by each share’s monthly cap and the provider account’s monthly cap).
- Off (
Fallback Triggers
Local members are always tried first. A request moves to the external phase only when:
Trigger (x-wsmp-fallback-reason) |
When it fires |
|---|---|
local_wait_expired |
Local wait exceeded maxWaitMs (default 30 s; 0 overflows immediately when no local slot is free) after any cache-holder hold. |
local_saturated_protected |
Only protected warm local slots remain for a new conversation and the owner explicitly enabled paid warm protection (off by default). |
no_local_member |
No healthy, compatible local member exists. |
local_failure |
Retryable local failures occurred before the first response byte across all local candidates. |
local_context_ceiling |
The request exceeds every local member’s context window. |
Hitting your own concurrency cap (429) never triggers cloud fallback.
Own-Key Routing, OpenRouter Privacy, and Embedding Contracts
- Own-key routing: If the pool owner declares an equivalent model on the pool’s Cloud tab, a share holder can select a model from their own provider account under Access → Shares. On fallback triggers, the share holder’s own key is tried before owner-paid fallback and bills only their own spend cap.
- OpenRouter privacy: Every request to an
openrouteraccount automatically forcesprovider: { data_collection: "deny" }so OpenRouter routes only to zero-retention/no-training endpoints. If no upstream provider matches, WMP returns503 provider_data_policy_unavailable. Account owners can opt in per account under Providers (human-only). - Provider spend caps & pricing: Provider account monthly caps require an active price in the cap’s currency; otherwise a provider-only pool returns
400 provider_pricing_missing. - External embeddings contract:
:externalembeddings require an exact matching{model, revision, dimensions, normalization, vectorSpace}contract on both the pool and the provider model—matching vector dimensions alone is never sufficient. Audio and multipart routes reject:externalwith400 external_variant_unsupported.
Routing Response Headers
| Header | Values / Meaning |
|---|---|
x-wsmp-route |
local, pool-fallback, or own-key (omitted when keepalive committed early). |
x-wsmp-fallback-reason |
Trigger name above, present on external responses. |
x-wsmp-served-model |
Upstream provider model ID on external responses. |
x-wsmp-fallback |
unavailable when :external was requested, an external route was needed or disallowed, and no external provider served the response. |
/v1/* API Reference
Authenticate every /v1/* request with an API key using Authorization: Bearer <key>, x-api-key: <key>, or api-key: <key>. Cookie sessions and permissive browser CORS are intentionally rejected on /v1/*. JSON model API bodies are capped at 32 MiB and enforce a 256-level JSON nesting limit (returning HTTP 400 if exceeded; upstream responses exceeding 256 levels return HTTP 502 response_json_depth_exceeded).
| Method & Path | Purpose | :external |
Keepalive |
|---|---|---|---|
GET /v1/models |
List callable pool IDs and aliases for the API key | Lists eligible :external IDs |
— |
POST /v1/chat/completions |
OpenAI Chat Completions (streaming & non-streaming) | Yes | Yes |
POST /v1/responses |
OpenAI Responses API (store: false default) |
Yes | Yes |
POST /v1/responses/count_tokens |
Count input tokens for Responses | Treated as plain (local) | Yes |
GET /v1/responses/:id |
Retrieve a response created with store: true |
Sticky to backend | Yes |
DELETE /v1/responses/:id |
Delete a stored response | Sticky to backend | Yes |
POST /v1/responses/:id/cancel |
Cancel an in-progress stored response | Sticky to backend | Yes |
GET /v1/responses/:id/input_items |
List input items for a stored response | Sticky to backend | Yes |
POST /v1/responses/:id/compact |
Compact a stored response | Sticky to backend | Yes |
POST /v1/messages |
Anthropic Messages API (native or protocol-adapted) | Yes | Yes |
POST /v1/messages/count_tokens |
Count tokens for Anthropic Messages | Treated as plain (local) | Yes |
POST /v1/embeddings |
Embeddings (exact vector-space contract for :external) |
Yes (contract required) | Yes |
POST /v1/audio/transcriptions |
Multipart speech-to-text transcription | No (400) |
JSON formats only |
POST /v1/audio/translations |
Multipart speech-to-text translation | No (400) |
JSON formats only |
POST /v1/audio/speech |
Text-to-speech audio generation | No (400) |
No |
GET /v1/realtime |
WebSocket live transcription (?intent=transcription) |
No | Ping every 25 s |
POST/GET /v1/files |
Ephemeral media upload/fetch (when MEDIA_STORAGE=local) |
— | — |
Note on Stored Responses:
/v1/responsessendsstore: falseupstream unless the caller passesstore: trueagainst a backend with nativeRESPONSES_APIsupport. WMP retains only the response-to-backend routing binding (never the content) for 7 days.
Slow Answers and Keepalive
A queued or slow local model can remain silent for minutes before emitting its first byte, causing reverse proxies to drop the connection (Cloudflare returns HTTP 524 after ~100 s; nginx defaults to 60 s).
Once a supported request is validated, WMP waits MODEL_API_KEEPALIVE_AFTER_MS (default 30000 ms; set 0 to disable). If no response arrives by then:
- WMP commits HTTP
200with headerx-wsmp-keepalive: 1and emits a keepalive pulse every 15 seconds. - JSON responses receive leading newline characters (ignored by all JSON parsers). If an error occurs after commit, WMP writes the protocol’s error object with
error.statuspopulated (for example{"error":{"message":"...","code":"...","status":503}}). - SSE streams (
stream: true) receive SSE comment lines (: keepalive) both before the first token and during silent gaps between events. Post-commit failures emit a protocol stream error event. - Pool failover continues to work after the keepalive commit because keepalive bytes are not answer bytes.
- Send header
x-wsmp-keepalive: offon any request to opt out and guarantee real HTTP status codes. - Text,
srt, andvtttranscriptions, streaming transcriptions, and/v1/audio/speechare never kept alive so their exact bytes are preserved.
Transcription Interoperability and Live Audio
WMP acts as a backend-neutral proxy for audio transcription and translation: it does not run ASR, diarization, alignment, or transcoding itself. It forwards multipart fields (response_format, timestamp_granularities[], language, stream, diarization fields) unchanged and routes only to pool members whose runtime transcription profile declares matching capabilities.
curl --fail-with-body --no-buffer \
-H "Authorization: Bearer $WSMP_API_KEY" \
-F "model=alice/whisper" \
-F "file=@sample.wav" \
-F "response_format=verbose_json" \
-F "timestamp_granularities[]=word" \
"https://models.example.com/v1/audio/transcriptions"
Uploads are spooled briefly under MODEL_API_TRANSCRIPTION_SPOOL_DIR (or OS temp) so failover can replay the upload cleanly to another healthy pool member. If a hard crash leaves orphaned instance-* spool folders behind, stop all WMP processes sharing that spool root, verify no open files (lsof +D), and delete only instance-* children.
Live Transcription (GET /v1/realtime?intent=transcription)
Opt in per served model via models[].transcription.realtime in the runtime definition:
adapter: "vllm"(defaultmaxItemSeconds: 300, range 5–600): Bridges to vLLM’s/v1/realtimefor streaming partial deltas (for example Voxtral-Mini-4B-Realtime or Qwen3-ASR realtime).adapter: "segmented"(defaultmaxItemSeconds: 30, max 120): Works with any/v1/audio/transcriptionsengine (includingwhisper.cppstarted with--inference-path /v1/audio/transcriptions);wsmpbuffers each committed turn and submits a 16 kHz WAV upload.
Authenticate with Authorization: Bearer <key> (or browser subprotocols realtime and openai-insecure-api-key.<key>; keys in query strings are refused). Send session.update (if model was not in the URL), stream 24 kHz 16-bit mono PCM via input_audio_buffer.append (max 512 KiB base64 per event), call input_audio_buffer.commit, and read conversation.item.input_audio_transcription.{delta,completed,failed}.
Limits: 4 concurrent sessions per API key, 8 per user (and max 8 per node), 30 minutes max duration, 120 s audio idle timeout, 400 events per 10 s. Non-1000 closes are preceded by an error event (1001 server shutdown, 1008 access lost/refused, 1011 upstream/node failure, 1013 busy/no eligible member).
Cloudflare Tunnel Limits
When hosting WMP behind a named Cloudflare Tunnel (Free or Pro plan):
- 100 MB request body limit: WMP’s default transcription ceilings—
MODEL_API_TRANSCRIPTION_MAX_UPLOAD_BYTES(90 MiB /94371840bytes) andMODEL_API_TRANSCRIPTION_MAX_MULTIPART_BYTES(91 MiB /95420416bytes)—deliberately sit below Cloudflare’s 100 MB cap so oversized files receive WMP’s structured JSON413instead of Cloudflare’s HTML413. Do not raise them above100000000bytes behind a tunnel. (The default admin attachment limit is 25 MiB; the dashboard Test page caps uploads at 9.5 MiB.) - 100 s idle timeout (HTTP 524): Covered automatically by the 30 s keepalive on JSON and streaming model endpoints. For long audio files behind Cloudflare, use a JSON transcription format (
json,verbose_json,diarized_json) rather thantext,srt, orvtt. - WebSocket idle drops & edge restarts: All WebSockets stay active via heartbeats (
wsmpevery 20 s; browser terminals,/v1/realtime, and dashboard SSE every 25 s).wsmpreconnects automatically; browser terminals reattach with scrollback; dropped/v1/realtimesessions must be reopened by the client. - Proxy headers: Set
TRUST_PROXY_HOPS=1whencloudflaredforwards directly toapp:3000, orTRUST_PROXY_HOPS=2when a local proxy (Traefik, Caddy, nginx) sits betweencloudflaredand the app. WMP intentionally ignoresCF-Connecting-IPand usesX-Forwarded-Forwith your configured hop count.