Files
open-webui/backend/open_webui/routers
Classic298 ace84b4ae9 perf: use the orjson codec for outbound Ollama request bodies (#27811)
`routers/ollama.py` serializes the outbound body with stdlib `json` on six inference paths: `/api/chat`, the OpenAI-compatible completions and chat completions proxies, embeddings, the Anthropic messages proxy, and responses. All six carry a full conversation or an embedding batch.

They now go through `JSONCodec`, which selects orjson when `ENABLE_ORJSON` is set. Every one is passed to `send_request`, which hands it to aiohttp as `data=`; aiohttp encodes `str` as UTF-8 and derives `Content-Length` from the encoded bytes. None is hashed, cached, length-measured or persisted.

Admin model management keeps stdlib: `/api/unload`, `/api/pull`, `/api/delete` and `/api/show` serialize fixed one- or two-key dicts, as do the blob download and upload progress events and the error frames. Codec dispatch on those costs about what it saves.

With `ENABLE_ORJSON` unset, which is the default, `JSONCodec` is stdlib `json` and this call site behaves exactly as before.
2026-07-31 17:26:38 -04:00
..
2026-06-29 01:38:41 -05:00
2026-07-27 19:39:36 -04:00
2026-07-27 04:46:12 -04:00
2026-07-26 19:34:41 -04:00
2026-06-29 13:03:14 -05:00
2026-07-24 02:36:10 -04:00
2026-07-27 03:32:21 -04:00
2026-07-27 04:38:46 -04:00
2026-07-26 19:10:41 -04:00
2026-06-29 05:47:21 -05:00
2026-07-23 21:29:33 -04:00
2026-07-27 01:59:17 -04:00
2026-07-27 19:39:36 -04:00
2026-07-27 19:39:36 -04:00
2026-07-23 21:29:33 -04:00
2026-06-29 13:03:14 -05:00
2026-06-25 03:31:45 +01:00
2026-07-17 04:11:11 -04:00
2026-07-27 03:41:08 -04:00
2026-07-27 03:54:27 -04:00
2026-06-17 02:52:35 +02:00