Skip to content
vermarjunPublic

About

Use Codex subscription as API. One command, no extra API bills. Access all models available in codex as clean OpenAI compatible API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xypro

Your ChatGPT Codex, speaking fluent OpenAI on localhost.

What it is

Xypro is a small local proxy. It lets any OpenAI-compatible app use your ChatGPT Codex subscription, with no API key bill.

You keep writing normal OpenAI code. Xypro does the translation behind the scenes.

How it works

  • Your app calls the usual OpenAI endpoint at http://localhost:1455/v1.
  • Xypro signs the request with your ChatGPT login and forwards it to the Codex backend.
  • The reply comes back in plain OpenAI shape, streaming or not.

That is the whole trick. Your app never knows Codex is involved.

Install

npm install -g xypro

Then connect once and start it:

xypro auth     # sign in with ChatGPT, one time
xypro serve    # start the proxy, opens the control panel

Prefer not to install globally? Use npx:

npx xypro auth
npx xypro serve

That is the whole setup. Your code keeps calling OpenAI, Xypro points it at Codex.

Models

Xypro asks the Codex backend which models your account can actually use, every time it starts, and serves that list at /v1/models. It does not ship a hardcoded list. An earlier version did, OpenAI retired those slugs, and every request then failed with model_not_found while the account itself was fine.

POST /v1/models/refresh re-reads the list without a restart, and a built-in fallback covers the case where discovery fails.

The backend occasionally advertises a slug it will not actually serve. If one model 404s, pick another from /v1/models.

Tools

Function calling works. tools, tool_choice and parallel_tool_calls are translated into the Responses API, assistant tool_calls and role:"tool" turns become function_call / function_call_output items, and completed calls come back as OpenAI tool_calls in both streaming and non-streaming responses. Agent frameworks work against it unmodified.

node scripts/smoke.mjs   # with `xypro serve` already running

Commands

  • xypro serve starts the proxy and opens the control panel.
  • xypro auth connects your ChatGPT Codex account (one time).
  • xypro key [value] sets an API key your apps must send. No value means it generates one.
  • xypro key clear removes the key so the proxy is open again.
  • xypro help shows the help.

Use it from your app

Point any OpenAI client at the Xypro base URL. Nothing else changes.

from openai import OpenAI

client = OpenAI(base_url="http://localhost:1455/v1", api_key="xypro")
client.chat.completions.create(
    model="gpt-5.5",
    messages=[{"role": "user", "content": "hello"}],
)
curl http://localhost:1455/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.5","messages":[{"role":"user","content":"hi"}],"stream":true}'

If you set a key with xypro key, send it as Authorization: Bearer <key>.

Models

These are the only models a ChatGPT account can use through Codex (checked against the live backend):

  • gpt-5.5
  • gpt-5.4
  • gpt-5.4-mini

Each one takes a reasoning_effort of none, low, medium, high, or xhigh. More effort means more thinking and more tokens. none is fastest, xhigh thinks the hardest.

A couple of things Xypro handles quietly so your app does not break:

  • It maps reasoning_effort: "minimal" (which Codex does not accept) to low.
  • It drops max_tokens instead of forwarding it, because the Codex backend rejects output caps.

The control panel

Open http://localhost:1455 after xypro serve.

  • Providers: connection status, connect or reconnect, refresh, and a quick model test.
  • Quick test: fire one request to confirm a model works.
  • Usage: live token consumption, totals, by model, and recent requests.
  • Settings: default reasoning effort, reasoning summary, and default model.

Configuration

Settings live in proxy/.env (optional, sensible defaults otherwise):

  • PORT is the port Xypro runs on. Default is 1455.
  • PROXY_API_KEY is the key your apps must send. Empty means open, which is fine locally.
  • CODEX_PROXY_DATA_DIR is where your token, usage, and settings are stored. Default is ~/.codex-proxy.

Your tokens never leave your machine.

Notes

  • Codex always thinks first, so non-streaming replies are assembled after the stream finishes.
  • Reasoning text is returned on a reasoning field next to the normal content.
  • This maps text chat. Tool calls and vision are not translated yet.

Develop

Two live-reloading servers, backend on 1455 and frontend on 5173:

npm run dev

The backend lives in proxy/ (Express) and the control panel in web/ (Vite and React).

License

MIT

About

Use Codex subscription as API. One command, no extra API bills. Access all models available in codex as clean OpenAI compatible API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages