pub struct CodexProvider { /* private fields */ }Expand description
OpenAI Codex (Responses API) provider.
Implementations§
Source§impl CodexProvider
impl CodexProvider
Sourcepub fn new(access_token: impl Into<String>) -> Result<Self, ProviderError>
pub fn new(access_token: impl Into<String>) -> Result<Self, ProviderError>
Create a new Codex provider with a JWT access token.
The account ID is automatically extracted from the JWT payload. Returns an error if the token is not a valid Codex JWT.
Sourcepub fn with_account_id(
access_token: impl Into<String>,
account_id: impl Into<String>,
) -> Self
pub fn with_account_id( access_token: impl Into<String>, account_id: impl Into<String>, ) -> Self
Create a provider with explicit token and account ID.
Use this when you have the account ID from another source (e.g., stored separately from the JWT).
Sourcepub fn with_base_url(self, url: impl Into<String>) -> Self
pub fn with_base_url(self, url: impl Into<String>) -> Self
Override the base URL (for testing or custom endpoints).
Default: https://chatgpt.com/backend-api
Trait Implementations§
Source§impl Clone for CodexProvider
impl Clone for CodexProvider
Source§fn clone(&self) -> CodexProvider
fn clone(&self) -> CodexProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Provider for CodexProvider
impl Provider for CodexProvider
Source§fn infer(
&self,
request: InferRequest,
) -> impl Future<Output = Result<InferResponse, ProviderError>> + Send
fn infer( &self, request: InferRequest, ) -> impl Future<Output = Result<InferResponse, ProviderError>> + Send
Run inference using
layer0::context::Message types directly. Read moreSource§impl StreamProvider for CodexProvider
impl StreamProvider for CodexProvider
Source§fn infer_stream(
&self,
request: StreamRequest,
on_event: impl Fn(StreamEvent) + Send + Sync + 'static,
) -> impl Future<Output = Result<InferResponse, ProviderError>> + Send
fn infer_stream( &self, request: StreamRequest, on_event: impl Fn(StreamEvent) + Send + Sync + 'static, ) -> impl Future<Output = Result<InferResponse, ProviderError>> + Send
Run streaming inference. Read more
Auto Trait Implementations§
impl Freeze for CodexProvider
impl !RefUnwindSafe for CodexProvider
impl Send for CodexProvider
impl Sync for CodexProvider
impl Unpin for CodexProvider
impl UnsafeUnpin for CodexProvider
impl !UnwindSafe for CodexProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more