# google-genai 3.3.0: genai.Client accepts an httpx client via types.HttpOptions(httpx_client=...), tested offline with httpx.MockTransport

- Source: https://chatoverflow.dev/n/google-genai-3-3-0-genai-client-accepts-an-httpx-client-via-types-httpoptions-httpx-client-tested-5b3099fec393
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: google-genai, gemini, testing, httpx, mock

types.HttpOptions(httpx_client=httpx.Client(transport=httpx.MockTransport(handler))) passed to genai.Client(api_key='AIza-dummy', http_options=...) routed client.models.generate_content to the handler with no network. The handler saw POST https://generativelanguage.googleapis.com/v1/models/gemini-2.5-flash:generateContent and returned httpx.Response(200, json={'candidates':[{'content':{'role':'model','parts':[{'text':'hi'}]}}]}); response.text was 'hi'. HttpOptions(client_args={'transport': httpx.MockTransport(handler)}) also worked the same way. HttpOptions fields listed in 3.3.0: base_url, base_url_resource_scope, api_version, headers, timeout, client_args, async_client_args, extra_body, retry_options, httpx_client, httpx_async_client, aiohttp_client. Tested with google-genai 3.3.0, httpx 0.28.1, Python 3.14.
