Skip to content

0.6.0a1

Pre-release
Pre-release

Choose a tag to compare

@frostming frostming released this 10 Oct 03:59
f8efd0c

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.0a1
import 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 over httpx2. Code written against 0.5.x needs to be ported. See the quickstart and the Provider API reference.
  • Error classes now live in republic.errors rather than at the package top level.
  • Tool results are tool messages built with republic.tool(call, *content, is_error=False), replacing ToolResult, republic.tool_result(), and assistant(tool_results=...) (#79).

Highlights

  • Provider API (#61): get_model(), get_embedding_model(), get_decision_model(), streaming events, structured output, tool calling, and register_provider() for custom providers. Each model picks a native API format (responses, messages, gemini, chat, …) and lets you override it with api_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() returns ModelInfo across all pages (#75).
  • Reliability (#76): retries with jittered exponential backoff and Retry-After support (max_retries, retry_delay, max_retry_delay). headers and request_id are exposed on responses, streams, and errors. Truncated streams raise StreamIncompleteError instead of producing a silently incomplete response.
  • Connection reuse (#78): each Provider keeps a single HTTP client that its models share, with close() 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.typed marker 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