Repository navigation
0.6.0a1
Pre-release
Pre-release
Republic 0.6 is a ground-up rewrite. It is now a focused provider library: one async interface over AI services, with gateways, agent loops, and tool execution left to the caller. This is the first pre-release of the new API.
pip install --pre republic==0.6.0a1import republic
model = republic.get_model("openai:gpt-6-sol") # reads REPUBLIC_OPENAI_API_KEY
response = await model.chat("Hello, how are you?")
async with model.stream("Tell me a story", reasoning_effort="high") as stream:
async for event in stream:
if isinstance(event, republic.events.TextDelta):
print(event.chunk, end="")⚠️ Breaking changes
- The 0.5.x API has been removed (#58). Republic no longer wraps
any-llm-sdk; it talks to providers directly overhttpx2. Code written against 0.5.x needs to be ported. See the quickstart and the Provider API reference. - Error classes now live in
republic.errorsrather than at the package top level. - Tool results are
toolmessages built withrepublic.tool(call, *content, is_error=False), replacingToolResult,republic.tool_result(), andassistant(tool_results=...)(#79).
Highlights
- Provider API (#61):
get_model(),get_embedding_model(),get_decision_model(), streaming events, structured output, tool calling, andregister_provider()for custom providers. Each model picks a native API format (responses,messages,gemini,chat, …) and lets you override it withapi_format=. - 17 providers: OpenAI, Anthropic, Google Gemini (alias
gemini), OpenRouter, Azure OpenAI, DeepSeek, MiniMax, Mistral, Moonshot, Together AI, Z.ai, Magpie, Ollama, TypeSafe, Codex, GitHub Copilot, and Grok (#61, #72, #69). - Authentication: OAuth for Codex, GitHub Copilot, and Grok CLI, plus OpenRouter PKCE login (#61, #69, #70).
- Model listing:
Provider.list_models()returnsModelInfoacross all pages (#75). - Reliability (#76): retries with jittered exponential backoff and
Retry-Aftersupport (max_retries,retry_delay,max_retry_delay).headersandrequest_idare exposed on responses, streams, and errors. Truncated streams raiseStreamIncompleteErrorinstead of producing a silently incomplete response. - Connection reuse (#78): each
Providerkeeps a single HTTP client that its models share, withclose()and async context-manager support. - Multimodal input: images, video, and audio (
republic.audio()) parts (#77). Tool results can mix text and media (#79). - Serialization:
Message.to_dict()/Message.from_dict()round-trip messages through JSON (#79). - Ships a
py.typedmarker for downstream type checking.
Documentation
New documentation site at https://getrepublic.org, with a page for each provider plus guides to authentication, tool use, a minimal agent loop, and structured output (#71, #73, #74). The site is now built with Zensical (#80).
Full Changelog: 0.5.8...0.6.0a1