ChatMock and DIY Codex Proxies: Setup, Risks, Hosted Alternative
ChatMock, codex-openai-proxy, and CLIProxyAPI turn a ChatGPT login into a local OpenAI-compatible API. They work. Here is what running one actually involves.
ChatMock, codex-openai-proxy, and CLIProxyAPI all do a version of the same thing Codex Hosted does: turn your own ChatGPT subscription into an OpenAI-compatible endpoint. They are free, open source, and they work. The honest difference is not capability, it is operations: with the DIY tools you run the server, refresh the auth, and chase upstream changes yourself, and the OpenAI terms questions are identical either way. This page is the fair version of that comparison.
What the DIY tools are
ChatMock is the best known. It is a local server that signs in with your ChatGPT account and exposes OpenAI-compatible endpoints on your machine, so anything that accepts a base URL can use your plan. Mechanically, it re-implements the Codex CLI’s sign-in and request protocol in its own code rather than running OpenAI’s binary.
codex-openai-proxy takes the other approach: it wraps the official Codex CLI itself behind an OpenAI-compatible HTTP server, translating chat/completions requests into CLI invocations.
CLIProxyAPI is the broadest: a Go gateway that wraps several vendors’ CLI sign-ins, Codex among them, behind one OpenAI-compatible API. If you want one local endpoint fronting multiple subscription-backed CLIs, it is the most ambitious of the three.
All three require your own paid ChatGPT account. None of them, and not us either, has OpenAI’s endorsement.
What they do well
Credit where due, because these projects earn it:
- Free. No subscription beyond the ChatGPT plan you already pay for.
- Private by architecture. Your OAuth tokens and your traffic stay on hardware you control, with no third party in the request path. For some people that property beats every managed feature.
- Hackable. Want to log something custom, rewrite prompts in flight, or experiment with the protocol? It is your code and your box.
For a personal project on one machine, a DIY proxy is a perfectly good answer, and we would rather say so than pretend otherwise.
What you take on
The DIY proxies are real and they work; their price is denominated in maintenance hours, not dollars. Running one means owning:
- Process uptime. The proxy dies when your laptop sleeps or your VPS reboots; you add the systemd unit, the restart policy, the monitoring.
- Auth refresh. Sessions expire. When refresh breaks at 2am, your agent is down until you notice.
- Upstream chase. OpenAI ships Codex changes on its own schedule. Re-implementations like ChatMock break when the protocol moves; CLI wrappers break when flags or output formats change. Either way, you wait for a patch or write one.
- No fallback. When your plan’s usage window exhausts, requests fail. Multi-account failover and API-key fallback are yours to build.
- Queueing and logs. Concurrency control and per-request visibility exist only if you add them.
None of this is FUD; it is the standard bill for self-hosting anything. Whether it is worth paying is a real question with a real arithmetic answer, which we work through in the TCO comparison.
The terms question is the same for everyone
Self-hosting does not change OpenAI’s terms; it changes who operates the machinery. The rules that matter are identical across this whole category: the account must be your own, it may not be shared or made available to others, and OpenAI can restrict accounts at its discretion. Programmatic Codex use through codex exec is documented, intended functionality, and OpenAI has the final call.
One factual distinction worth knowing: Codex Hosted runs OpenAI’s official, unmodified CLI exactly as documented, while ChatMock re-implements the client. We will not claim that earns anyone a blessing, because nobody in this category has one. Our full reading of the terms, sources included, is in is Codex Hosted against OpenAI’s terms?
Side by side
| Axis | ChatMock | codex-openai-proxy | CLIProxyAPI | Codex Hosted |
|---|---|---|---|---|
| Price | Free | Free | Free | $129/mo, no inference markup |
| Runs on | Your machine | Your machine | Your machine | Managed isolated container |
| Mechanism | Re-implements CLI auth | Wraps official CLI | Wraps multiple CLIs | Official, unmodified CLI |
| When OpenAI changes auth | You update/wait | You update/wait | You update/wait | We patch it |
| Limit fallback | Build it yourself | Build it yourself | Multi-account config | Second account, then API key |
| Per-request logs | Basic/DIY | Basic/DIY | Basic/DIY | Built in, per lane |
| Maintenance | Yours | Yours | Yours | Ours |
Which one should you run?
Pick a DIY proxy if you are one person, the workload is personal, you enjoy operating software, or the no-third-party property is the point. Pick hosted if the endpoint carries production traffic, other people depend on it, or your hours are worth more than the fee. The wider decision space, including running the plain CLI with no proxy at all, is in Codex Hosted vs running Codex yourself, and our honest list of reasons not to buy from us is in ProxyLLM alternatives.
If the hosted column reads like your situation, Codex Hosted takes about five minutes to connect; if the DIY column does, go build it well.
Frequently asked questions
What is ChatMock?
ChatMock is an open-source project that signs in with your own ChatGPT account and exposes a local OpenAI-compatible API backed by your plan. It re-implements the Codex CLI's authentication flow rather than running the CLI itself, and you run it on your own machine for free.
Do DIY Codex proxies like ChatMock actually work?
Yes. ChatMock, codex-openai-proxy, and CLIProxyAPI are real, functioning projects with active users. Their cost is operational: you run the process, refresh the auth, and update the code when OpenAI changes the underlying CLI or sign-in flow.
Is using ChatMock against OpenAI's terms?
The terms questions are the same for any tool in this category, hosted or DIY: the account must be your own, never shared, and OpenAI retains discretion over its services. Programmatic Codex use is documented functionality, but OpenAI has the final call. Self-hosting does not grant extra permission, and no third-party tool has OpenAI's endorsement.
What is the difference between ChatMock and ProxyLLM's Codex Hosted?
ChatMock is free software you operate yourself, re-implementing Codex's auth on your machine. Codex Hosted is a managed service at $129/month that runs OpenAI's official, unmodified Codex CLI in an isolated container per account, with multi-account and API-key fallback lanes and per-request logs. Same idea, different operator.