chipp
Rust client for the Chipp.ai API - OpenAI-compatible chat completions with streaming support.
Features
- ✅ Non-streaming chat: Simple request/response with
chat() - ✅ Streaming chat: Real-time text streaming with
chat_stream() - ✅ Session management: Automatic
chatSessionIdtracking for conversation continuity - ✅ Configurable timeouts: Per-request timeout configuration
- ✅ Correlation IDs: Automatic UUID generation for request tracing
- ✅ Comprehensive error handling: Typed errors with context
- ✅ Full async/await: Built on
tokioandreqwest - ✅ Production-ready: Comprehensive tests and documentation
Installation
Add this to your Cargo.toml:
[]
= "0.1"
= { = "1", = ["full"] }
Quick Start
use ;
use Duration;
async
Examples
Non-Streaming Chat
use ;
let client = new?;
let mut session = new;
let messages = vec!;
let response = client.chat.await?;
println!;
Streaming Chat
use ;
use StreamExt;
let mut stream = client.chat_stream.await?;
while let Some = stream.next.await
Session Continuity
The client automatically manages chatSessionId for conversation continuity:
// First message
let messages1 = vec!;
client.chat.await?;
// Second message (remembers context)
let messages2 = vec!;
let response = client.chat.await?;
// Response will mention "42"
Running Examples
Set your API credentials:
Run the examples:
# Simple non-streaming example
# Streaming example
# Session continuity example
# Error handling example (demonstrates retry logic, fallback strategies, etc.)
Configuration
Error Handling
use ChippClientError;
match client.chat.await
Important Notes
Streaming Format
⚠️ The actual Chipp API streaming format differs from the official documentation!
- Documentation shows: Standard SSE with
data:prefix and OpenAI-compatible JSON chunks - Actual API returns: Custom format with prefixes like
0:,e:,d:,f:,8:
This client handles the actual format automatically - you don't need to worry about the format differences.
Testing
Unit Tests
Integration Tests (requires API key)
Documentation
Full API documentation is available on docs.rs.
Build documentation locally:
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
-
Clone the repository:
-
Run tests:
-
Run examples:
Code Quality
Before submitting a PR, please ensure:
# Format code
# Run clippy
# Run tests
# Build docs
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Contributions are welcome! Please see CONTRIBUTING.md for guidelines on:
- Setting up pre-commit hooks
- Code quality standards
- Testing requirements
- Pull request process
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Links
- Chipp.ai - Official website
- Chipp API Documentation - API reference