Expand description
Process-wide shared reqwest::Client.
Each call to reqwest::Client::new loads the system TLS root store
(hundreds of certs), builds a fresh TLS config, and allocates a new
connection pool. Across ~10 providers that’s hundreds of milliseconds
of startup cost on first use plus duplicated pools that cannot share
keep-alive connections.
shared_client returns a single Client that every provider which
does not need custom builder options can clone (the Client is
internally reference-counted, so clones are O(1) and share the
underlying connection pool).
Providers that need custom timeouts, proxies, or TLS settings
(openai, vertex_*, gemini_web, openrouter) continue to use
Client::builder() directly — those configurations cannot be
meaningfully shared anyway.
Functions§
- shared_
client - Return a handle to the process-wide shared
reqwest::Client.