The proxy
How the /v1/* pass-through streams, logs, and transforms requests.
The proxy is the client-facing /v1/* endpoint. It sends OpenAI and Anthropic requests to the selected backend or a configured direct upstream, and logs the completed exchange.
Streaming and token counting
- Streaming stays streaming. SSE chunks reach the client as they arrive. llama-dash does not gather the response and send it at the end.
- Usage is read in flight. A separate scan reads the final usage chunk without consuming the response body before it is forwarded.
- One row represents one finished exchange. If the client disconnects mid-stream, llama-dash still records the request with any usage captured so far.
OpenAI and Anthropic compatibility
The proxy supports these request families:
- OpenAI:
/v1/chat/completionsand other/v1/*endpoints with flatusagefields. - Anthropic:
/v1/messagesand/v1/messages/count_tokens, with nestedmessage.usageand amessage_stopstream terminator. - llama.cpp and llama-swap extensions: native
/infilland/audiocpp/*pass-throughs.
Cost estimates
llama-dash estimates cost from upstream usage counters and a models.dev pricing catalog loaded at startup. If it does not know the price, the request shows no estimate rather than an invented number.
Transform pipeline
POST /v1/* requests pass through an ordered transform pipeline between auth and forwarding. The body is parsed once when needed and re-serialized only if mutated:
- API key allow-list check
- Routing rule evaluation
- Model alias resolution
- System-prompt injection
- Request size limits
Routing rules are ordered and first-match-wins. See Request logging for what is captured afterwards.
Last updated on