OpenAI Codex — sx_provider_codex.c

Codex Sağlayıcı

OpenAI Codex sağlayıcısına derinlemesine bakış — modeller, kimlik doğrulama, özellikler ve yapılandırma.

Genel Bakış

Codex sağlayıcısı, scorpiox code'u OAuth Bearer token kimlik doğrulaması ile OpenAI Codex arka ucuna bağlar. ChatGPT arka uç API'sini hedefler ve akış, genişletilmiş düşünme, araç kullanımı, işlev çağrısı, görüntü ve otomatik token yenilemeyi destekler.

# 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

Desteklenen Modeller

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.

Özellikler

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

Kimlik Doğrulama

Codex, Authorization başlığı üzerinden OAuth Bearer token kimlik doğrulaması kullanır. Tokenlar scorpiox-codex-fetchtoken tarafından yönetilir ve üç kaynaktan alınabilir:

Token Kaynakları

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.

Yapılandırma

Tüm Codex ayarları proje kökündeki scorpiox-env.txt dosyasında saklanır. Etkileşimli yapılandırma için scorpiox-config çalıştırın.

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

Hızlı Başlangıç

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

Sağlayıcı Karşılaştırması

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

Kaynak Uygulaması

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.