Crate rainy_sdk

Crate rainy_sdk 

Source
Expand description

§Rainy SDK

The official Rust SDK for the Rainy API by Enosis Labs.

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

use rainy_sdk::RainyClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create client with API key - automatically connects to api.enosislabs.com
    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

// Simplest way to create a client
let client = RainyClient::with_api_key("ra-20250125143052Ab3Cd9Ef2Gh5Ik8Lm4Np7Qr")?;

Re-exports§

pub use auth::AuthConfig;
pub use client::RainyClient;
pub use error::ApiErrorDetails;
pub use error::ApiErrorResponse;
pub use error::RainyError;
pub use error::Result;
pub use retry::retry_with_backoff;
pub use retry::RetryConfig;
pub use reqwest;
pub use serde_json;
pub use models::*;

Modules§

auth
Handles authentication and API key management.
client
The main client for interacting with the Rainy API.
error
Defines error types and result aliases for the SDK.
models
Contains the data models for API requests and responses.
retry
Implements retry logic with exponential backoff.

Constants§

DEFAULT_BASE_URL
The default base URL for the Rainy API.
VERSION
The current version of the Rainy SDK.