Skip to content

Framework direct model calls with Model::complete

Work that is one prompt and one answer no longer needs an agent. Model::complete covers the one-line case, and Model::completion adds system messages, replayed context, per-call controls, streaming and a typed CompletionError.

let model = Model::new("gpt-6.1-sol", OpenAI::from_env()?);
let answer = model.complete("Name the three primary colors.").await?;

Each driver now declares its own credential variables, following the vendor’s SDK, for example GEMINI_API_KEY or GOOGLE_API_KEY, the AWS variables for Bedrock, and LLAMA_API_KEY for Meta. Provider model catalogs are also exposed on the facade crate.

See Direct model calls and Models and providers. #3642, #3668