LemonAi.Providers.OpenAICodexResponses (lemon_ai v0.1.0)

View Source

OpenAI Codex Responses API provider (ChatGPT Plus/Pro).

This provider implements the OpenAI Codex API available to ChatGPT Plus and Pro subscribers. It uses a different authentication mechanism (JWT tokens) and endpoint than the standard OpenAI API.

Key Differences from Standard OpenAI Responses

  • Uses chatgpt.com/backend-api/codex/responses endpoint
  • Requires ChatGPT JWT token (not standard API key)
  • Extracts account ID from JWT token
  • Has different rate limiting and quota behavior
  • Supports text verbosity control
  • Uses slightly different event mapping

Configuration

The provider requires a ChatGPT JWT token, which can be obtained from the ChatGPT web interface. Set it via:

  • OPENAI_CODEX_API_KEY environment variable
  • api_key option in StreamOptions

Usage

model = %Model{
  id: "gpt-5.2",
  api: :openai_codex_responses,
  provider: :"openai-codex",
  reasoning: true
}

context = Context.new(
  system_prompt: "You are a coding assistant.",
  messages: [%UserMessage{content: "Write a function..."}]
)

{:ok, stream} = OpenAICodexResponses.stream(model, context, %StreamOptions{})