Give your users a choice of agent without rebuilding the app around each backend.
Cavi API Client brings shared run, status and stream contracts to applications using multiple agent runtimes. Build your user experience around those contracts while adapters handle the backend's HTTP, SSE or WebSocket connection.
Your application consumes run IDs, statuses, text, token usage and stream events. The client handles the provider-specific mapping.
- One progress experience. Handle text, tool activity, approvals and terminal events through shared stream contracts.
- Background work that stays identifiable. Retain run IDs for retrieval, bounded observation and explicit cancellation.
- Batches you can collect. Correlate requests by
customIdand handle each item's result. - Features that match the backend. Consult capabilities before offering runtime-specific tools; unsupported operations return structured gaps.
Adapters cover Claude, Codex, AGY, OpenCode, Hermes and OpenClaw. Connect the runtimes and credentials your application uses; models, native tools and persistence stay with their providers. See provider compatibility.
| Your application | Use the client for |
|---|---|
| An assistant with a runtime selector | Shared progress, tool activity, approvals and outcomes |
| A service that starts background jobs | Run tracking, retrieval, bounded waits and cancellation |
| A batch processing pipeline | Request correlation and per-item results |
| A gateway dashboard | Available sessions, models, usage, tasks and workspace access |
- Install the TypeScript or Python SDK.
- Configure the runtime you want to use.
- Follow the first-response guide, then add the workflow your application needs.
Keep credentials in your server configuration. Reuse a client within its credential/configuration scope and dispose of it when its owner shuts down.
- Streaming: render progress and handle terminal events.
- Background requests: retain run identity and bound local waits.
- Owned background runs: authorize retrieval and explicit cancellation in your application.
- Batches: submit work and collect per-item results.
- Run results: turn completed work into a usable answer with completion helpers.
- Errors: handle structured gaps and typed execution failures.
- HTTP integration: expose the workflow through an application endpoint.
Prefer createApiClient for TypeScript applications. Its CapabilityClient returns CapabilityResult<T>. Adapter authors can use the raw RuntimeClient contract.
Migration · Changelog · Architecture · Contributing · Security
Full documentation · Documentation hosting contract
The npm package includes an offline documentation snapshot at docs/api-client/v<documented version>; see the consumer contract.
npm install @cavi-ai/api-clientNode.js 20 or later. The package is ESM, includes TypeScript declarations and has no runtime dependencies. React integration is optional.
TypeScript quickstart · Provider setup
pip install cavi-api-clientPython 3.11 or later. Import the native client from cavi_runtime. HTTPX handles native connections; WebSocket providers have their own optional dependency.

