githubEdit

arrows-repeatSwitching Models

OpenRouter enables access to over 100 models by simply changing the model ID.

You can head over to the Modelsarrow-up-right page to check out the full list. For any model, press the model ID button next to its name. This will copy the model ID into your clipboard, then you can paste the model ID into your code.

multiple_models.rs
use orpheus::prelude::*;

fn main() -> anyhow::Result<()> {
    let client = Orpheus::new("Your-API-Key");

    let prompt = "Who are you?";

    let models = [
        "anthropic/claude-3.5-haiku".to_string(),
        "openai/chatgpt-4o-latest".into(),
        "moonshotai/kimi-k2".into(),
    ];

    for model in models.into_iter() {
        let res = client.chat(prompt).model(&model).send()?;
        println!("{}: {}\n", model, res.content()?);
    }

    Ok(())
}

Last updated

Was this helpful?