The System One EventUtahGo To Event Page →

Docs

Set up Midium, use every part of it, run it for your team, and build on it.

Errors & limits

Every error shape the API returns, the codes you'll see and what to do about them, and the limits that apply to requests.

For developers

This page collects the API's error responses and limits in one place. Most inference errors use OpenAI's envelope, but a few routes answer in other shapes, so check the status code first and read the body second. The engine log (Settings → Logs, or midium logs --errors) has the details of any failure.

Error shapes#

OpenAI envelope — chat completions, embeddings, rerank and audio:

JSON
{
  "error": {
    "message": "Model 'qwen9' not found. Available models: ['Gemma 4 26B A4B', 'Qwen3.8 27B']",
    "type": "invalid_request_error",
    "code": "model_not_found"
  }
}

FastAPI detail — authentication errors on every route, unknown routes and body validation:

JSON
{"detail": "API key does not exist"}

A body that doesn't match the schema returns 422 with a list: {"detail": [{"loc": ["body", "model"], "msg": "Field required", "type": "missing"}]}.

Plain error — model management routes, and a prompt that's too long:

JSON
{"error": "Prompt too long: 140213. Max tokens: 131072"}

Anthropic shape — everything on /v1/messages and /v1/messages/count_tokens:

JSON
{"type": "error", "error": {"type": "not_found_error", "message": "Model 'claude-sonnet' not found. …"}}

During a stream the status is already 200, so errors arrive in the stream: a chat chunk with an error object and empty choices, followed by data: [DONE]; an error event on Anthropic Messages.

Status codes#

StatusMeaningWhat to do
400The request can't be run as sent: a bad tool choice, a model of the wrong kind, an unsupported option, a prompt longer than the context window.Read message and code; fix the request.
401No key, or a key this Mac doesn't know (Missing API key, API key does not exist).Copy the key from Settings → API or midium key --reveal. See Authentication.
403The key's account is turned off (Account suspended), or a team member's key on a Hub-only surface.—
404No model by that name (model_not_found; the message lists the ones you can use), an unknown route ({"detail": "Not Found"}), or an unknown download job.Check the name against GET /v1/models.
409Model management: deleting files of a model that's still one of yours, or a new file_path that won't load.Remove the model first; check the path.
422The body doesn't match the schema: a missing field, a wrong type, an empty input.Read detail.
429Tier credit limit reached for this period. — the key's plan quota is used up.Wait for the reset or change plan.
500Generation or a model load failed.Check the engine log; retry.

Error codes#

codeStatusWhereCause
model_not_found404Chat, embeddings, rerank, audioNo model by that name, or (audio) no speech model installed.
model_not_chat400Chat completionsThe model is an embedder, reranker, image or video model. The message names the right endpoint.
unsupported_model_type400Embeddings, rerankThe model isn't an embedding model / reranker.
invalid_tool_choice400Chat completionstool_choice names a tool that isn't in tools.
invalid_tool_call400Chat completionsThe model's tool-call arguments couldn't be turned into valid JSON. Retrying usually works.
invalid_audio400Audio, chat with audioUnsupported file extension, an unreadable upload, or a bad input_audio part.
invalid_response_format400Audioresponse_format isn't json, text, srt, vtt or verbose_json.
invalid_request_error400AudioFile over 25 MB, or timestamp_granularities without verbose_json or with a value other than segment / word.
unsupported_streaming400Chat completionsStreaming asked of a transcription model.
unsupported_tools400Chat completionsTools sent to a transcription model.
embedding_error, rerank_error400 / 500Embeddings, rerankThe model failed, for example dimensions larger than the model's vectors.
invalid_response500Embeddings, rerankThe model returned something unusable.

A 500 from chat completions has a type but no code.

Limits#

LimitValueNotes
Where requests come from127.0.0.1 onlyDesktop installs listen on loopback. See Remote access.
Smallest max_tokens8192Smaller caps are raised to 8192. Send "strict_max_tokens": true, or set UCE_HONOR_MAX_TOKENS=1 in ~/Midium/.env, to honor them exactly.
max_tokens left outThe model's default, else 32,768UCE_DEFAULT_MAX_TOKENS in ~/Midium/.env changes the 32,768.
Reply lengthThe context the prompt leaves freeEvery cap is cut to fit the model's context window. A reply that hits its cap ends with finish_reason: "length".
Prompt lengthThe model's context windowLonger prompts fail with 400 "Prompt too long". Raise the context on Settings → Models.
Choices per request1n is accepted; one choice comes back.
Audio upload25 MB.mp3, .mp4, .mpeg, .mpga, .m4a, .wav, .webm.
Image linkshttp(s), public hosts only, 30 s downloadlocalhost, .local names and private, loopback, link-local, reserved or multicast addresses are refused. A refused or failed image is dropped without an error — send base64 instead. See Images & vision.
Web search3 rounds per requestNeeds a Brave Search key. See Tool calling.
Model copies (instances)1–8Per model.
Requests per copy (batch_size)1–32Per model.
Vault MCP reads80,000 characters per callPage with offset. Listing returns up to 500 files; writes up to 1 MiB.

Troubleshooting#

  • The first request is slow. The model is loading. Keep it loaded from Settings → Models.
  • A reply ignores an image. The image was dropped — see the warning on Images & vision.
  • A reasoning model's answer is empty but finish_reason is length. It spent its budget thinking. Leave max_tokens out, raise it, or turn thinking off with reasoning_effort: "none".
  • More fixes: Troubleshooting.

Something here wrong or out of date? Tell us.