Skip to main content
The Config struct allows you to customize how models process your requests. This example demonstrates all available configuration options and their effects.

Configuration Options

T3Router provides two main configuration parameters:
Enable web search capabilities for the model. When enabled, the model can search the internet for up-to-date information.
reasoning_effort
ReasoningEffort
default:"Low"
Control how much computational effort the model uses for reasoning. Options:
  • ReasoningEffort::Low - Fast responses, less detailed reasoning
  • ReasoningEffort::Medium - Balanced performance and quality
  • ReasoningEffort::High - Slower but more thorough reasoning

Complete Example

use dotenv::dotenv;
use t3router::t3::{
    client::Client,
    config::{Config, ReasoningEffort},
    message::{Message, Type},
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    dotenv().ok();

    let cookies = std::env::var("COOKIES").expect("COOKIES not set");
    let convex_session_id = std::env::var("CONVEX_SESSION_ID")
        .expect("CONVEX_SESSION_ID not set");

    let mut client = Client::new(cookies, convex_session_id);
    client.init().await?;

    // Example 1: Default configuration
    println!("=== Default Config ===");
    let default_config = Config::new();
    println!("Search enabled: {}", default_config.include_search);
    println!("Reasoning effort: {}\n", default_config.reasoning_effort.as_str());

    let response1 = client
        .send(
            "gemini-2.5-flash-lite",
            Some(Message::new(
                Type::User,
                "What is 2 + 2?".to_string(),
            )),
            Some(default_config),
        )
        .await?;
    println!("Response: {}\n", response1.content);

    // Example 2: Enable search
    println!("=== With Search Enabled ===");
    let mut search_config = Config::new();
    search_config.include_search = true;

    client.new_conversation();
    let response2 = client
        .send(
            "gemini-2.5-flash-lite",
            Some(Message::new(
                Type::User,
                "What are the latest developments in quantum computing?".to_string(),
            )),
            Some(search_config),
        )
        .await?;
    println!("Response: {}\n", response2.content);

    // Example 3: High reasoning effort
    println!("=== High Reasoning Effort ===");
    let mut reasoning_config = Config::new();
    reasoning_config.reasoning_effort = ReasoningEffort::High;

    client.new_conversation();
    let response3 = client
        .send(
            "gemini-2.5-flash-lite",
            Some(Message::new(
                Type::User,
                "Explain the philosophical implications of Gödel's incompleteness theorems".to_string(),
            )),
            Some(reasoning_config),
        )
        .await?;
    println!("Response: {}\n", response3.content);

    // Example 4: Combined configuration
    println!("=== Search + High Reasoning ===");
    let mut combined_config = Config::new();
    combined_config.include_search = true;
    combined_config.reasoning_effort = ReasoningEffort::High;

    client.new_conversation();
    let response4 = client
        .send(
            "gemini-2.5-flash-lite",
            Some(Message::new(
                Type::User,
                "Compare recent advances in fusion energy with current climate goals".to_string(),
            )),
            Some(combined_config),
        )
        .await?;
    println!("Response: {}", response4.content);

    Ok(())
}

Creating Configurations

Default Configuration

let config = Config::new();
// include_search: false
// reasoning_effort: Low
The default configuration provides fast responses without web search.
let mut config = Config::new();
config.include_search = true;
Use this when you need current information or facts that might not be in the model’s training data:
  • Current events and news
  • Recent research or developments
  • Real-time data (weather, stock prices, etc.)
  • Verification of facts

Adjust Reasoning Effort

let mut config = Config::new();
config.reasoning_effort = ReasoningEffort::High;
Higher reasoning effort is useful for:
  • Complex problem-solving
  • Mathematical proofs
  • Detailed analysis
  • Multi-step reasoning tasks

Combined Configuration

let mut config = Config::new();
config.include_search = true;
config.reasoning_effort = ReasoningEffort::Medium;
Combine options for tasks requiring both current information and careful reasoning.

Reasoning Effort Levels

config.reasoning_effort = ReasoningEffort::Low;
Best for:
  • Simple questions
  • Quick responses
  • High throughput applications
  • Straightforward tasks
Characteristics:
  • Fastest response time
  • Lower computational cost
  • Direct, concise answers

Expected Output

=== Default Config ===
Search enabled: false
Reasoning effort: low

Response: 2 + 2 equals 4.

=== With Search Enabled ===
Response: Recent developments in quantum computing include...
[searches web for current information]

=== High Reasoning Effort ===
Response: Gödel's incompleteness theorems have profound implications...
[provides detailed, thorough analysis]

=== Search + High Reasoning ===
Response: Recent advances in fusion energy...
[combines web search with detailed reasoning]

Configuration Best Practices

Use Low for:
  • Simple factual questions
  • Quick translations
  • Basic formatting tasks
  • High-volume requests
Use Medium for:
  • General conversation
  • Moderate complexity tasks
  • Most production applications
  • Balanced quality/speed needs
Use High for:
  • Complex mathematical problems
  • Detailed analysis or research
  • Multi-step logical reasoning
  • When quality matters more than speed
You can clone and reuse configurations:
let base_config = Config::new();

// Use the same config for multiple requests
let response1 = client.send(model, msg1, Some(base_config.clone())).await?;
let response2 = client.send(model, msg2, Some(base_config.clone())).await?;

// Or modify for specific needs
let mut special_config = base_config.clone();
special_config.include_search = true;
Config implements Clone, making it easy to reuse and modify.
Start with default configuration and only adjust when you notice specific needs. Most applications work well with Config::new().
Configuration is passed per-request, not per-client. This allows you to use different settings for different messages in the same conversation.
High reasoning effort and search both increase response time and computational cost. Use them only when necessary.

Next Steps

Build docs developers (and LLMs) love