Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
AuthProfile
Defined in the failover module.
Rust AI Agent SDK
Authentication profile for an LLM provider.
Fields
| Name | Type | Description |
|---|
name | String | Profile name for identification |
provider | String | Provider name (openai, anthropic, google, etc.) |
api_key | String | API key for authentication |
base_url | Option<String> | Optional base URL override |
model | Option<String> | Default model for this profile |
priority | i32 | Priority for failover (lower = higher priority) |
rate_limit_rpm | Option<u32> | Requests per minute limit |
rate_limit_tpm | Option<u32> | Tokens per minute limit |
status | ProviderStatus | Current status |
last_error | Option<String> | Last error message |
last_error_time | Option<Instant> | Last error timestamp |
cooldown_until | Option<Instant> | Cooldown until timestamp |
metadata | HashMap<String | Additional provider-specific configuration |
Methods
new
fn new(name: impl Into<String>, provider: impl Into<String>, api_key: impl Into<String>) -> Self
Create a new auth profile.
Parameters:
| Name | Type |
|---|
name | impl Into<String> |
provider | impl Into<String> |
api_key | impl Into<String> |
base_url
fn base_url(mut self, url: impl Into<String>) -> Self
Set base URL
Parameters:
| Name | Type |
|---|
url | impl Into<String> |
model
fn model(mut self, model: impl Into<String>) -> Self
Set default model
Parameters:
| Name | Type |
|---|
model | impl Into<String> |
priority
fn priority(mut self, priority: i32) -> Self
Set priority (lower = higher priority)
Parameters:
rate_limit_rpm
fn rate_limit_rpm(mut self, rpm: u32) -> Self
Set rate limit (requests per minute)
Parameters:
rate_limit_tpm
fn rate_limit_tpm(mut self, tpm: u32) -> Self
Set rate limit (tokens per minute)
Parameters:
fn metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> Self
Add metadata
Parameters:
| Name | Type |
|---|
key | impl Into<String> |
value | impl Into<String> |
is_available
fn is_available(&self) -> bool
Check if this profile is currently available.
mark_rate_limited
fn mark_rate_limited(&mut self, cooldown: Duration) -> ()
Mark this profile as rate limited.
Parameters:
mark_error
fn mark_error(&mut self, error: impl Into<String>, cooldown: Duration) -> ()
Mark this profile as having an error.
Parameters:
| Name | Type |
|---|
error | impl Into<String> |
cooldown | Duration |
reset
fn reset(&mut self) -> ()
Reset this profile to available status.
Source
View on GitHub
praisonai/src/failover/mod.rs at line 59