Documentation
¶
Overview ¶
Package codex provides a raw model.Provider for ChatGPT-backed Codex subscription access. It targets a private and volatile wire contract at a fixed trusted endpoint. Applications own login, token refresh, persistence, and credential policy and inject current credentials for each request.
The provider supports SSE, fresh-per-request WebSockets, and WebSocket-first automatic selection with one safe pre-output SSE fallback. It does not read environment variables, Codex CLI state, home-directory files, or keychains, and it does not implement model.TokenCounter.
HTTP and stream response.failed / error codes equal to context_length_exceeded return a non-retryable model.ProviderError with kind context_overflow. This uses the code only and preserves the fixed redacted provider error message.
Index ¶
- type Client
- func (c *Client) Complete(ctx context.Context, request *model.Request) (*model.Response, error)
- func (c *Client) ContextLimits(_ context.Context, req *model.Request) (model.ContextLimits, string, bool)
- func (c *Client) ProviderConfiguration(_ context.Context, req *model.Request) string
- func (c *Client) Stream(ctx context.Context, request *model.Request) (model.Streamer, error)
- type CredentialSource
- type CredentialSourceFunc
- type Credentials
- type Options
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements model.Provider through the private ChatGPT Codex Responses wire contract. It intentionally does not implement model.TokenCounter.
func (*Client) Complete ¶
Complete consumes a Codex stream to literal EOF and returns its terminal response.
func (*Client) ContextLimits ¶
func (c *Client) ContextLimits(_ context.Context, req *model.Request) (model.ContextLimits, string, bool)
ContextLimits resolves the request model and reports table limits, if known.
func (*Client) ProviderConfiguration ¶
ProviderConfiguration identifies the provider route used for this request.
type CredentialSource ¶
type CredentialSource interface {
Credentials(context.Context) (Credentials, error)
}
CredentialSource resolves current Codex credentials for each logical request.
type CredentialSourceFunc ¶
type CredentialSourceFunc func(context.Context) (Credentials, error)
CredentialSourceFunc adapts a function into a CredentialSource.
func (CredentialSourceFunc) Credentials ¶
func (f CredentialSourceFunc) Credentials(ctx context.Context) (Credentials, error)
Credentials resolves credentials through f.
type Credentials ¶
Credentials contains application-owned credentials for one Codex request.
type Options ¶
type Options struct {
CredentialSource CredentialSource
HTTPClient *http.Client
WebSocketDialer *websocket.Dialer
Transport Transport
ClientVersion string
ResponsesLite bool
StreamIdleTimeout time.Duration
// ReasoningEffort selects a provider effort identifier; empty uses the provider default.
ReasoningEffort string
DefaultModel string
HighModel string
SmallModel string
}
Options configures the Codex subscription provider.