← All guides AI Release
RU Subscribe to @ai_releaseorg

How to Move Claude Code to ChatGPT Subscription Models: Proxy Setup and CLI Replacement

Updated: 01.12.2026 · AI Release · @ai_releaseorg
How to Move Claude Code to ChatGPT Subscription Models: Proxy Setup and CLI Replacement

TL;DR

Subscription note: a ChatGPT consumer plan does not automatically give you an API key. Check your account page and the proxy documentation for which credential type is supported before you start. Everything below assumes you have a working credential string; where a value depends on your setup it is written as <placeholder>.

What you'll get

Quick start

export OPENAI_API_KEY="<openai-credential>"
pip install "litellm[proxy]"
litellm --model <openai-model-name> --port 8080
export ANTHROPIC_BASE_URL="http://127.0.0.1:8080"
export ANTHROPIC_AUTH_TOKEN="<proxy-token>"
claude -p "Reply with the single word OK"

Details and verification — in the steps below.

Requirements and setup

Illustration: Requirements and setup
Illustration: Requirements and setup

Step 1. Inventory the CLI's configuration surfaces

What to do: Find out which Anthropic environment variables are already set in your shell, and where Claude Code stores persistent settings.

claude --version
env | grep -i anthropic
ls -la ~/.claude

Why: Claude Code picks its endpoint from environment variables, and the persistent copy usually lives in ~/.claude/settings.json (per-project settings live in .claude/settings.json inside the repo). If an old ANTHROPIC_BASE_URL is already exported, your new value will be silently ignored — the shell wins over the file in most setups. Confirm the exact file locations for your build in the official Claude Code documentation, since paths differ between CLI and desktop builds (see Claude Code Desktop: setup, limits and how it differs from the CLI).

The variables that matter:

VariableRole
`ANTHROPIC_BASE_URL`Which host Claude Code sends requests to
`ANTHROPIC_AUTH_TOKEN`Bearer token sent in the `Authorization` header
`ANTHROPIC_API_KEY`Key sent in the `x-api-key` header

How to check: env | grep -i anthropic should print nothing (or only variables you recognise). If it prints an ANTHROPIC_BASE_URL, note its value — that is your old endpoint, and you will restore it to roll back.

Step 2. Start the proxy and repoint Claude Code

Illustration: Step 2. Start the proxy and repoint Claude Code
Illustration: Step 2. Start the proxy and repoint Claude Code

What to do: Launch the translator on 127.0.0.1:8080, then tell Claude Code to use it.

export OPENAI_API_KEY="<openai-credential>"
litellm --model <openai-model-name> --port 8080

Then, in a second terminal, verify the proxy answers in Anthropic format before touching Claude Code:

curl -s http://127.0.0.1:8080/v1/messages \
  -H "content-type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -H "x-api-key: <proxy-token>" \
  -d '{"model":"<claude-model-alias>","max_tokens":64,"messages":[{"role":"user","content":"ping"}]}'

Why: Testing with curl isolates the proxy from the CLI. If the proxy is broken, you see it here instead of guessing inside Claude Code. The /v1/messages path and anthropic-version: 2023-06-01 header are what Claude Code itself sends — using them proves compatibility.

Model mapping is the part that usually fails. Claude Code sends Claude model names; your proxy must map those names onto your OpenAI model. Get the real string from the proxy's own log rather than guessing: start the proxy with verbose logging, send the curl above with any model name, and read the model field it reports. Then add a mapping entry in the proxy config:

model_list:
  - model_name: <claude-model-alias>
    litellm_params:
      model: openai/<openai-model-name>
      api_key: os.environ/OPENAI_API_KEY

Now persist the client side in ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:8080",
    "ANTHROPIC_AUTH_TOKEN": "<proxy-token>"
  }
}

How to check: After saving the file, start a new shell (the settings file is read at launch) and run claude -p "Reply with the single word OK". The proxy terminal must show one incoming request and an HTTP 200; the CLI must print OK.

Step 3. Verify end-to-end and lock the result

Illustration: Step 3. Verify end-to-end and lock the result
Illustration: Step 3. Verify end-to-end and lock the result

What to do: Run the same smoke test three ways and confirm the proxy log shows a mapped model each time.

claude -p "Reply with the single word OK"
claude -p "List three file extensions you can read" 
curl -s http://127.0.0.1:8080/v1/messages -H "content-type: application/json" \
  -H "anthropic-version: 2023-06-01" -H "x-api-key: <proxy-token>" \
  -d '{"model":"<claude-model-alias>","max_tokens":32,"messages":[{"role":"user","content":"ping"}]}'

Why: The first command proves the CLI-to-proxy hop; the second proves a real task (not just a canned reply) survives translation; the third proves the proxy still works independently, so a later failure can be localised to Claude Code rather than to the backend.

How to check: Final checklist — all four items must be true.

Rollback, if you need the original endpoint back: delete the env block from ~/.claude/settings.json (or unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN) and open a new shell.

Troubleshooting

Problem. Claude Code exits immediately, the proxy log stays empty.

Problem. The proxy answers curl but Claude Code reports an auth failure.

Problem. The request reaches the proxy and fails on the model name.

Summary and next steps

You now have a local proxy on 127.0.0.1:8080 translating Anthropic-format calls to an OpenAI model, with Claude Code configured through ~/.claude/settings.json and a repeatable smoke test. If you want to drive the same setup from a phone or compare it against other agents, see How to Remotely Control Claude Code and Codex from Your Phone and 1loop vs Claude Code.

