Metadata-Version: 2.5
Name: republic
Version: 0.6.0a1
Summary: A Python library for AI providers.
Project-URL: Homepage, https://getrepublic.org
Project-URL: Documentation, https://getrepublic.org
Project-URL: Repository, https://github.com/bubbuild/republic
Project-URL: Issues, https://github.com/bubbuild/republic/issues
Author-email: Chojan Shang <psiace@apache.org>, Frost Ming <me@frostming.com>
License-File: LICENSE
Keywords: ai,ai-provider,python
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: <4.0,>=3.11
Requires-Dist: authlib>=1.8
Requires-Dist: filelock>=3.32
Requires-Dist: httpx2>=2.13
Requires-Dist: pydantic>=2.13.5
Provides-Extra: image
Requires-Dist: pillow>=12.3.0; extra == 'image'
Description-Content-Type: text/markdown

# 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.

```sh
python -m pip install republic
export REPUBLIC_OPENAI_API_KEY="your-api-key"
```

```python
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](https://getrepublic.org/providers/) for every supported service.

## Documentation

- [Quickstart](https://getrepublic.org/quickstart/): a first request and a streaming response.
- [Providers](https://getrepublic.org/providers/): services, formats, and credentials.
- [Authentication](https://getrepublic.org/guides/authentication/): API keys, CLI logins, and OAuth.
- Guides: [tool use](https://getrepublic.org/guides/tools/), [a minimal agent](https://getrepublic.org/guides/minimal-agent/), and [structured output](https://getrepublic.org/guides/structured-output/).
- Reference: [configuration](https://getrepublic.org/reference/configuration/) and the [provider API](https://getrepublic.org/reference/provider-api/), including media input, embeddings, decision models, history, and custom providers.

## Development

```sh
uv sync
make check
make test
make build
```

See [Contributing](CONTRIBUTING.md) for the development workflow.

## License

[Apache 2.0](LICENSE).
