Metadata-Version: 2.5
Name: geki-apipi
Version: 0.1.0
Summary: ApiPi is a drop-in OpenAI Agents API. Point official clients at this gateway and bring your own model URL.
Project-URL: Homepage, https://github.com/GEKI-AI/apipi
Project-URL: Documentation, https://geki-ai.github.io/apipi/
Project-URL: Repository, https://github.com/GEKI-AI/apipi
Project-URL: Issues, https://github.com/GEKI-AI/apipi/issues
Author: GEKI FlexCo
License: MIT
License-File: LICENSE
Keywords: agents,fastapi,gateway,openai,pi
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Requires-Python: >=3.13
Requires-Dist: alembic<2,>=1.16
Requires-Dist: asyncpg<1,>=0.30
Requires-Dist: fastapi<1,>=0.115
Requires-Dist: httpx<1,>=0.28
Requires-Dist: opentelemetry-api<2,>=1.27
Requires-Dist: opentelemetry-exporter-otlp-proto-http<2,>=1.27
Requires-Dist: opentelemetry-sdk<2,>=1.27
Requires-Dist: prometheus-client<1,>=0.21
Requires-Dist: pydantic-settings<3,>=2.4
Requires-Dist: sqlalchemy[asyncio]<3,>=2.0.40
Requires-Dist: uvicorn[standard]<1,>=0.32
Provides-Extra: s3
Requires-Dist: boto3<2,>=1.35; extra == 's3'
Description-Content-Type: text/markdown

# ApiPi

Documentation: [geki-ai.github.io/apipi](https://geki-ai.github.io/apipi/)

ApiPi is an open-source agent platform. [Pi](https://pi.dev) runs the
agent loop. You host the gateway, keep control of the agents, and point
them at your own LLM endpoints. Clients use an HTTP API compatible with
the [OpenAI Agents API](https://developers.openai.com/api/docs/guides/agents-api).

Production sessions run in [Firecracker](https://firecracker-microvm.github.io/)
microVMs: each guest has its own kernel. The gateway stays on the host.
Pi and the session files share the guest.

[GEKI](https://geki.ai) also runs a managed ApiPi on European
infrastructure.

## Quickstart

Python 3.13 and [uv](https://docs.astral.sh/uv/). Postgres for the
store. The Pi CLI (`pi --mode rpc`) on `PATH` for live turns.

```
pip install geki-apipi
# or: uv add geki-apipi
# S3 artifacts: pip install "geki-apipi[s3]"
npm i -g --ignore-scripts @earendil-works/pi-coding-agent@0.85.1
docker compose up -d postgres
export DATABASE_URL=postgresql+asyncpg://apipi:apipi@localhost:5432/apipi
export OPENAI_BASE_URL=http://your-model-host/v1
apipi migrate
apipi serve
```

From a checkout, `uv sync` then prefix commands with `uv run`. That
binds `0.0.0.0:8000`. The default isolation is `none` (Pi as a child
process). `OPENAI_BASE_URL` on the gateway is the **model** host, not
this API. The client bearer is the model key unless you set
`OPENAI_API_KEY_OVERWRITE`. For Firecracker:

```
APIPI_RUN_MODE=microvm apipi serve
```

In a second shell, point a client at `http://localhost:8000/v1`.
`agent.model` must exist on the model host. The `openai` package is not
an ApiPi dependency:

```
export OPENAI_API_KEY=dev-token
export OPENAI_BASE_URL=http://localhost:8000/v1
uv run --with openai python examples/openai_sdk.py
```

A full script is [examples/openai_sdk.py](examples/openai_sdk.py).
The stream stays open across idle, so that script stops after the first
turn outcome.

## License

MIT. See [LICENSE](LICENSE). Contributions: [CONTRIBUTING.md](CONTRIBUTING.md).
