OpenAI Codex — sx_provider_codex.c

Codex 프로바이더

OpenAI Codex 프로바이더 심층 분석 — 모델, 인증, 기능, 구성.

개요

Codex 프로바이더는 OAuth Bearer 토큰 인증을 통해 scorpiox code를 OpenAI Codex 백엔드에 연결합니다. ChatGPT 백엔드 API를 대상으로 하며 스트리밍, 확장 사고, 도구 사용, 함수 호출, 비전 및 자동 토큰 갱신을 지원합니다.

# API endpoint
POST https://chatgpt.com/backend-api/codex/responses

# Auth header
Authorization: Bearer <oauth_token>

# Source file
impl: scorpiox/libsxnet/sx_provider_codex.c

지원 모델

gpt-5.3-codex
Flagship
Latest Codex flagship model. Maximum reasoning depth, extended context, best for complex multi-file refactors and architecture work.
gpt-5.3-codex-spark
Spark
Lightweight 5.3 variant optimized for speed. Best for quick edits, completions, and interactive coding sessions.
gpt-5.2-codex
Standard
Previous-generation flagship. Proven reliability for production workloads and general-purpose coding tasks.
gpt-5.2
Standard
General GPT-5.2 model. Broader capabilities beyond code — documentation, analysis, and reasoning.
gpt-5.1-codex
Standard
Stable 5.1 generation. Well-tested for day-to-day development tasks with consistent output quality.
gpt-5.1-codex-mini
Mini
Compact 5.1 variant. Lower latency and cost, ideal for simple tasks like formatting, renaming, and boilerplate.
gpt-5.1-codex-max
Max
Maximum-capacity 5.1 model. Extended thinking budget and larger context window for deep analysis.

기능

Streaming
Real-time token streaming via SSE for responsive TUI output
🧠
Extended Thinking
Chain-of-thought reasoning with configurable thinking budget
🔧
Tool Use
Full tool execution — file ops, bash, search, docs, and more
📞
Function Calling
Native OpenAI function calling for structured tool invocations
👁️
Vision
Image input support for screenshots, diagrams, and UI reviews
🔄
Token Refresh
Automatic OAuth token rotation via scorpiox-codex-fetchtoken

인증

Codex는 Authorization 헤더를 통한 OAuth Bearer 토큰 인증을 사용합니다. 토큰은 scorpiox-codex-fetchtoken에 의해 관리되며 세 가지 소스에서 가져올 수 있습니다:

토큰 소스

Local CODEX_TOKEN_SOURCE=local
Reads the OAuth token from a local file managed by scorpiox-codex-fetchtoken. Default mode — no network calls needed for token acquisition. The token file is stored alongside your scorpiox configuration.
Remote CODEX_TOKEN_SOURCE=remote
Fetches the token from a remote HTTP endpoint configured via CODEX_REMOTE_URL. Default URL: https://token.scorpiox.net/codex. Useful for centralized token management across teams.
SSH CODEX_TOKEN_SOURCE=ssh
Retrieves the token over SSH from a remote machine. Configure via CODEX_SSH_HOST, CODEX_SSH_USER, CODEX_SSH_PASS, and CODEX_SSH_PORT. Ideal for air-gapped or private infrastructure environments.

구성

모든 Codex 설정은 프로젝트 루트의 scorpiox-env.txt에 저장됩니다. scorpiox-config를 실행하여 대화형으로 구성하세요.

KeyDescriptionDefault
PROVIDERSet to codex to use this providerscorpiox
MODELModel name or alias (e.g. gpt-5.3-codex)sonnet
TOOLSEnable/disable all tool execution1
CODEX_TOKEN_SOURCEToken acquisition method: local, remote, sshlocal
CODEX_REMOTE_URLRemote HTTP endpoint for token fetchinghttps://token.scorpiox.net/codex
CODEX_SSH_HOSTSSH hostname for remote token retrieval
CODEX_SSH_USERSSH username
CODEX_SSH_PASSSSH password
CODEX_SSH_PORTSSH port number

빠른 시작

1. Switch to Codex provider

# In scorpiox-env.txt
PROVIDER=codex
MODEL=gpt-5.3-codex
CODEX_TOKEN_SOURCE=local

# Or use scorpiox-config interactively
$ scorpiox-config

2. Fetch your token

# Local token (default)
$ scorpiox-codex-fetchtoken

# Remote token from team server
$ CODEX_TOKEN_SOURCE=remote scorpiox-codex-fetchtoken

# SSH token from bastion host
$ CODEX_TOKEN_SOURCE=ssh CODEX_SSH_HOST=bastion.internal scorpiox-codex-fetchtoken

3. Start coding

# Launch scorpiox code with Codex backend
$ sx

# Or specify model inline
$ sx --provider codex --model gpt-5.3-codex-spark

프로바이더 비교

FeatureCodexClaude CodeAnthropicGeminiOpenAIRouter
Streaming
Thinking
Tool Use
Function Calling
Vision
Token Refresh
Context Caching
Auth MethodOAuth BearerOAuth Bearerx-api-keyAPI KeyAPI KeyNone

소스 구현

The Codex provider is implemented as a single-file C module following the scorpiox provider interface pattern:

// Provider source
scorpiox/libsxnet/sx_provider_codex.c

// Token fetcher binary
scorpiox/scorpiox-codex-fetchtoken.c

// Provider interface (shared by all providers)
scorpiox/libsxnet/sx_provider.h

// Config integration
scorpiox/libsxutil/sx_config.c → CODEX_TOKEN_SOURCE, MODEL

All providers compile as part of libsxnet and are statically linked into the sx binary. Zero runtime dependencies — the Codex provider uses raw socket HTTP built into scorpiox's networking layer.