# How to Use GPT-6 Astra in Claude Code: Proxy or Codex Plugin

> Run GPT-6 Astra as Claude Code's main model via a local LiteLLM proxy on API billing, or keep Claude in charge and hand tasks to Astra with the Codex plugin.

- URL: https://blog.laozhang.ai/en/posts/gpt-6-astra-in-claude-code
- Published: 2026-11-12
- Updated: 2026-11-12
- Author: LaoZhang AI Team (https://blog.laozhang.ai/en/about)
- Topic: Claude Code
- Tags: Claude Code, GPT-6 Astra, LiteLLM, Codex Plugin, API Configuration

---
There are two different setups behind "GPT-6 Astra in Claude Code", and you need to pick one before you change anything. If you want Astra to run the whole session, put a translating proxy such as LiteLLM between Claude Code and an OpenAI-format endpoint, point `ANTHROPIC_BASE_URL` at the proxy, and set the model variables to `gpt-6-astra`. That needs an API key and bills per token. If you want Claude to stay in charge and hand tasks to Astra, install OpenAI's Codex plugin and run `/codex:rescue --model gpt-6-astra`, which uses your Codex login, so a ChatGPT Plus or higher plan works.

Both setups completed the same small coding task on November 12, 2026. Through the proxy, Claude Code 2.1.316 running on Astra fixed a two-bug Python file in 19.2 seconds for about $0.228 at Astra's list price, roughly twice what Claude Code's own cost line printed. Through the plugin, the same task finished in 28 seconds on a ChatGPT subscription. Anthropic does not support routing Claude Code to non-Claude models, so neither setup comes with help from Anthropic, and an update can break either one.

The shortcut that did not work is pointing Claude Code straight at a gateway's Anthropic-format endpoint with `gpt-6-astra` as the model name. On laozhang.ai that returned a 503 "no available channels" error, because its Claude-protocol endpoint does not serve Astra while its OpenAI-format endpoints do. Translating between the two formats is the proxy's whole job.

*Disclosure: [laozhang.ai is our own service](https://blog.laozhang.ai/en/about#laozhang). Its prices are platform pricing, not an independent comparison.*

## Astra as the main model or as a Codex worker: which setup to pick

Pick the proxy if you want Astra to drive every turn inside Claude Code's interface and you are paying for API tokens anyway. Pick the Codex plugin if you want to keep Claude as the main model and send Astra specific jobs, such as a bug hunt, a second-opinion review or a quick fix, and you already have a ChatGPT plan that includes Astra. The plugin route is also the answer if your real question is "can I use ChatGPT in Claude Code": it is the only one of the two that runs on a ChatGPT subscription.

| | Proxy route: Astra as the main model | Codex plugin route: Claude delegates to Astra |
| --- | --- | --- |
| Who runs the session | Claude Code's tools and prompts, with every turn sent to `gpt-6-astra` | Your usual Claude model; the Codex CLI runs each delegated task with its own tools |
| What you need | An API key that can call `gpt-6-astra` on an OpenAI-format endpoint, plus LiteLLM | A ChatGPT plan that includes Astra or an OpenAI API key, Node.js 18.18+, the Codex CLI |
| How it bills | Per token at API rates | Codex usage limits on a ChatGPT login, or API tokens on a key login, plus Claude usage for the Claude side |
| Effort control | `CLAUDE_CODE_EFFORT_LEVEL`, passed through to Astra | `--effort` on each task, or `model_reasoning_effort` in Codex's `config.toml` |
| Typical surprise | Claude Code's cost line is about half the real list-price cost | Without `--model`, Codex picks its own default model instead of Astra |
| Result on November 12, 2026 | 4 of 4 tests passing, 19.2 s | 4 of 4 tests passing, 28 s |

The two times are not a race result. The proxy run used effort `high` inside Claude Code's agent loop, while the plugin run used effort `medium` inside Codex, so their speed and token totals measure different harnesses. If you are still deciding which model to use at all, that question is covered in [Claude Fable 5.2 vs GPT-6 Astra: When Each Costs Less per Task](https://blog.laozhang.ai/en/posts/claude-fable-5-2-vs-gpt-6-astra).

## Proxy route: run Claude Code on gpt-6-astra through LiteLLM

Claude Code only speaks the Anthropic Messages format, so the proxy route works by running LiteLLM on your machine: Claude Code sends its usual `/v1/messages` requests to LiteLLM, and LiteLLM rewrites them for an OpenAI-format upstream that serves `gpt-6-astra`. LiteLLM documents this pattern in its tutorial "Use Claude Code with Non-Anthropic Models". The setup below is the one that ran on November 12, 2026 with LiteLLM 1.109.1 and Claude Code 2.1.316, with laozhang.ai as the upstream.

*Disclosure: [laozhang.ai is our own service](https://blog.laozhang.ai/en/about#laozhang). Its prices are platform pricing, not an independent comparison.*

![Two request paths: Claude Code sent straight to the gateway's Anthropic-format endpoint ends in a 503, while Claude Code through LiteLLM on 127.0.0.1:4011 reaches gpt-6-astra on /v1/responses, with /status, the LiteLLM debug log and the usage page as the three places to check](https://blog.laozhang.ai/posts/en/gpt-6-astra-in-claude-code/img/request-path.webp)

You need an upstream key that can already call Astra. On OpenAI's own platform that depends on your project's access, which [GPT-6 Astra API Access: Check Your Project and Make a First Request](https://blog.laozhang.ai/en/posts/gpt-6-astra-api-access) walks through. On laozhang.ai, `gpt-6-astra` is listed in the `default` group on both `/v1/chat/completions` and `/v1/responses`.

1. Install LiteLLM with its proxy extras. LiteLLM's tutorial uses `uv tool install 'litellm[proxy]'`; a Python virtual environment with `pip install 'litellm[proxy]'` works the same way.

2. Save this as `litellm-config.yaml`. The `model_name` values are the names Claude Code will ask for, and `drop_params: true` tells LiteLLM to drop request fields the upstream does not accept.

   ```yaml
   model_list:
     - model_name: gpt-6-astra
       litellm_params:
         model: openai/gpt-6-astra
         api_base: https://api.laozhang.ai/v1
         api_key: os.environ/LAOZHANG_API_KEY
     - model_name: gpt-6-luna
       litellm_params:
         model: openai/gpt-6-luna
         api_base: https://api.laozhang.ai/v1
         api_key: os.environ/LAOZHANG_API_KEY
   litellm_settings:
     drop_params: true
   ```

   For an OpenAI key, remove both `api_base` lines and read the key from `OPENAI_API_KEY`, which is the form LiteLLM's tutorial shows; the timings and costs below all come from the laozhang.ai config above. A third entry with `model: openai/responses/gpt-6-astra` was also tried and behaved identically, because LiteLLM sent every Astra call to the upstream's `/v1/responses` endpoint either way.

3. Start the proxy. `LITELLM_MASTER_KEY` is a password you make up; Claude Code will present it as its token.

   ```bash
   export LAOZHANG_API_KEY="your-upstream-key"
   export LITELLM_MASTER_KEY="sk-any-long-random-string"
   litellm --config litellm-config.yaml --host 127.0.0.1 --port 4011
   ```

4. Check the proxy before touching Claude Code. A reply with `"model": "gpt-6-astra"` means the translation works; in the test, the same kind of request with one tool attached came back with `"stop_reason": "tool_use"`.

   ```bash
   curl -X POST http://127.0.0.1:4011/v1/messages \
     -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
     -H "Content-Type: application/json" \
     -d '{"model": "gpt-6-astra", "max_tokens": 200,
          "messages": [{"role": "user", "content": "Which model are you?"}]}'
   ```

5. In a second terminal, set Claude Code's variables and start it.

   ```bash
   export ANTHROPIC_BASE_URL="http://127.0.0.1:4011"
   export ANTHROPIC_AUTH_TOKEN="sk-any-long-random-string"   # the same LITELLM_MASTER_KEY
   export ANTHROPIC_MODEL="gpt-6-astra"
   export ANTHROPIC_DEFAULT_OPUS_MODEL="gpt-6-astra"
   export ANTHROPIC_DEFAULT_SONNET_MODEL="gpt-6-astra"
   export ANTHROPIC_DEFAULT_HAIKU_MODEL="gpt-6-luna"
   export CLAUDE_CODE_MAX_CONTEXT_TOKENS=272000
   claude
   ```

All four model variables matter. Without `--model`, Claude Code sends the main session to the Opus slot, subagents inherit the session model, and the Haiku slot names the session. If a slot is left empty, Claude Code asks the proxy for a Claude model ID it does not have. Putting `gpt-6-luna` in the Haiku slot keeps those small requests off Astra; any model you define in the proxy can go there. How the three slots behave with another non-Claude model is shown in [GLM-5.3-Flash in Claude Code: Setup That Actually Runs Flash](https://blog.laozhang.ai/en/posts/glm-5-3-flash-claude-code).

`CLAUDE_CODE_MAX_CONTEXT_TOKENS=272000` is optional but worth setting. Claude Code does not recognize `gpt-6-astra`, so it assumes a 200K-token window and compacts there. Astra's real window is 1,050,000 tokens, but OpenAI bills a request with more than 272K input tokens entirely at the higher $20 input and $75 output rate per 1M tokens. A 272,000 window therefore lets each request use more context while keeping it on the standard rate. That number is a cost choice, not an official recommendation, and with it set, the 200K warning stopped appearing.

To make the setup permanent, the same keys can go in the `env` block of your Claude Code settings file instead of shell exports. Where that file lives and which credential wins when you also have a Claude login are covered in [Claude Code API Configuration: Keys, Settings, Models, and Gateways](https://blog.laozhang.ai/en/posts/claude-code-api-configuration).

In the test, Claude Code ran the unit tests, searched and read the file, edited it, and re-ran the tests: 7 turns, 6 upstream calls, 4 of 4 tests passing. Claude Code sent eight `anthropic-beta` values and an `output_config` field, and none of them caused an error with `drop_params` on. That is one machine, one small task and one run, so treat it as proof that the plumbing works, not as a guarantee for long sessions.

## Codex plugin route: keep Claude, hand tasks to Astra

OpenAI's Codex plugin for Claude Code adds slash commands that pass work to your local Codex CLI, and the CLI can run that work on `gpt-6-astra` if you name the model. Claude remains the model you talk to; Codex does the delegated task and reports back. You need Node.js 18.18 or later and a Codex login, either a ChatGPT account or an OpenAI API key. Run these inside Claude Code:

1. Add OpenAI's marketplace: `/plugin marketplace add openai/codex-plugin-cc`
2. Install the plugin: `/plugin install codex@openai-codex`
3. Load it: `/reload-plugins`
4. Check Codex with `/codex:setup`. It offers to install the Codex CLI if it is missing; if Codex is installed but not signed in, run `!codex login` and choose ChatGPT or an API key.
5. Delegate a task and name the model: `/codex:rescue --model gpt-6-astra --effort medium fix the failing tests in textkit/slug.py`

Naming the model is the step that is easy to miss. The plugin's README says that "if you do not pass `--model` or `--effort`, Codex chooses its own defaults", and the installed rescue subagent leaves `--model` unset unless you mention a model. To make Astra the default without typing it each time, add these two lines to `~/.codex/config.toml`, or to `.codex/config.toml` in a trusted project:

```toml
model = "gpt-6-astra"
model_reasoning_effort = "medium"
```

Two more details come from the installed files of plugin version 1.0.6. The rescue subagent adds `--write` by default, so Codex edits your files rather than only suggesting changes. And the subagent itself is defined to run on Claude's `sonnet` model, so each handoff also uses some Claude usage before Codex starts.

The plugin was tested on November 12, 2026: version 1.0.6 installed into a fresh Claude Code configuration, Codex CLI 0.166.0 signed in with ChatGPT, and the plugin's runtime called exactly the way its rescue subagent calls it, with `--model gpt-6-astra --effort medium`. Codex fixed the same two-bug file in 28 seconds with all 4 tests passing, and its session log recorded `"model":"gpt-6-astra"`. Typing `/codex:rescue` in an interactive Claude session was not part of that run; the runtime that the command calls was.

Which ChatGPT plan you have decides whether Astra is available at all. As of October 26, 2026, OpenAI's plan pages gave Free and Go users GPT-6 Luna rather than Astra, Plus and standard Business roughly 5–45 Astra local messages per 5 hours in Work and Codex, and Pro no 5-hour limit. Plugin usage counts toward those Codex limits, and the plugin's optional review gate, which runs a Codex review every time Claude finishes, "may drain usage limits quickly" in the README's words. How Claude and Codex plans compare as tools is in [Claude Code vs Codex Cost: Plans, Limits, and the Real API Bill](https://blog.laozhang.ai/en/posts/claude-code-vs-codex).

Community tools that reuse a ChatGPT login to feed Claude Code directly, without Codex, are a different thing. OpenAI does not document that use, and none of them is covered by the results here; the plugin is the path OpenAI ships for putting a ChatGPT plan to work from inside Claude Code.

## How to check that gpt-6-astra is really answering

Claude Code's own screens tell you what it is asking for, not who answered. With the proxy setup, the header reads `gpt-6-astra · API Usage Billing`, and `/status` shows `Anthropic base URL: http://127.0.0.1:4011`, `Auth token: ANTHROPIC_AUTH_TOKEN` and `Model: gpt-6-astra`. If the base URL line is missing or shows a different address, your variables did not reach Claude Code. Those lines are the first check, and the proxy is the second.

The proof that Astra served the request is upstream of Claude Code. Start LiteLLM with `--detailed_debug` and each call shows the model and the upstream endpoint; in the test, every Astra call went to `https://api.laozhang.ai/v1/responses` with `gpt-6-astra` as the model. The same log is where you see that one message in an interactive session produced three requests on November 12, 2026: two to `gpt-6-astra` and one to the Haiku slot, `gpt-6-luna`, which named the session. Your upstream's usage page should then show the same model ID.

*Disclosure: [laozhang.ai is our own service](https://blog.laozhang.ai/en/about#laozhang). Its prices are platform pricing, not an independent comparison.*

Asking the model is weak evidence either way. In the proxy run, Astra ended its answer with "I am GPT-6 Astra (`gpt-6-astra`)", but in the plugin run Codex answered "I'm Codex, based on GPT-6" while its session log recorded `gpt-6-astra`. For the plugin route, `/codex:result` gives you the Codex session ID, and the session log for that ID records the model and `reasoning_effort` the task actually ran with.

## What one task cost, and why Claude Code shows about half

The two-bug fix cost between $0.20 and $0.29 per run at Astra's API list price, depending on effort, and Claude Code's printed cost was about half of that in every run. Claude Code has no price for `gpt-6-astra` (its result data marks the cost basis as `"unknown"`), so the number it prints is not Astra's. Use your upstream's usage page or your own calculation for real spend. The three proxy runs on November 12, 2026, each through laozhang.ai with the setup above:

*Disclosure: [laozhang.ai is our own service](https://blog.laozhang.ai/en/about#laozhang). Its prices are platform pricing, not an independent comparison.*

| Effort Claude Code sent | Time | Turns | Output tokens (of which reasoning) | Cost at Astra list price | Cost Claude Code printed |
| --- | --- | --- | --- | --- | --- |
| Default, sent as `high` | 19.2 s | 7 | 521 (37) | $0.228 | $0.114 |
| `low` | 17.5 s | 5 | 364 (0) | $0.203 | $0.101 |
| `max` | 34.4 s | 9 | 1,531 (963) | $0.289 | $0.144 |

The list-price column comes from the token counts the upstream returned, multiplied by Astra's prices per 1M tokens: $10 uncached input, $12.50 cache write, $1 cache read and $50 output. For the default run:

```text
uncached input       12 × $10.00 / 1M  = $0.000120
cache write      11,728 × $12.50 / 1M  = $0.146600
cache read       55,265 × $1.00  / 1M  = $0.055265
output              521 × $50.00 / 1M  = $0.026050
total                                    $0.228035 ≈ $0.228
```

About 64% of that run's cost was the first cache write of roughly 11,700 tokens, which is Claude Code's system prompt and tool definitions, paid once per session before any of your own work. A real session reads that cached prefix again on every turn and grows far beyond this task, so scale from the formula, not from the $0.228. The full price table, including the higher rate above 272K input tokens, is in [GPT-6 Astra API Pricing: $10/$50 per 1M Tokens, Caching Costs](https://blog.laozhang.ai/en/posts/gpt-6-astra-api-pricing).

![Bar chart of the same task at three effort levels: $0.228, $0.203 and $0.289 at Astra list price against $0.114, $0.101 and $0.144 printed by Claude Code, plus the default run split into cache write, cache read and output](https://blog.laozhang.ai/posts/en/gpt-6-astra-in-claude-code/img/task-cost.webp)

Effort carries over. Claude Code's effort setting reached Astra as `reasoning.effort`: `high` by default, and `low` or `max` when `CLAUDE_CODE_EFFORT_LEVEL` was set to those values, all three passing 4 of 4 tests. Astra accepts `low` through `max` and does not support `none` or `minimal`. One run per level on an easy task shows that the setting arrives, not which level is better for your work. How Claude Code chooses and keeps an effort level is covered in [Claude Code Effort Level: Model Defaults and Why It Won't Stick](https://blog.laozhang.ai/en/posts/claude-code-effort-level).

The plugin route bills differently. On a ChatGPT login, the 28-second task used 130,507 input tokens (112,128 of them cached) and 369 output tokens, counted against Codex usage limits rather than charged per token. It ran at effort `medium` in a different harness, so its token total cannot be set against the proxy rows.

## First errors when Claude Code talks to Astra

Most first errors come from a request reaching an endpoint that does not speak the format Claude Code uses. The four below are listed with their exact wording, what causes them, and the fix.

### API Error: 503 … no available channels for model gpt-6-astra

This is what Claude Code 2.1.316 printed on November 12, 2026 when `ANTHROPIC_BASE_URL` pointed straight at laozhang.ai with every model variable set to `gpt-6-astra`:

*Disclosure: [laozhang.ai is our own service](https://blog.laozhang.ai/en/about#laozhang). Its prices are platform pricing, not an independent comparison.*

```text
API Error: 503 Current group default has no available channels for model gpt-6-astra under billing mode [pay-as-you-go, pay-per-request] (request id: …). This is a server-side issue, usually temporary — try again in a moment. If it persists, check your inference gateway (api.laozhang.ai).
```

A direct `POST /v1/messages` with `curl` returned the same 503 with and without a tool, and the failed requests were not billed. The gateway's Anthropic-format endpoint has no channel for Astra, so retrying does not help, whatever Claude Code's generic "usually temporary" text says. The fix is the LiteLLM setup above, which sends Astra calls to the OpenAI-format endpoint instead. Other gateways may translate on their side; one `curl` to their `/v1/messages` with `"model": "gpt-6-astra"` tells you before you edit any settings.

### ⚠ Model "gpt-6-astra" isn't recognized · context assumed to be 200k tokens

This is a warning, not a failure. Claude Code shows it, or the longer form "Claude Code doesn't recognize the model "gpt-6-astra", so it assumes a context window of 200k tokens", for any model ID it does not know, and it then compacts the conversation at 200K. Setting `CLAUDE_CODE_MAX_CONTEXT_TOKENS` to a number declares the window instead, and for an ID like `gpt-6-astra` that does not start with `claude-`, the variable works on its own. With `272000` set, the warning disappeared and Claude Code reported a 272,000-token window.

### 400 "Extra inputs are not permitted" or tool calls that fail

Claude Code sends Anthropic-only fields to any gateway: `anthropic-beta` headers, `output_config.effort`, `context_management`, cache markers and beta tool fields. Anthropic's gateway documentation says a proxy that forwards those to an upstream with a different schema produces 400 errors such as `Extra inputs are not permitted`. Claude Code retries once without the effort and context-management fields when those are rejected. Keep `drop_params: true` in the LiteLLM config, and if a 400 still appears, set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` to cut down the beta fields. The test produced no 400 at all with `drop_params` on.

Tool calls can fail for a separate reason. On OpenAI's own API, Astra supports function calling only through the Responses API, not Chat Completions. A proxy that talks to OpenAI over Chat Completions will therefore break as soon as Claude Code tries to read or edit a file. LiteLLM used `/v1/responses` for every Astra call in the test.

### The proxy rejects a claude- model name

If LiteLLM answers with an unknown-model error naming a Claude model, one of the slot variables is missing. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL` and `ANTHROPIC_DEFAULT_HAIKU_MODEL`, Claude Code asks for its built-in Claude IDs, which your proxy does not define. Set all four variables from step 5, or add `model_name` entries for the IDs it asks for.

## What may break: features the test did not cover

The test exercised file search, reads, edits and shell commands in one short task, and nothing else. Anthropic's server-side tools such as WebSearch and WebFetch, image input, subagents, MCP servers, long sessions and auto-compaction were not run through Astra, and some of them depend on Anthropic-side features that a translating proxy may not reproduce. If you need web search, LiteLLM's documentation lists a separate page titled "Claude Code - WebSearch Across All Providers". Two alternatives also sit outside these results: an OpenAI key sent straight to `api.openai.com` through the same config, and Claude Code Router. Team users should also know that with a custom `ANTHROPIC_BASE_URL`, `/status` reported remote managed settings and organization policy as "not fetched", so remote policies an admin sets do not reach the session.

A Claude Code update can also add a header or field that the proxy passes on and the upstream rejects. When something stops working after an update, the `curl` check from step 4 tells you whether the proxy or Claude Code changed.

## GPT-6 Astra in Claude Code: other questions

### Can I use other OpenAI models in Claude Code the same way?

Yes. Any model your upstream serves can be added as another `model_name` entry in the LiteLLM config and put in a slot variable. LiteLLM's own tutorial uses `gpt-6.1-sol` and `gpt-6-luna`, and in the November 12, 2026 test `gpt-6-luna` handled Claude Code's session-title requests from the Haiku slot. For DeepSeek through OpenRouter, see [Claude Code with OpenRouter and DeepSeek: Setup, Routes, and First-Error Fixes](https://blog.laozhang.ai/en/posts/claude-code-openrouter-deepseek).

### Can I pick gpt-6-astra from the /model menu?

Claude Code's documentation describes two ways: set `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1` so Claude Code reads the proxy's `/v1/models` list at startup and adds those models to the picker, or set `ANTHROPIC_CUSTOM_MODEL_OPTION` to add one entry. LiteLLM's tutorial uses the discovery variable. The setup above selects Astra through the model variables instead, which works without either.

### Is Claude Code Router an alternative to LiteLLM?

It does the same job. Claude Code Router 3.1.3, released October 9, 2026, is a desktop app (also installable with `npm install -g @musistudio/claude-code-router`, Node.js 22+) that runs a local gateway on `http://127.0.0.1:3456`, and its README lists OpenAI Chat and Responses among the upstream formats. Providers are added in its interface rather than a YAML file. The results above come from LiteLLM, not from Claude Code Router.

### Is "Astra 6" a different model from GPT-6 Astra?

No. "Astra 6" is shorthand people use for GPT-6 Astra, OpenAI's model with the API ID `gpt-6-astra`, released September 3, 2026.

### Is GPT-6 Astra better than Claude for coding?

That depends on the task and on what each costs per finished task, which is compared in [Claude Fable 5.2 vs GPT-6 Astra: When Each Costs Less per Task](https://blog.laozhang.ai/en/posts/claude-fable-5-2-vs-gpt-6-astra).
