> ## 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.

# LLM Config • Rust AI Agent SDK

> LlmConfig: LLM configuration

# LlmConfig

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

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

LLM configuration

## Fields

| Name          | Type                   | Description                                         |
| ------------- | ---------------------- | --------------------------------------------------- |
| `model`       | `String`               | Model name (e.g., "gpt-4o-mini", "claude-3-sonnet") |
| `Option`      | `:is_none")]`          | API key (optional, can use env var)                 |
| `api_key`     | `Option&lt;String&gt;` | API key (optional, can use env var)                 |
| `Option`      | `:is_none")]`          | Base URL (optional, for custom endpoints)           |
| `base_url`    | `Option&lt;String&gt;` | Base URL (optional, for custom endpoints)           |
| `temperature` | `f32`                  | Temperature (0.0 - 2.0)                             |
| `Option`      | `:is_none")]`          | Max tokens                                          |
| `max_tokens`  | `Option&lt;u32&gt;`    | Max tokens                                          |

## Methods

### `new`

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

Create a new LLM config with the given model

**Parameters:**

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

### `api_key`

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

Set the API key

**Parameters:**

| Name  | Type                      |
| ----- | ------------------------- |
| `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 the base URL

**Parameters:**

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

### `temperature`

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

Set the temperature

**Parameters:**

| Name   | Type  |
| ------ | ----- |
| `temp` | `f32` |

### `max_tokens`

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

Set max tokens

**Parameters:**

| Name  | Type  |
| ----- | ----- |
| `max` | `u32` |

## Source

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

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust LLM" icon="microchip" href="/docs/rust/llm" />

  <Card title="Rust Providers" icon="server" href="/docs/rust/providers" />

  <Card title="Rust Failover" icon="shield" href="/docs/rust/failover" />

  <Card title="Rust Configuration" icon="gear" href="/docs/rust/configuration" />

  <Card title="Rust Installation" icon="download" href="/docs/rust/installation" />
</CardGroup>
