This release is a pre-release and may not be stable for production use.
Republic
One Python interface for chat, streaming, tool calls, and structured output across AI providers. Republic stops at providers; agent loops, tool execution, and gateways stay in your code.
Quickstart
Republic requires Python 3.11 or later.
python -m pip install republic
export REPUBLIC_OPENAI_API_KEY="your-api-key"
import asyncio
import republic
from republic.events import TextDelta
async def main():
model = republic.get_model("openai:gpt-6-sol")
response = await model.chat("Explain a tool call in one sentence.")
print(response.text)
async with model.stream("Explain how an agent uses a tool result.") as stream:
async for event in stream:
if isinstance(event, TextDelta):
print(event.chunk, end="", flush=True)
asyncio.run(main())
A model is named provider:model. Switch services by changing the name, such as anthropic:MODEL_ID, google:MODEL_ID, or deepseek:MODEL_ID; each reads its key from REPUBLIC_<PROVIDER>_API_KEY. See the provider directory for every supported service.
Documentation
- Quickstart: a first request and a streaming response.
- Providers: services, formats, and credentials.
- Authentication: API keys, CLI logins, and OAuth.
- Guides: tool use, a minimal agent, and structured output.
- Reference: configuration and the provider API, including media input, embeddings, decision models, history, and custom providers.
Development
uv sync
make check
make test
make build
See Contributing for the development workflow.
License
Metadata
Release files for republic 0.6.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| republic-0.6.0a1.tar.gz | 227.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| republic-0.6.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 301.9 kB
Release files / republic-0.6.0a1.tar.gz
| Download URL | republic-0.6.0a1.tar.gz |
|---|---|
| Size | 227.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3eb72270bb8f0e52c3fbe66aed37e88edf7b8f31bb3926db508aeb8f71306a93
|
|
BLAKE2b-256 checksum How to use checksums |
02a24c36a93722932d29095c6aca053829d77a5ae1d9a5b2e989e61544d528af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / republic-0.6.0a1-py3-none-any.whl
| Download URL | republic-0.6.0a1-py3-none-any.whl |
|---|---|
| Size | 74.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7970fd013890e7c8b121bdc91f3d7cf93b2fa30605cf4540afb5b790a4a86516
|
|
BLAKE2b-256 checksum How to use checksums |
961ec70546f7ab7947ccb44f305e297fb42924db6fc82ec23ecd9d58ecebd692
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|