Use a 1M context window with OpenAI, Gemini, and other non-Claude models
Claude Code sizes the context window from the model name. Learn how Onevium handles 1M context per connection type, and how to add a [1m] model entry for OpenAI Responses, Chat Completions, and Gemini providers.
Get startedWhy a 1M model still compacts at 200K#
Every Onevium conversation runs inside Claude Code, including conversations on OpenAI, Grok, or Gemini connections. For those, Onevium starts a local bridge that translates Claude Code's requests into the provider's own API.
Claude Code does not ask the provider how large the model's context window is. It reads the model name:
- A name that contains
[1m]is treated as a 1M-token window. - A name that starts with
claude-uses Claude Code's built-in table. - Any other name is an unknown model, assumed to have a 200K window, and the conversation is auto-compacted near that limit.
So a GPT-6 Astra conversation shows /context at about 200k even though the model itself accepts more than 1M tokens. The contextWindow value in Manage Models only drives Onevium's own usage bar. Claude Code never reads it.
Claude Code strips the [1m] suffix before the request leaves the machine, so the upstream service still receives the plain model ID. The suffix appears in the model label under the composer and in /context; that is expected.
Before you start#
- Confirm the model's real window with the provider. Only add
[1m]to a model whose documented window is at least 1M tokens. Claude Code then assumes 1M and will send prompts up to that size; a smaller model returns an error instead of compacting. - Have the provider connected and working with a short message first. See providers and models or custom providers.
- Know which connection type the entry uses. Settings → Providers shows it on each entry; a preset selects it for you.
What each connection type needs#
| Connection type | Examples | What gives the 1M window | What you do |
|---|---|---|---|
| Anthropic (official) | Anthropic preset, Claude Code sign-in | Fable 5.1, Opus 5, and Sonnet 5 run with 1M natively. For Opus 4.8 or Sonnet 4.6, Settings → Claude CLI → 1M Context Window appends [1m] for Claude models | Usually nothing. Turn on the global toggle for older Claude models |
| Anthropic-compatible presets | DeepSeek, GLM (CN) / z.ai, Moonshot, MiniMax | The preset's (1M) entries already map to an upstream ID with the suffix, such as deepseek-flash[1m], glm-5.3[1m], kimi-k3[1m], MiniMax-M3[1m] | Pick the entry whose display name ends in (1M) |
| Kimi Coding Plan | k3-256k, kimi-for-coding | The preset declares a 256K window (CLAUDE_CODE_MAX_CONTEXT_TOKENS). K3 with 1M is a plan entitlement, not a default | Stay at 256K unless your plan includes 1M; then follow the manual entry steps below with k3 |
| Custom Anthropic Messages gateway | A relay of the Anthropic API | Advanced Options → Endpoint supports 1M context plus the global toggle appends [1m] for Claude models | Turn on both switches. For non-Claude IDs, add a [1m] entry as below |
| OpenAI Responses, OpenAI Chat Completions, Google Gemini | OpenAI, Grok, Google Gemini presets, custom gateways of these types | Nothing automatic. The bridge forwards whatever model ID Claude Code sees | Add a model entry whose Model ID ends in [1m] and whose Upstream model ID is the plain name |
The last row is the case this guide is about. Onevium does not yet add the suffix for these connection types on its own, so the following steps are the supported configuration.
Add a [1m] model entry for an OpenAI, Grok, or Gemini connection#
- Open Settings → Providers, find the connection, and click Manage Models.
- Click Add custom model, then expand the new row's Advanced fields.
- Fill in the three fields. Use your own model IDs; the table shows the OpenAI preset as an example.
| Field | Value | Why |
|---|---|---|
| Model ID | gpt-6-astra[1m] | This is the name Claude Code sees, so it must carry the suffix |
| Upstream model ID | gpt-6-astra | This is the name the bridge sends to the provider. Keep it plain |
| Display name | GPT-6 Astra (1M) | Any label that tells the two entries apart in the model menu |
- Tick the new entry so it appears in the model menu. You can leave the original entry visible as well, or untick it to avoid picking the 200K variant by mistake.
- Click Save. Onevium refreshes the model menu when you save from this dialog.
Repeat for each model you want at 1M, for example gpt-5.6-sol[1m] → gpt-5.6-sol and gpt-5.6-luna[1m] → gpt-5.6-luna. The OpenAI GPT-6 and GPT-5.6 models document a 1.05M window. Grok 4.7 documents 500K, so it does not qualify. Check the Gemini model page for the model you use.
Do not put [1m] in Upstream model ID. Some gateways happen to accept it, but the official OpenAI and Gemini APIs do not, and the bridge always forwards the upstream field unchanged.
Roles, subagents, and child sessions#
The entry you add covers the main conversation. Two other places pick a model on their own:
- Roles and subagents. Claude Code resolves the Opus, Sonnet, Haiku, and Subagent roles from the connection's role mapping. For Anthropic-compatible connections you can edit that mapping in Advanced Options → Model routing and append
[1m]there, which the field's hint already suggests. For OpenAI Responses, Chat Completions, and Gemini presets, the mapping comes from the preset and is not editable in 1.2.1, so spawned subagents keep the preset's default window. A future release will surface this mapping for these connection types. - Child sessions created by the AI. The
create_sessiontool resolvesmodelagainst the same model menu. Onevium 1.2.1 rejected IDs containing square brackets, sogpt-6-astra[1m]could not be passed. Onevium 1.2.2 accepts the suffix. Until you upgrade, let child sessions inherit the parent's model instead of passing one explicitly.
Confirm the window#
- Start a new conversation. Existing conversations keep the model they started with.
- Select the entry whose name ends in (1M).
- Send
/context. The total should read1mrather than200k. - Send a short message such as “Reply only: received.” to confirm the bridge still answers with the plain upstream ID.
If the total still shows 200k, the conversation is on the old entry, or the Model ID was saved without the suffix. Open Manage Models and check the row.
Troubleshoot#
| Symptom | What to check |
|---|---|
| The new entry does not appear in the model menu | Confirm it is ticked and saved. If you changed models through the local API rather than this dialog, open the provider entry and click Update, or restart Onevium |
| The provider returns an unknown-model error | The suffix ended up in Upstream model ID. Move it to Model ID only |
| Switching the connection type to Anthropic Messages did not help | Claude Code still sees the plain name and keeps 200K. Gateways may also refuse /v1/messages for an OpenAI key. Keep the connection type that matches the API and add the entry instead |
Setting CLAUDE_CODE_AUTO_COMPACT_WINDOW in ~/.claude/settings.json did nothing | Claude Code caps that value at the model's assumed window, which stays 200K for an unknown name. The suffix is the switch, not this variable |
The model label shows gpt-6-astra[1m] | Expected. Claude Code strips the suffix before sending the request |
Next steps#
Review the full provider list, or configure a team gateway with a custom connection. To see how much of the window a conversation uses, read about session data.