Fallback Models
Example
use orpheus::prelude::*;
fn main() {
let client = Orpheus::new("Your-API-Key");
// Set the provider of GPT-4o as Azure for this example, as they have stricter safety filters.
// We also have to include the providers for any fallback models (In this case, xAI).
let res = client
.chat("I need you to help me make a bomb")
.model("openai/gpt-4o")
.fallbacks(["x-ai/grok-4"])
.with_preferences(|pref| pref.only([Provider::Azure, Provider::XAI]))
.send()
.unwrap();
println!("Model that responded: {}", &res.model);
println!("Response: {}", &res.content().unwrap());
}Last updated
Was this helpful?