> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Auth Profile • Rust AI Agent SDK

> AuthProfile: Authentication profile for an LLM provider.

# AuthProfile

> Defined in the [**failover**](../modules/failover) module.

<Badge color="orange">Rust AI Agent SDK</Badge>

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&lt;String&gt;`  | Optional base URL override                      |
| `model`           | `Option&lt;String&gt;`  | Default model for this profile                  |
| `priority`        | `i32`                   | Priority for failover (lower = higher priority) |
| `rate_limit_rpm`  | `Option&lt;u32&gt;`     | Requests per minute limit                       |
| `rate_limit_tpm`  | `Option&lt;u32&gt;`     | Tokens per minute limit                         |
| `status`          | `ProviderStatus`        | Current status                                  |
| `last_error`      | `Option&lt;String&gt;`  | Last error message                              |
| `last_error_time` | `Option&lt;Instant&gt;` | Last error timestamp                            |
| `cooldown_until`  | `Option&lt;Instant&gt;` | Cooldown until timestamp                        |
| `metadata`        | `HashMap&lt;String`     | Additional provider-specific configuration      |

## Methods

### `new`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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&lt;String&gt;` |
| `provider` | `impl Into&lt;String&gt;` |
| `api_key`  | `impl Into&lt;String&gt;` |

### `base_url`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn base_url(mut self, url: impl Into<String>) -> Self
```

Set base URL

**Parameters:**

| Name  | Type                      |
| ----- | ------------------------- |
| `url` | `impl Into&lt;String&gt;` |

### `model`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn model(mut self, model: impl Into<String>) -> Self
```

Set default model

**Parameters:**

| Name    | Type                      |
| ------- | ------------------------- |
| `model` | `impl Into&lt;String&gt;` |

### `priority`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn priority(mut self, priority: i32) -> Self
```

Set priority (lower = higher priority)

**Parameters:**

| Name       | Type  |
| ---------- | ----- |
| `priority` | `i32` |

### `rate_limit_rpm`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn rate_limit_rpm(mut self, rpm: u32) -> Self
```

Set rate limit (requests per minute)

**Parameters:**

| Name  | Type  |
| ----- | ----- |
| `rpm` | `u32` |

### `rate_limit_tpm`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn rate_limit_tpm(mut self, tpm: u32) -> Self
```

Set rate limit (tokens per minute)

**Parameters:**

| Name  | Type  |
| ----- | ----- |
| `tpm` | `u32` |

### `metadata`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> Self
```

Add metadata

**Parameters:**

| Name    | Type                      |
| ------- | ------------------------- |
| `key`   | `impl Into&lt;String&gt;` |
| `value` | `impl Into&lt;String&gt;` |

### `is_available`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn is_available(&self) -> bool
```

Check if this profile is currently available.

### `mark_rate_limited`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn mark_rate_limited(&mut self, cooldown: Duration) -> ()
```

Mark this profile as rate limited.

**Parameters:**

| Name       | Type       |
| ---------- | ---------- |
| `cooldown` | `Duration` |

### `mark_error`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn mark_error(&mut self, error: impl Into<String>, cooldown: Duration) -> ()
```

Mark this profile as having an error.

**Parameters:**

| Name       | Type                      |
| ---------- | ------------------------- |
| `error`    | `impl Into&lt;String&gt;` |
| `cooldown` | `Duration`                |

### `reset`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn reset(&mut self) -> ()
```

Reset this profile to available status.

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/failover/mod.rs#L59">
  `praisonai/src/failover/mod.rs` at line 59
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Files" icon="file" href="/docs/rust/files" />

  <Card title="Rust Documents" icon="file-lines" href="/docs/rust/documents" />
</CardGroup>
