pub struct ExecRequest {Show 18 fields
pub operation: Operation,
pub source_format: Format,
pub response_format: Format,
pub requested_model: String,
pub model: String,
pub original_body: Bytes,
pub body: Bytes,
pub stream: bool,
pub stream_payloads: bool,
pub alt: Option<String>,
pub session: Option<String>,
pub execution_session: Option<String>,
pub derived_session: Option<String>,
pub request_path: String,
pub headers: HeaderMap,
pub caller: Caller,
pub resolved_model: Option<ResolvedModel>,
pub usage: UsageSink,
}Fields§
§operation: Operation§source_format: FormatFormat of the inbound request.
response_format: FormatFormat the client expects back.
requested_model: StringModel named by the client, trimmed.
model: StringModel after alias resolution, sent upstream.
original_body: BytesInbound body exactly as received.
body: BytesBody in source_format, after request-level rewrites (payload rules) but before
any translation. The executor translates it.
stream: boolThe client asked for a stream. The upstream mode is the executor’s decision.
stream_payloads: boolReturn Go executor chunks before HTTP framing, for internal model callbacks. Captured when preparing the attempt, independent of plugin interceptor lifetime.
alt: Option<String>Alternate operation from alt / $alt (for example responses/compact).
session: Option<String>Session key for affinity and provider session identity, when one was derived:
Go ExtractSessionID (see cpa_common::session). Explicit client sessions carry
their family prefix (claude:, codex:, header:, pck:, …); derived:<id>
means Go’s derived_session_id metadata is <id>; msg: is the first-messages
hash.
execution_session: Option<String>Go execution_session_id metadata: a long-lived execution session that outlives
one HTTP request. Set only by transports that own such a session (the Responses
WebSocket uses its connection’s session ID); None for ordinary HTTP routes.
Provider replay caches (Codex and Kimi reasoning replay) key on
execution:<id> before falling back to payload or header identity.
derived_session: Option<String>Go derived_session_id metadata (ctx:v1:<sha256>, from
cpa_common::session::derive_id): set only when the request carries no explicit
session signal and no execution session, exactly when Go’s session.Enrich sets
it. Go helps.ProviderSessionUUID falls back to it after the execution session.
request_path: StringGo request_path metadata (gin FullPath()): the matched route template, for
example /v1/chat/completions or /v1beta/models/*action; the URI path when no
route matched; empty for internal executions. Pass it to
cpa_common::payload::Request::request_path (the disable-image-generation: chat
gate keeps image generation on /v1/images/*).
headers: HeaderMapInbound headers. Executors forward only what their provider profile allows. Contains client credentials: never log or forward wholesale.
caller: Caller§resolved_model: Option<ResolvedModel>Go cliproxyauth.ResolvedModelInfo(req): the model capabilities the dispatch
loop bound to this attempt for the selected credential and upstream model (Go
attachResolvedExecutionModelInfo, sdk/cliproxy/auth/api_key_model_capabilities.go).
None when Go binds nothing; executors then fall back to the registry lookup
(cpa_core::registry::lookup_model), as Go’s helpers do. Callers outside the
dispatch loop set None.
usage: UsageSinkUsage accounting for this attempt (Go’s per-executor UsageReporter). Optional:
without reports the server parses the client-format response, which matches Go
whenever the upstream speaks the client’s format. Executors that translate
should forward the upstream payloads Go parses; UsageSink::default() is a
no-op.
Implementations§
Source§impl ExecRequest
impl ExecRequest
Sourcepub fn capture(&self) -> &CaptureSink
pub fn capture(&self) -> &CaptureSink
Optional per-call wire capture, independent of usage accounting. Capture the handle before spawning a stream task; clones retain the same observer.
Sourcepub fn websocket_emitter(
&self,
provider: &'static str,
credential: &Credential,
) -> Option<WebSocketEmitter>
pub fn websocket_emitter( &self, provider: &'static str, credential: &Credential, ) -> Option<WebSocketEmitter>
The attempt’s WebSocket response observer bound to the executor provider, the
selected credential and this request’s upstream model; None without one.