api.deepinfra.com supports HTTP/2. Clients negotiate it automatically during the TLS
handshake, so there is nothing to configure on the DeepInfra side, and clients that only speak
HTTP/1.1 keep working exactly as before.
HTTP/2 runs many requests over one connection at the same time. That helps most when you send
many requests in parallel or call from far away: each new connection costs a TCP and TLS handshake
(a few milliseconds nearby, a few hundred from another continent), and HTTP/2 pays that once instead
of per connection. It does not make an individual request faster — model time is the same either way.
Which clients use it
- Browsers,
curl, and Go’snet/httpuse HTTP/2 automatically. Forcurl, that needs a build with HTTP/2 support (curl -VlistsHTTP2; most do). In Go it’s the default transport; a customhttp.Transportwith its own TLS config needsForceAttemptHTTP2: true. - The OpenAI Python SDK (httpx) uses HTTP/1.1 unless you turn HTTP/2 on, as below.
- The OpenAI Node SDK (Node’s built-in
fetch) uses HTTP/1.1 on Node 24 and older. Use an undiciAgentwithallowH2: trueto opt in. Node 26’sfetchis built on undici 8, which offers HTTP/2 by default.
Good to know
- Up to 100 concurrent requests per connection. This is per connection, not a rate limit. Beyond it, clients either open another connection (Go’s default transport) or wait for a free slot (browsers, and httpx, which also caps itself at 100).
- Realtime WebSockets (
/v1/realtime) use HTTP/1.1. Browsers and the common WebSocket libraries open a separate HTTP/1.1 connection for them automatically. If you build your own TLS config for a WebSocket client, don’t offerh2in its ALPN list: offering it makes Go’sgorilla/websocketfail withwebsocket: protocol "h2" was given but is not supported, usually because itstls.Configis shared with anhttp.Transport. - Streaming, uploads, and request compression work the same over HTTP/2 as over HTTP/1.1.