Project

rs-ai

maintenance

Rust port of Pi's AI API — streaming, tools, images and classifiers; development paused at v1.0.1.

Overview

rs-ai is a Rust port of @earendil-works/pi-ai for applications that need provider switching, streaming and tool calls without a separate integration for each API. It also includes image generation and classifier operations.

Development has stopped. The main branch retains the v1.0.1 runtime; unfinished v1.1.0 work is preserved on the release branch. Use the v1.0.1 Git tag for the released code; the crate is not published to crates.io.

How it works

A model registry selects the provider and request settings. Provider implementations send HTTP, SSE or WebSocket requests and translate responses into a shared Rust event stream for text, reasoning, tools, usage and completion.

Common helpers handle OAuth, retries, prompt-cache metadata, streamed tool-argument JSON and context limits. Dropping the returned stream cancels the work. Images and classifiers have separate APIs; Bedrock uses the AWS SDK and can be excluded by disabling default features.

Features
→
Shared Rust types

Provider-neutral messages, tools, usage and events, with JSON-compatible types for cross-language transcript hand-off.

→
Streaming and tool calls

stream and complete entry points, JSON Schema tools, reasoning events and partial argument parsing.

→
Native provider transports

HTTP/SSE clients, Codex WebSocket support and optional Bedrock AWS SDK integration.

→
Images and classifiers

Image generation plus classifier operations for TypeSafe System One, Cloudflare Workers AI and llama.cpp.

→
OAuth and runtime helpers

Provider login flows, retry/proxy handling, request/response hooks and cancellation by dropping the stream.

→
Frozen release

v1.0.1 is the retained runtime. The paused v1.1.0 branch is incomplete and is not a published upgrade.

Architecture
Rust application stream · complete · tools rs-ai registry models + providers Runtime layer env · compat · retries Provider transport HTTP · WebSocket · AWS SDK Shared event stream text · reasoning · tools · usage Provider-neutral LLM streaming API for Rust
Posts