Scan your whole stack
Are you using codex-as-api?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v1.0.2
codex-as-api was last scanned on 24 Nov 2026 at version 1.0.2. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 1.0.2 LATEST | 24 Nov 2026 | No rules fired |
| 1.0.1 | 18 Nov 2026 | No rules fired |
| 0.10.2 | 13 Nov 2026 | 1 rule fired |
| 0.10.1 | 10 Nov 2026 | Not shown |
| 0.10.0 | 29 Oct 2026 | Not shown |
Findings for v1.0.2. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 1.0.2; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Use ChatGPT / Codex OAuth as a local OpenAI-compatible API server.
/v1/responses, /v1/responses/compact), Chat Completions, Messages, and GET /v1/modelsoriginal image detail in classic Responsesprompt_cache_key, account-scoped Chat continuation, subagent headers, and remote compactionCODEX_HOME / ~/.codex/config.toml for model, reasoning-effort, and context-window settings/v1/messages/count_tokens and /v1/messages/compactRuns a lightweight HTTP server on localhost that translates standard OpenAI API calls into authenticated requests against the ChatGPT / Codex backend. Sign in explicitly through this server's browser OAuth API; it stores and refreshes its own OAuth credentials without reading or changing your Codex login.
Python, Rust, and TypeScript (npm) implementations are provided — identical functionality, same endpoints, same behavior.
A ChatGPT account eligible for the Codex backend and a runtime for your chosen implementation are required. The official Codex CLI is not required.
After starting the server, use Standalone login to open
OpenAI's ordinary sign-in page in your browser and authorize this server. Credentials are saved privately to
~/.codex-as-api/auth.json by default, and the server handles refresh itself.
It does not discover, import or fall back to ~/.codex/auth.json, CODEX_HOME
credentials or a Codex keychain entry. Upgrading from older versions therefore
requires a fresh login for codex-as-api; your existing Codex login is left alone.
Use one server process per credential store. To run independent instances,
assign each its own CODEX_AS_API_HOME or CODEX_AS_API_AUTH_PATH.
Model settings may still be read from ~/.codex/config.toml; that separate
configuration behavior is unchanged and does not require installing Codex.
Install from PyPI:
pip install codex-as-api
codex-as-api
Or with uv:
uv pip install codex-as-api
codex-as-api
Or from source:
git clone https://github.com/CHOAM-CO/codex-as-api.git
cd codex-as-api
pip install -e .
codex-as-api
cd rust
cargo build --release
./target/release/codex-as-api
Install from npm and run:
npm install -g codex-as-api
codex-as-api
Or use npx without installing:
npx codex-as-api
Or from source:
cd ts
npm install
npm run build
node dist/cli.js
Can also be used as a library:
import { ChatGPTOAuthProvider, createApp } from "codex-as-api";
// Use the provider directly
const provider = new ChatGPTOAuthProvider({ model: "gpt-5.6-sol" });
const response = await provider.chat(
[
{ role: "system", content: "You are helpful." },
{ role: "user", content: "Hello!" },
],
);
console.log(response.content);
// Or create an Express app
const app = createApp();
app.listen(18080);
All versions bind to 127.0.0.1:18080 (localhost only) by default.
Login is an API operation; the codex-as-api command starts the server, not the
Codex CLI. Before starting, set CODEX_AS_API_ADMIN_KEY to a private random
administrator key. Supply that same key as a bearer credential on /auth/*.
This key is independent of both the OpenAI OAuth credentials and any inference
client authentication; never use your access or refresh token as the admin key.
Start the server with the key configured, then initiate login from a trusted local terminal or authenticated management client:
curl -sS -X POST http://127.0.0.1:18080/auth/login \
-H "Authorization: Bearer $CODEX_AS_API_ADMIN_KEY" \
-H 'Content-Type: application/json' -d '{}'
The 202 response contains id, method: "browser", status: "pending",
auth_url and expires_at. Your app opens auth_url in the system browser;
sign in normally on OpenAI's page. No one-time device code or Codex CLI is
needed. On approval, the browser returns to a separate loopback callback
listener on the same machine as the server, and credentials are saved
privately. The server tries registered callback port 1455, then 1457; if both
are occupied it reports 409 callback_port_unavailable instead of interfering
with another app. The API itself never launches a browser on a remote server.
The authorization URL contains temporary sensitive state; do not log or share
it. Only start login on a server you control.
Poll the login ID returned by step 1 (the placeholder below is not a real ID):
curl -sS http://127.0.0.1:18080/auth/login/LOGIN_ID \
-H "Authorization: Bearer $CODEX_AS_API_ADMIN_KEY"
Status becomes succeeded only after valid credentials are durably saved.
Other terminal states are failed, cancelled and expired. Routine status
responses include the method but never repeat the authorization URL or user
code, or return OAuth tokens, authorization codes, verifiers, device IDs or
storage paths.
To stop an outstanding attempt, send DELETE /auth/login/LOGIN_ID with the same
administrator bearer. Repeating cancellation is safe. A login already saved
remains succeeded; cancellation is not logout or provider-side revocation.
GET /auth/status with the administrator bearer returns only
{"status":"authenticated"}, unauthenticated or reauthentication_required.
This checks the local application-owned credential state, not provider-side
revocation or remote account validity; refresh is handled privately when needed.
Validation, cancellation and failures before credential replacement preserve a
prior valid login. If replacement succeeds but the final directory sync fails,
login_persistence_uncertain reports that durability could not be confirmed; a
new local credential may already exist. Cancellation is not a rollback.
When the browser and API server are on different machines, a loopback browser
callback would reach the wrong machine. Explicitly send {"method":"device"}
to POST /auth/login instead. It returns method: "device", verification_url,
user_code, interval and the common session fields. Open
https://auth.openai.com/codex/device in your own browser and enter the code.
Only approve a code from a login you initiated on a trusted server; never post
it in public channels or logs. Device-code login may need enabling in your
OpenAI account. No method silently falls back to another.
All management responses use Cache-Control: no-store. An unset admin key returns
503 management_disabled; a missing/wrong bearer returns 401 invalid_admin_key.
An empty request body, {} or {"method":"browser"} selects browser login;
{"method":"device"} selects device login. No other body fields are accepted.
The API does not accept credentials to import, token export switches,
authentication endpoints or credential paths from a request. One active attempt per store is allowed; another
start returns 409 login_in_progress. Unknown/retired IDs return 404.
Keep the default loopback binding unless you deliberately deploy authenticated
HTTPS administration behind a trusted reverse proxy. A browser Origin must
match the request's own scheme and Host; the API does not blindly trust forwarded
headers. Configure proxy origins consistently. Origin checking supplements the
admin bearer and is not a replacement for authentication or network controls.
Each credential store must be owned by one server process, not shared between
independent workers. Choose separate store paths for separate instances.
OpenAI's public Sign in with ChatGPT (chatgpt.tokens.use.direct)
preview route (https://api.openai.com/v1/responses with dynamic client registration)
is intentionally kept on hold and not used as the default transport:
namespace tool object rather than sent as top-level function definitions./responses/compact), Responses Lite, hosted image_generation, device-code login, and ChatGPT Live / Realtime WebRTC voice calls are not supported on the SIWC preview route.wss://api.openai.com/v1/responses) rather than stateless HTTP POST /v1/responses requests.Environment variables (Python, Rust, and TypeScript):
| Variable | Default | Description |
|---|---|---|
CODEX_AS_API_HOST |
127.0.0.1 |
Bind address |
CODEX_AS_API_PORT |
18080 |
Listen port |
CODEX_AS_API_MODEL |
~/.codex/config.toml model, else live default |
Model identifier passed to Codex backend |
CODEX_AS_API_AUTH_PATH |
CODEX_AS_API_HOME/auth.json, else ~/.codex-as-api/auth.json |
Explicit application-owned OAuth store path; not an import command |
CODEX_AS_API_HOME |
~/.codex-as-api |
Application-owned credential directory |
CODEX_AS_API_ADMIN_KEY |
unset (management disabled) | Independent bearer key for /auth/*; never use an OAuth token as this key |
CODEX_AS_API_RESPONSES_LITE |
auto |
Responses Lite mode: auto, on, or off |
CODEX_AS_API_CODEX_METADATA |
off |
Add Codex-style per-turn client_metadata and related backend headers |
CODEX_HOME |
~/.codex |
Optional Codex model/config discovery only; never used to find credentials |
The server also reads root-level Codex CLI settings from ~/.codex/config.toml:
model = "gpt-5.6-sol"
model_reasoning_effort = "high"
# Optional explicit context values. A published live maximum still clamps them.
model_context_window = 272000
model_auto_compact_token_limit = 244800
CODEX_AS_API_MODEL overrides the Codex config model. Reasoning-effort precedence is request, Codex config, then the authenticated model catalog default when present. When no request or configured model exists, the proxy selects the catalog's first visibility: "list" model by ascending priority, matching Codex. The effective model, reasoning setting, catalog status, and context settings are exposed from /health; optional reasoning and context values are null when neither config nor the live catalog supplies them. Context settings are also returned by Anthropic token-count responses when available.
Ordinary models and capabilities come from the authenticated Codex /models response. The proxy keeps each account/base-URL/client-version snapshot in memory for 300 seconds and invalidates it when a Responses X-Models-Etag changes. An unavailable or malformed refresh returns 503 catalog_unavailable before streaming headers are sent; an upstream HTTP rejection after the one allowed OAuth refresh preserves its status as upstream_error. Model snapshots are never shared across accounts or served as an offline fallback.
Use GET /v1/models for the effective catalog. It includes exact slugs, visibility, supported_in_api, reasoning-summary controls, and opaque comp_hash compatibility identifiers when supplied. Unknown IDs return 404 model_not_found. Automatic default selection uses only the upstream catalog's originally visible models, not the experimental additions below.
These three upstream-hidden models returned real responses on October 24, 2026, and are explicitly included in codex-as-api's effective catalog:
| Model ID | Observed upstream purpose |
|---|---|
gpt-6-chat-thinking |
Server-described paid CCA experiment; hidden and marked unsupported in the upstream API catalog |
gpt-reserve |
Official Codex CLI's Luna Reserve routing for reserve usage |
codex-auto-review |
Official Codex CLI's Guardian automatic approval-review model |
A small authenticated smoke test also verified function-tool calling plus tool-result continuation for all three models, and executed a simple generated JavaScript function against four inputs per model. This is a basic functionality check, not a coding-quality benchmark.
These are hidden models. Upstream support can stop at any time, and availability may differ by account. If a model stops responding, open an issue with its model ID and a sanitized error; we will remove the discontinued model from this catalog. Do not include access tokens or other credentials in the issue.
The proxy exposes these verified exceptions as selectable models and prefers their current live capability metadata. Bundled capability records keep only these three IDs available when a successful live catalog omits them; they do not bypass OAuth, upstream rejection, or a failed/malformed catalog fetch. A successful empty upstream catalog can therefore list these experimental entries, while health/default selection still fails until an ordinary upstream default is available. The proxy never selects a hidden experimental model as its automatic default.
To use a different port:
CODEX_AS_API_PORT=9000 codex-as-api
To expose on all interfaces (e.g. for remote access):
CODEX_AS_API_HOST=0.0.0.0 codex-as-api
GET /v1/modelsReturns the current account's authenticated Codex model catalog using an OpenAI-compatible list envelope. The response includes safe routing and capability metadata but omits backend instructions and model messages.
curl http://localhost:18080/v1/models Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.