pub async fn try_route(
model: &str,
client: &Client,
tools_schema: &Arc<Vec<Value>>,
system_prompt: &Option<String>,
messages: &[Value],
tx: &UnboundedSender<StreamEvent>,
temperature: Option<f32>,
max_tokens: Option<u32>,
thinking_budget: u32,
cancel: &CancellationToken,
) -> Option<Result<Value, Box<dyn Error + Send + Sync>>>Expand description
Try to route a request through an OpenAI-compatible provider.
Returns Some(Ok(value)) if the model resolved to an OpenAI provider and the
request completed (successfully or with error). Returns None if the model
should be handled by the Anthropic path.
This is the single routing entry point — both streaming and non-streaming
callers in api.rs use this instead of duplicating the routing logic.