Skip to main content

OpenRouterExt

Struct OpenRouterExt 

Source
pub struct OpenRouterExt;

Trait Implementations§

Source§

impl<H> Capabilities<H> for OpenRouterExt

Source§

type Completion = Capable<GenericCompletionModel<OpenRouterExt, H>>

Completion model capability marker.
Source§

type Embeddings = Capable<GenericEmbeddingModel<OpenRouterExt, H>>

Embedding model capability marker.
Source§

type Transcription = Capable<GenericTranscriptionModel<OpenRouterExt, H>>

Audio transcription model capability marker.
Source§

type ModelListing = Capable<OpenRouterModelLister<H>>

Model listing capability marker.
Source§

type ImageGeneration = Nothing

Available on crate feature image only.
Image generation model capability marker.
Source§

type AudioGeneration = Capable<GenericAudioGenerationModel<OpenRouterExt, H>>

Available on crate feature audio only.
Audio generation model capability marker.
Source§

type Rerank = Nothing

Rerank model capability marker.
Source§

impl Clone for OpenRouterExt

Source§

fn clone(&self) -> OpenRouterExt

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for OpenRouterExt

Source§

impl Debug for OpenRouterExt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl DebugExt for OpenRouterExt

Source§

fn fields(&self) -> impl Iterator<Item = (&'static str, &dyn Debug)>

Additional provider-specific fields to include in Client debug output.
Source§

impl Default for OpenRouterExt

Source§

fn default() -> OpenRouterExt

Returns the “default value” for a type. Read more
Source§

impl OpenAICompatibleProvider for OpenRouterExt

Source§

fn streaming_detail_reasoning( &self, detail: &Value, ) -> Option<(StreamPartId, Option<WireId>, ReasoningContent)>

Encrypted reasoning ({"type":"reasoning.encrypted"}) is the turn’s own output, not tool-call metadata: it arrives with reasoning: null and an rs_* id of its own, which never matches a call_* tool-call id, and it arrives before any tool call opens. Emitting it as a reasoning block matches the non-streaming path (which maps the same detail to message::ReasoningContent::Encrypted) and is what lets the blob reach the aggregated choice and be replayed on the next turn.

Source§

fn streaming_reasoning_signature(&self, detail: &Value) -> Option<String>

Anthropic routes stream the plaintext in delta.reasoning, then send its replay-required signature as a final signature-only reasoning.text detail immediately before the tool call. Feed that authoritative close into the shared lifecycle so the normalized reasoning block is signed just like the blocking response.

Source§

const PROVIDER_NAME: &'static str = self::PROVIDER_NAME

Provider name recorded on gen_ai.provider.name telemetry spans.
Source§

const STREAM_INCLUDE_USAGE: bool = false

Whether streaming requests include "stream_options": {"include_usage": true}. Providers that reject unknown parameters and already report usage on the final chunk set this to false.
Source§

type StreamingUsage = Usage

The usage payload parsed from streaming chunks and carried on the final streaming response. OpenAI’s Usage for most providers; providers with richer usage accounting (e.g. Mistral’s cached-token fallbacks, DeepSeek’s cache hit/miss counters) substitute their own.
Source§

type Response = CompletionResponse

The chat-completions payload this provider returns. Read more
Source§

fn map_streaming_finish_reason( &self, finish_reason: Option<&str>, native_finish_reason: Option<&str>, ) -> Option<FinishReason>

Map a streamed terminal reason for this compatible provider. Read more
Source§

fn build_completion_request( &self, model: String, request: CompletionRequest, options: CompletionModelOptions, ) -> Result<CompletionRequest, CompletionError>

Build the typed chat-completions request. Providers that share the OpenAI transport but need provider-specific message conversion can override this while still using GenericCompletionModel for sending, streaming, error handling, and telemetry.
Source§

fn finalize_request_body_with_options( &self, body: &mut Value, options: CompletionModelOptions, ) -> Result<(), CompletionError>

Adjust the fully serialized request body with model-level options. Providers that do not need model-instance options should override finalize_request_body instead.
Source§

const REQUEST_ID_HEADER: Option<&'static str> = None

Response header carrying the provider’s transport request id, when the provider reports one (OpenAI sends x-request-id). None — the default — means the provider does not report one; the normalized response’s provider_request_id is then None, never an error.
Source§

const EMITS_COMPLETE_SINGLE_CHUNK_TOOL_CALLS: bool = false

Whether the backend can emit a whole tool call (id, name, and complete arguments) in a single streaming chunk, as llama.cpp-based servers do. When true, the shared streaming layer emits such calls as soon as they arrive instead of holding them until the stream ends.
Source§

const SUPPORTS_TOOLS: bool = true

Whether the provider supports tool calling. When false, tools and tool_choice are dropped with a warning during request conversion — before tool-choice validation, so unsupported tool configurations never error client-side on a provider that ignores tools anyway.
Source§

const SUPPORTS_RESPONSE_FORMAT: bool = true

Whether output_schema maps to OpenAI’s response_format. Providers whose APIs reject json_schema response formats set this to false; the schema is then dropped with a warning instead of being sent.
Source§

fn requires_modern_output_cap(&self, model: &str) -> bool

Whether model’s endpoint rejects the legacy max_tokens field and requires max_completion_tokens instead. Read more
Source§

fn completion_path(&self, model: &str) -> String

The request path for chat completions, resolved against the client base URL by Provider::build_uri. Providers that route the model through the URL (e.g. Azure deployment paths) or keep other capabilities on differently-versioned paths override this. model is the identifier the completion model handle was created with; per-request model overrides only affect the body.
Source§

fn prepare_request( &self, request: &mut CompletionRequest, ) -> Result<(), CompletionError>

Adjust the typed request before serialization (e.g. rewrite the model identifier or fold provider-native tool definitions out of additional_params).
Source§

fn finalize_request_body(&self, body: &mut Value) -> Result<(), CompletionError>

Adjust the fully serialized request body — after any streaming parameters are merged — immediately before it is sent. This is where wire-level dialect differences live (e.g. Mistral’s "any" tool choice, DeepSeek’s string-flattened message content).
Source§

fn decorate_streaming_tool_call( &self, detail: &Value, ) -> Option<ToolCallDecoration>

Decorate a streamed tool call from a provider-specific streaming detail payload, matched by its established provider id. Most OpenAI-compatible providers do not emit such details. Read more
Source§

impl Provider for OpenRouterExt

Source§

const VERIFY_PATH: &'static str = "/key"

Provider endpoint used by VerifyClient to validate credentials.
Source§

type Builder = OpenRouterExtBuilder

The builder type that constructs this provider extension. This associates extensions with their builders for type inference.
Source§

fn build_uri(&self, base_url: &str, path: &str, _transport: Transport) -> String

Build a complete request URI for the given base URL, provider path, and transport.
Source§

fn with_custom(&self, req: Builder) -> Result<Builder, Error>

Apply provider-specific request customization before sending.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneDebuggableStorage for T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CloneableStorage for T
where T: Any + Send + Sync + Clone,

Source§

impl<T> DebuggableStorage for T
where T: Any + Send + Sync + Debug,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more