FAQ

Does a ChatGPT Plus or Pro subscription work as an API key?

Not automatically — consumer plans and API credentials are separate products. Check your account page and your proxy's documentation for the supported credential type; if the plan exposes no key, use an API key instead.

Will every Claude Code feature work through the proxy?

No guarantee. Tool-calling, long-context handling and streaming depend on what your proxy and backend model support; verify each behaviour with a real task rather than assuming parity. Check the proxy documentation for the current support matrix.

How do I switch back to Anthropic's endpoint?

Remove the env block from ~/.claude/settings.json, or run unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN, then open a new shell and run claude -p "ping".

Where do I get the model name to put in the mapping?

From the proxy's own request log: send one curl to /v1/messages, read the model field the CLI or curl sent, and map that exact string. Do not invent a name — an unmapped alias returns the not_found_error shown above.

🤖 AI summary

AI Release Knowledge Layer
Machine-readable description · Version 1.0

Status: practical guide. Some statements come from vendors; verify in your environment.

1. Summary

Time to complete: 30 minutes Difficulty: Intermediate

Inside: direct answers, key facts, entities, context, reliability, unknowns and sources.

Machine data: Citation Map JSON · JSON-LD · Semantic Embeddings — separate stage.

Full Knowledge Layer: sections 2–8

2. Direct answers

What is required?
OS: macOS, Linux, or Windows (PowerShell; WSL2 also works and matches the bash commands below).; Claude Code CLI installed and logged in once — run claude --version; it must print a version string, not command not found.; A translator proxy. Claude Code speaks the Anthropic Messages API; OpenAI models speak the Chat… → details (AR-GUIDE-KAKPEREVES-003)
How to do it?
Step 1. Inventory the CLI's configuration surfaces → Step 2. Start the proxy and repoint Claude Code → Step 3. Verify end-to-end and lock the result → details (AR-GUIDE-KAKPEREVES-004)
Which topics does it cover?
claude code заблокировали, claude code на chatgpt, claude code альтернатива, codex cli установка настройка, перенос claude code на другую модель → details (AR-GUIDE-KAKPEREVES-002)
What are the key points?
Time to complete: 30 minutes Difficulty: Intermediate → details (AR-GUIDE-KAKPEREVES-007)

3. Key facts

  1. Time to complete: 30 minutes — evidence; status: заявление источника.
  2. Difficulty: Intermediate — evidence; status: заявление источника.
  3. You'll need: Claude Code CLI (claude --version), Node.js runtime for the CLI, Python 3 + pip (only if your translator proxy is a Python package), curl, a free TCP port (examples below use 8080), and an OpenAI credential — an API key, or whatever credential your plan's documentation says to use. — evidence; status: заявление источника.
  4. OS: macOS, Linux, or Windows (PowerShell; WSL2 also works and matches the bash commands below). — evidence; status: заявление источника.
  5. Claude Code CLI installed and logged in once — run claude --version; it must print a version string, not command not found. — evidence; status: заявление источника.
  6. A translator proxy. Claude Code speaks the Anthropic Messages API; OpenAI models speak the Chat Completions API. A proxy — a small local service that rewrites one request format into the other — is what bridges them. Example: the LiteLLM proxy is a widely used option that serves an Anthropic-compatible /v1/messages endpoint. Confirm the exact install and flag names in its current documentation, because flags change between releases. — evidence; status: заявление источника.

4. Entities

EntityTypeRole
claude code заблокировалитема/инструментупоминается в заголовке, TL;DR или разделах гайда
claude code на chatgptтема/инструментупоминается в заголовке, TL;DR или разделах гайда
claude code альтернативатема/инструментупоминается в заголовке, TL;DR или разделах гайда
codex cli установка настройкатема/инструментупоминается в заголовке, TL;DR или разделах гайда
перенос claude code на другую модельтема/инструментупоминается в заголовке, TL;DR или разделах гайда
Windowsплатформа/технологияупоминается в заголовке, TL;DR или разделах гайда
Linuxплатформа/технологияупоминается в заголовке, TL;DR или разделах гайда
macOSплатформа/технологияупоминается в заголовке, TL;DR или разделах гайда
Node.jsплатформа/технологияупоминается в заголовке, TL;DR или разделах гайда
Pythonплатформа/технологияупоминается в заголовке, TL;DR или разделах гайда

5. Context

  • Guide — describes → How to Move Claude Code to ChatGPT Subscription Models: Proxy Setup and CLI Replacement (AR-GUIDE-KAKPEREVES-001).
  • Guide — includes step → Step 1. Inventory the CLI's configuration surfaces (AR-GUIDE-KAKPEREVES-001).

6. Reliability

Confirmed

No independent confirmation is provided; source claims and editorial conclusions are separated below.

Source claims

  • Product features, versions, prices and limits come from vendors and the guide.
  • Commands and steps are recommendations, not guaranteed results.

AI Release analysis

  • Structure, comparison and selection criteria are editorial.
  • The guide does not replace an independent audit or legal advice.

7. Unknowns

  • Current versions, prices and limits.
  • Independent benchmarks and quality checks.
  • Terms of use and data policy.

8. Sources

SourceTypeRole
No external links——

Cite as: AI Release. Как перевести Claude Code на модели ChatGPT по подписке: настройка прокси и замена CLI. ai-release.org.