Open-Sourcing ante-llm: What It Takes to Stream Four LLM APIs Reliably Antigma released ante-llm, an Apache-2.0 Rust crate on crates.io, as the model layer behind every call its Ante agent makes, streaming four wire formats — Anthropic Messages, OpenAI Responses (HTTP or WebSocket), OpenAI Chat Completions and compatible servers, and Gemini — through one request type and one event stream. The crate adds per-provider profiles for DeepSeek, GLM, Kimi, MiniMax, Qwen, OpenRouter and llama.cpp, and handles failure modes the company says an agent loop hits over hours: a single idle timeout covering stream opening and every gap between reads, an LlmErrorKind classification by remedy (rate limited, overloaded, context window exceeded, authentication error, quota exceeded, blocked by policy), reasoning content that must be sent back unchanged, and tool calls with invalid JSON surfaced on malformed_args rather than failing the stream. Antigma says the code is the same one Ante runs in its released binary and Terminal-Bench runs, where it claims Ante is the #1 same-model agent. Open-Sourcing ante-llm: What It Takes to Stream Four LLM APIs Reliably Happy holidays Closing out the year by open-sourcing something we use every day has become a tradition at Antigma. In 2024 it was mcp-sdk https://github.com/AntigmaLabs/mcp-sdk , a minimal Rust implementation of the Model Context Protocol. In 2025 it was nanochat-rs https://github.com/AntigmaLabs/nanochat-rs , a tiny cognitive core in native Rust inspired by Karpathy's nanochat. This year it's ante-llm https://crates.io/crates/ante-llm , the model layer behind every call Ante makes. A lot of what lets Ante beat other harnesses running the same model https://antigma.ai/eval has nothing to do with prompts. It's the plumbing underneath: an agent that makes call after call on a long task has to survive every way a provider can fail, on every provider. That plumbing is now Apache-2.0, for anyone to use. cargo add ante-llm Not a library extracted for the occasion There are good multi-provider Rust clients already, such as genai and rig , and async-openai for OpenAI. The difference with ante-llm is where it comes from. It is the code Ante runs for every model call, in the released binary and in our Terminal-Bench runs https://antigma.ai/eval , including the ones where Ante is the 1 same-model agent. It is not a second implementation kept up for the crate. A fix that lands for Ante lands in the crate, in the same release. It speaks four wire formats through one request type and one stream of events: | Wire format | Client | |---|---| | Anthropic Messages | anthropic::Anthropic | | OpenAI Responses, over HTTP streaming or a WebSocket | openai::OpenAi | | OpenAI Chat Completions and compatible servers | openai compatible::OpenAiCompatible | | Gemini | gemini::Gemini | The Chat Completions client carries per-provider profiles for DeepSeek, GLM, Kimi, MiniMax, Qwen, OpenRouter and llama.cpp, because "OpenAI-compatible" servers disagree on exactly the parameters that matter, starting with how to ask for reasoning. What it takes Sending a request and printing the reply is the easy part. Here is what an agent loop hits once it runs for hours. A provider that never answers Most failures are loud: a status code, an error body. The expensive one is quiet. The provider accepts the request and then sends nothing, and a client that only times out whole requests either waits forever or kills long, healthy generations. ante-llm uses one idle timeout that covers opening the stream and every gap between reads. A reply can stream for as long as it keeps streaming. Silence fails. Errors that say what to do Each provider reports failures differently. An agent doesn't care whether it got a 429, a 529 or an error event in the middle of a stream. It needs to know what to do next. LlmErrorKind classifies every failure by remedy, in the same terms for every provider: rate limited, overloaded, context window exceeded, authentication error, quota exceeded, blocked by policy. The provider's own status, code and message stay on the error for logs. Two quick retries absorb connection blips inside the crate. A longer wait the provider asks for goes back to the caller on the error, so the caller decides whether to wait it out or cancel. Reasoning you have to send back Reasoning models return more than text. Some providers sign their reasoning, or return it encrypted, and expect it back unchanged on the next call. Drop it and the next turn fails or loses its reasoning. The model's message comes back with that content attached, and sending the message back as you got it is enough. One effort setting maps onto each provider's own reasoning levels. Tool calls that break Models sometimes send tool arguments that aren't valid JSON. If that fails the stream, the agent loses the whole turn. In ante-llm the call arrives anyway, with the raw text on malformed args , so the agent can tell the model what went wrong and let it try again. Tool schemas have the opposite problem: each provider accepts a different subset of JSON Schema. normalize tool schema rewrites one schema into the subset all of them accept. Big requests, every turn An agent resends the whole conversation on every call, so requests get large. Requests of 16 KiB or more go gzip-compressed to Anthropic Messages and zstd-compressed to OpenAI Responses. Every other endpoint gets plain JSON. Credentials that expire OAuth tokens expire mid-session. A TokenSource supplies the token and gets one chance to recover when the server rejects it, such as by refreshing it. The request is then sent once more, and the agent never sees the failure. An agent in one file Here is the whole loop: call the model, run the tools it asks for, send the results back, and repeat until it stops asking. js for in 0..MAX STEPS { let stream = client.stream chat request.clone .await?; let response = streaming::collect stream, |event| { if let StreamEvent::TextDelta text = event { print "{text}" ; } } .await .into result ?; let calls: Vec