Skip to main content

ModelsClient

The ModelsClient struct provides methods to discover available models and check their operational status.
pub struct ModelsClient {
    client: reqwest::Client,
    cookies: String,
    _convex_session_id: String,
}

Constructor

new()

Create a new ModelsClient instance.
pub fn new(cookies: String, convex_session_id: String) -> Self
cookies
String
required
Cookie header string for authenticating requests to t3.chat
convex_session_id
String
required
Session ID for Convex authentication
Returns: Self - A new ModelsClient instance

Methods

get_model_statuses()

Fetch the operational status of all available models. This method dynamically discovers models from the t3.chat website and returns their current status.
pub async fn get_model_statuses(
    &self
) -> Result<Vec<ModelStatus>, Box<dyn std::error::Error>>
Returns: Result<Vec<ModelStatus>, Box<dyn std::error::Error>>
Ok(Vec<ModelStatus>)
Vec<ModelStatus>
A vector of ModelStatus objects containing information about each model
Err
Box<dyn std::error::Error>
An error if the request fails or model discovery encounters issues

Data Structures

ModelStatus

Represents the operational status of a model.
#[derive(Debug, Clone)]
pub struct ModelStatus {
    pub name: String,
    pub indicator: String,
    pub description: String,
}
name
String
The model ID (e.g., “claude-3.7”, “gpt-4o”)
indicator
String
The operational status indicator (typically “operational”)
description
String
A short description of the model’s capabilities

ModelInfo

Detailed information about a model, including provider details and capabilities.
#[derive(Debug, Clone)]
pub struct ModelInfo {
    pub id: String,
    pub name: String,
    pub provider: String,
    pub developer: String,
    pub short_description: String,
    pub full_description: String,
    pub requires_pro: bool,
    pub premium: bool,
}
id
String
The unique model identifier
name
String
The display name of the model
provider
String
The service provider (e.g., “Anthropic”, “OpenAI”)
developer
String
The company or organization that developed the model
short_description
String
A brief description of the model
full_description
String
A detailed description of the model’s capabilities (may be empty)
requires_pro
bool
Whether the model requires a pro subscription
premium
bool
Whether the model is a premium offering

Example Usage

Discover Available Models

use t3router::t3::models::ModelsClient;
use dotenv::dotenv;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    dotenv().ok();
    
    let cookies = std::env::var("COOKIES")?;
    let session_id = std::env::var("CONVEX_SESSION_ID")?;
    
    let models_client = ModelsClient::new(cookies, session_id);
    let models = models_client.get_model_statuses().await?;
    
    println!("Found {} models:", models.len());
    for model in &models[..5] {
        println!("  {} - {}", model.name, model.description);
    }
    
    Ok(())
}

Check Specific Model

let models_client = ModelsClient::new(cookies, session_id);
let models = models_client.get_model_statuses().await?;

if let Some(claude) = models.iter().find(|m| m.name == "claude-3.7") {
    println!("Claude 3.7 is {}: {}", claude.indicator, claude.description);
}

Notes

  • The get_model_statuses() method dynamically discovers models from t3.chat’s website
  • If dynamic discovery fails, it falls back to a hardcoded list of known models
  • Model availability may change over time as t3.chat adds or removes models
  • Use this client to check which models are currently available before sending chat requests

Build docs developers (and LLMs) love