Documentation
¶
Overview ¶
Package codex adapts the OpenAI Codex Responses API (ChatGPT backend) to cogito.LLM.
The Codex backend lives at https://chatgpt.com/backend-api/codex/responses and speaks the same Responses wire format as the standard OpenAI Responses API, but with Codex-specific constraints:
- No sampling parameters (temperature, top_p) or output caps
- store is always false; stream is always true (SSE)
- Codex identity headers (originator, version, chatgpt-account-id from JWT)
- include: ["reasoning.encrypted_content"]
Response decoding reuses the openairesponses package — the SSE stream's terminal response.completed event carries the full response object in the same JSON shape as a non-streaming Responses API response.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoResponse = errors.New("codex: completed without an assistant message")
ErrNoResponse is returned when the API completes without an assistant message.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Model string
Token string // OAuth access token (JWT)
ReasoningEffort string // "", "none", "minimal", "low", "medium", "high", "xhigh", "max"
ServiceTier string // "", "auto", "default", "flex", "scale", "priority"
ResponsesLite bool
}
Config holds the connection + auth parameters for the Codex adapter.
type LLM ¶
type LLM struct {
// contains filtered or unexported fields
}
LLM implements cogito.LLM against the Codex Responses API.
func (*LLM) CreateChatCompletion ¶
func (l *LLM) CreateChatCompletion(ctx context.Context, request openai.ChatCompletionRequest) (cogito.LLMReply, cogito.LLMUsage, error)
CreateChatCompletion translates an OpenAI Chat Completion request to the Codex Responses API, calls it via SSE, and translates the response back.