rainy-sdk 0.6.14

Official Rust SDK for Rainy API by Enosis Labs v0.6.14 - OpenAI/GPT-5 parity, native streaming events, and legacy static model cleanup
Documentation
//! # Rainy SDK
//!
//! The official Rust SDK for the Rainy API by Enosis Labs (v3 service).
//!
//! This SDK provides a clean, idiomatic Rust interface for interacting with
//! the Rainy API, which unifies multiple AI providers under a single API.
//!
//! ## Features
//!
//! - **Idiomatic Rust API**: Clean, type-safe interfaces
//! - **Automatic Authentication**: API key and admin key management
//! - **Rate Limiting**: Built-in rate limit handling
//! - **Error Handling**: Comprehensive error types and handling
//! - **Async Support**: Full async/await support with Tokio
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use rainy_sdk::RainyClient;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//!     // Create client with API key - automatically connects to the Rainy API v3 service
//!     let client = RainyClient::with_api_key("your-api-key")?;
//!
//!     // Check API health
//!     let health = client.health_check().await?;
//!     println!("API Status: {:?}", health.status);
//!
//!     Ok(())
//! }
//! ```
//!
//! ## Authentication
//!
//! The SDK uses API key authentication:
//!
//! ### API Key Authentication
//!
//! ```rust,no_run
//! # use rainy_sdk::RainyClient;
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Simplest way to create a client
//! let client = RainyClient::with_api_key("ra-20250125143052Ab3Cd9Ef2Gh5Ik8Lm4Np7Qr")?;
//! # Ok(())
//! # }
//! ```
//!

/// Handles authentication and API key management.
pub mod auth;
/// The main client for interacting with the Rainy API.
pub mod client;
/// Defines error types and result aliases for the SDK.
pub mod error;
/// Contains the data models for API requests and responses.
pub mod models;
/// Implements retry logic with exponential backoff.
pub mod retry;
/// Web search types and options for Tavily-powered search.
pub mod search;
/// JWT/session client for Rainy API v3 dashboard endpoints.
pub mod session;

mod endpoints;

pub use auth::AuthConfig;
pub use client::RainyClient;
pub use error::{ApiErrorDetails, ApiErrorResponse, RainyError, Result};
pub use models::*;
pub use retry::{retry_with_backoff, RetryConfig};
pub use session::{
    CreatedApiKey, LoginResponse, OrgProfile, RainySessionClient, RefreshResponse,
    SessionApiKeyListItem, SessionConfig, SessionTokens, SessionUser, UsageCreditsResponse,
    UsageStatsResponse,
};

// Re-export Research types for convenience
pub use search::{
    DeepResearchResponse, ResearchApiResponse, ResearchConfig, ResearchResponse, ResearchResult,
    ResearchSource,
};

// Re-export commonly used types
/// Re-export of the `reqwest` crate for convenience.
///
/// This allows users of the SDK to use `reqwest` types without adding it
/// as a direct dependency to their project.
pub use reqwest;
/// Re-export of the `serde_json` crate for convenience.
///
/// This allows users of the SDK to use `serde_json` types for serialization
/// and deserialization without adding it as a direct dependency.
pub use serde_json;

/// The current version of the Rainy SDK.
///
/// This value is read from the `CARGO_PKG_VERSION` environment variable at compile time.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

/// The default base URL for the Rainy API v3 service.
///
/// Note: the v3 service currently exposes its canonical HTTP API under `/api/v1/*`.
pub const DEFAULT_BASE_URL: &str = "https://rainy-api-v3-us-179843975974.us-east4.run.app";