1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! OpenRouter model identifiers.
//!
//! [`from_env`] and [`new`] build a client on the [`OPENROUTER`](crate::providers::openai::wire::OPENROUTER) dialect.
//! Routing preferences, model fallbacks and the reply's cost are typed in
//! [`extension`].
//!
//! ```no_run
//! use rig_core::completion::CompletionRequest;
//! use rig_core::providers::openrouter;
//! use rig_core::providers::openrouter::extension::{
//! OpenRouterOptions, ProviderPreferences, ProviderSortStrategy,
//! };
//!
//! # fn run() -> Result<(), Box<dyn std::error::Error>> {
//! let sonar = openrouter::from_env()?.chat(openrouter::PERPLEXITY_SONAR_PRO);
//!
//! let routing = OpenRouterOptions::new()
//! .provider(ProviderPreferences::new().sort(ProviderSortStrategy::Price));
//! let request = CompletionRequest::new("What is Rig?")
//! .provider_option(routing);
//! # let _ = (sonar, request);
//! # Ok(())
//! # }
//! ```
pub use ;
pub use *;
pub use ;
/// The provider key: the dialect name, a reply's `Origin::provider` and
/// the typed provider-options key.
pub const PROVIDER_NAME: &str = "openrouter";
crateopenai_vendor!;