Skip to main content

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

Development

uv sync
make check
make test
make build

See Contributing for the development workflow.

License

Apache 2.0.

Metadata

Release files for republic 0.6.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for republic 0.6.4
File Size Uploaded Provenance Actions
republic-0.6.4.tar.gz 283.0 kB Without provenance Details for republic-0.6.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for republic 0.6.4
File Interpreter ABI Platform Actions
republic-0.6.4-py3-none-any.whl Python 3 none any Details for republic-0.6.4-py3-none-any.whl

Total release size: 370.1 kB

Release files / republic-0.6.4.tar.gz

Download URL republic-0.6.4.tar.gz
Size 283.0 kB
Tags Source
SHA-256 checksum
How to use checksums
316ff6898e1062850d3560e30cb7948bd55e1074d6510f9cbd0e90f42900a247
BLAKE2b-256 checksum
How to use checksums
e3a4ece8e118e06cf117d0e01755310c1c1828cd8a8ab80eba3ca3589fe8a90e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","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.4-py3-none-any.whl

Download URL republic-0.6.4-py3-none-any.whl
Size 87.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7401209a939a8dd78288489a8fd2f9d0cce10b2dcd3cfbdf1f6ad6b675454f0d
BLAKE2b-256 checksum
How to use checksums
a5c0cba66c07272b7e72693a4ec51046a8c6ba24a31f53ceb187d62584cba617
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for republic 0.6.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page