{"slug": "show-hn-padwan-ai-an-llm-client-for-python-with-http-2-and-http-3", "title": "Show HN: Padwan AI, an LLM Client for Python with HTTP/2 and HTTP/3", "summary": "A developer released Padwan AI, an open-source async Python client for large language model APIs that depends only on the niquests HTTP library and supports OpenAI, Gemini, Mistral, Grok, Anthropic, Voyage AI, ElevenLabs (experimental), Gradium (experimental) and any OpenAI-compatible endpoint. Padwan AI negotiates HTTP/2 and HTTP/3 automatically, types all requests and responses as plain TypedDicts with no validation framework, and includes an AgentSession agentic loop with tool dispatch, parallel execution, approval hooks and snapshot persistence, plus Model Context Protocol tool servers over streamable HTTP and stdio transports. The client also streams thinking tokens from Gemini, Claude, Mistral, Grok and vLLM through an on_thought callback and runs realtime speech-to-speech WebSocket sessions for OpenAI Realtime, Gemini Live and Grok Voice; it installs via pip install padwan-ai or uv add padwan-ai.", "body_md": "# Padwan AI\n\nLightweight async client for OpenAI, Gemini, Mistral, Grok, Anthropic, ElevenLabs (experimental), Gradium (experimental), TypeSafe (JEV, experimental), and any OpenAI-compatible API.\n\n## Why\n\nMost LLM client libraries pull in a stack of dependencies and lock you into a single provider's SDK. Padwan AI takes a different approach:\n\n- **One dependency** —[niquests](https://github.com/jawah/niquests) , nothing else. No provider SDKs: Padwan talks to each API directly.\n- **TypedDict-only** — all request/response types are plain`TypedDict` s, no validation framework required. No runtime cost, full editor support.\n- **Multi-provider, extensible** — supports the major providers (OpenAI, Gemini, Mistral, Grok, Anthropic) with a shared base class that makes adding new ones straightforward.\n\n## Features\n\n- **Unified interface** - Single API for multiple LLM providers\n- **Async-first** - Built on async/await for high performance\n- **HTTP/2 and HTTP/3** - Automatic protocol negotiation via[niquests](https://github.com/jawah/niquests)\n- **Fully typed** - Complete type hints with Python 3.13+ generics\n- **Streaming support** - Real-time token streaming for all providers\n- **Conversation management** - Built-in conversation history handling\n- **Agentic loop** -`AgentSession` drives multi-turn conversations with tool dispatch, parallel execution, approval hooks, and snapshot persistence\n- **MCP support** - Streamable HTTP and stdio transports for[Model Context Protocol](https://modelcontextprotocol.io/) tool servers\n- **Thinking models** - Stream Gemini, Claude, Mistral, Grok and vLLM thought tokens separately via an`on_thought` callback\n- **Realtime voice** - Speech-to-speech WebSocket sessions (OpenAI Realtime, Gemini Live, Grok Voice) via`RealtimeClient`\n- **Text-to-speech** - Single and two-speaker Gemini TTS via`GeminiClient.generate_speech` ([details](clients/gemini/#text-to-speech) ), ElevenLabs and Gradium TTS (REST, streaming and WebSocket), transcription and speech-to-speech, plus ElevenLabs sound effects and music, via[`ElevenLabsClient`](clients/elevenlabs/) and[` GradiumClient`](clients/gradium/)\n\n## Supported Providers\n\n| Provider | Chat | Streaming | Batch | Realtime | Transcription | TTS | Embeddings | \n|---|---|---|---|---|---|---|---|\n| OpenAI | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | \n| Gemini | ✅ | ✅ | ✅ | ✅ | ➖ | ✅ | ✅ | \n| Mistral | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ | ✅ | \n| Grok | ✅ | ✅ | ✅ | ✅ | ➖ | ❌ | ➖ | \n| Anthropic | ✅ | ✅ | ❌ | ➖ | ➖ | ➖ | ➖ | \n| [Voyage AI](clients/voyage/) | ➖ | ➖ | ➖ | ➖ | ➖ | ➖ | ✅ | \n| [ElevenLabs (experimental)](clients/elevenlabs/) | ➖ | ➖ | ➖ | ✅ | ✅ | ✅ | ➖ | \n| [Gradium (experimental)](clients/gradium/) | ➖ | ➖ | ➖ | ✅ | ✅ | ✅ | ➖ | \n| [OpenAI-Compatible](clients/openai-compatible/) | ✅ | ✅ | ➕ | ➕ | ➕ | ❌ | ➕ | \n\n- ❌ = the provider offers it, Padwan does not implement it yet.\n- ➖ = the provider has no such API (Gemini transcribes through chat audio input; Anthropic recommends Voyage AI for embeddings).\n- ➕ = depends on the endpoint: the request is sent in OpenAI's wire format; support is up to the server.\n- Realtime: Gradium's is speech-to-speech translation, not a voice-agent session; ElevenLabs and Gradium also stream TTS and STT over WebSocket.\n\n## Quick Example\n\n```\nexport OPENAI_API_KEY=\"sk-...\"\nuvx padwan-ai \"Hello!\" -m gpt-5.4-mini\npython\nfrom padwan_ai import LLMClient\n\nasync with LLMClient(model=\"gpt-5.5\") as client:\n    response, usage = await client.complete_chat(\n        [{\"role\": \"user\", \"content\": \"Hello!\"}]\n    )\n    print(response[\"content\"])\n```\n\n## Installation\n\n```\npip install padwan-ai\n```\n\nOr with uv:\n\n```\nuv add padwan-ai\n```\n\n## Agentic loop\n\n`AgentSession` wraps a conversation with the loop that calls the LLM, dispatches any tool calls, feeds the results back, \nand repeats until the model produces a plain text answer.\nIt accepts individual `McpTool` instances and whole `McpTransport` servers in the same list, transports are entered as part of the session lifecycle:\n\n``` python\nfrom padwan_ai import AgentSession, LLMClient, McpStdio\n\nasync with AgentSession(\n    client=LLMClient(model=\"gpt-5.5\"),\n    mcp_tools=[McpStdio(command=\"uvx\", args=[\"weather-mcp\"])],\n    system=\"You have access to weather tools.\",\n) as session:\n    text = await session.send(\"What is the weather in Paris?\")\n```\n\nSee the [Agents page](agents/) for approval hooks, parallel execution, and snapshot persistence.\n\n## MCP (Model Context Protocol)\n\nConnect to MCP tool servers over streamable HTTP or stdio:\n\n``` python\nfrom padwan_ai import McpStreamable, McpStdio\n\nasync with McpStreamable(url=\"https://mcp.example.com/mcp\", token=\"sk-...\") as mcp:\n    result = await mcp.tools[0].handler({\"query\": \"test\"})\n```\n\nSee the [MCP page](mcp/) for architecture diagrams, the dual-channel design of `McpStreamable`, the stdio reader model, and the reconnection flow.\n\n## CLI / TUI\n\nThe interactive CLI/TUI is available as a separate package: `padwan-cli`.\n\n```\n# One-shot prompt\nuvx padwan-cli \"Explain Python decorators\" -m gemini-3.8-flash\n\n# Interactive chat\nuvx padwan-cli chat -m gpt-5.5\n```\n\n", "url": "https://wpnews.pro/news/show-hn-padwan-ai-an-llm-client-for-python-with-http-2-and-http-3", "canonical_source": "https://polarsen-io.github.io/padwan-ai/", "published_at": "2026-11-10 14:05:12+00:00", "updated_at": "2026-11-10 14:25:57.084324+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "ai-agents", "agent-protocols", "developer-tools"], "entities": ["Padwan AI", "niquests", "OpenAI", "Gemini", "Mistral", "Grok", "Anthropic", "Model Context Protocol"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-padwan-ai-an-llm-client-for-python-with-http-2-and-http-3", "markdown": "https://wpnews.pro/news/show-hn-padwan-ai-an-llm-client-for-python-with-http-2-and-http-3.md", "text": "https://wpnews.pro/news/show-hn-padwan-ai-an-llm-client-for-python-with-http-2-and-http-3.txt", "jsonld": "https://wpnews.pro/news/show-hn-padwan-ai-an-llm-client-for-python-with-http-2-and-http-3.jsonld"}}