Hummingbird
20. May 202619. May 202617. May 202616. May 202615. May 202615. May 202614. May 202613. May 2026
Benchmarks — Hummingbird against FastAPI and Fastify
Article 7 of the Hummingbird series. We measure the LLM gateway against functionally equivalent implementations in FastAPI and Fastify — with a fair middleware stack, a deterministic backend stub, and oha as the load generator. The results are both what you expect and somewhat surprising.
Observability and Linux Deployment — From swift run to systemd
Article 6 of the Hummingbird series. We add Prometheus metrics via swift-metrics and swift-prometheus, a /metrics endpoint, MetricsMiddleware and TracingMiddleware. Plus: cross-compiling to a statically linked Linux binary via the Swift Static Linux SDK, a multi-stage Dockerfile, and a systemd unit for bare-metal Linux deployment.
Auth and RequestContext — Closing the Gate
Article 5 of the Hummingbird series. We add API key auth, token-bucket rate limiting, and spec-compliant error responses — using Hummingbird 2's generic RequestContext to carry typed middleware state without dictionaries.
Streaming — Tokens Flow as They Are Born
Article 4 of the Hummingbird series. We add streaming to both endpoints via Server-Sent Events: MLXClient.completeStream as AsyncThrowingStream, Anthropic events, OpenAI chunks, task cancellation. Tokens appear at the client as the model generates them.
Real Inference — MLXClient and the Local Model
Article 3 of the Hummingbird series. We connect the gateway to mlx_lm.server: MLXClient as a Swift actor, format conversion from Anthropic to OpenAI, error mapping with HTTP status codes. After this article, the gateway delivers real model responses.
Two Protocols, One Backend — Anthropic and OpenAI with Codable
Article 2 of the Hummingbird series. We implement the Anthropic Messages API and the OpenAI Chat Completions API in the same gateway: Codable types for both protocols, two POST endpoints, input validation, mock inference.
Hello Hummingbird — The Skeleton
Article 1 · Swift on the Server with Hummingbird. We create the project, write Package.swift, set up the AsyncParsableCommand entry point, and build a minimal router with /healthz and /v1/models until curl gets an answer.
Swift on the Server — Hummingbird 2 and a Local LLM Gateway
Prologue · Series: Swift on the Server with Hummingbird. Why Swift on the server is no longer a hobby project in 2026, how Hummingbird differs from Vapor and why we chose a local LLM gateway as our demo project.