Docs · Provider
OpenAI in Claude Code, Codex, Gemini CLI and OpenCode
OpenAI serves its models on two APIs at api.openai.com: Responses and Chat Completions. Its own models are best asked on Responses, and its newest answer only there. Add an OpenAI API key to packinggoods once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use OpenAI’s models through packinggoods’s local gateway at 127.0.0.1:3425, each agent with a model of its own. Codex’s requests go to OpenAI as they are; the other agents’ are translated on the way.
This page is about an API key from platform.openai.com. A ChatGPT Plus or Pro subscription is signed in to separately; see Subscriptions in any agent.
Add OpenAI
- Get a keyMake one on platform.openai.com. It starts with
sk-. - Add the providerIn packinggoods’s Providers tab, press + Add provider, pick OpenAI, paste the key and save. packinggoods asks OpenAI which models the key can use.
- Pick it for an agentIn the Agents tab, click the model on the agent’s row and choose an OpenAI model such as
gpt-6.1-sol.
packinggoods provider add openai <key> packinggoods provider test openai
Model ids in packinggoods are provider/model, so OpenAI’s read openai/gpt-6.1-sol: the provider, then OpenAI’s own id. The key is kept in packinggoods’s settings; packinggoods doesn’t take it from your shell.
Already set OpenAI up in OpenCode or another app packinggoods imports from? The import brings it in as the OpenAI provider.
Endpoints
| API | Address | Used for |
|---|---|---|
| Responses | https://api.openai.com/v1 | OpenAI’s own models, ids starting gpt-, codex or o and a digit: Codex’s requests as they are, Claude Code’s, Gemini CLI’s and OpenCode’s translated |
| Chat Completions | https://api.openai.com/v1 | the model list, and any other model the key lists |
packinggoods’s OpenAI provider has no Anthropic Messages address, so Claude Code’s requests are always translated. For OpenAI’s own models packinggoods keeps Responses first even for an agent that speaks Chat Completions. When OpenAI answers that a model is served only on /v1/responses, packinggoods asks again there and remembers it. To send a model on one API yourself:
packinggoods model api openai/gpt-5.5 chat packinggoods model api openai/gpt-5.5 --reset packinggoods model apis openai
Azure OpenAI is a provider of its own, Azure OpenAI. Give it your resource’s endpoint, https://<resource>.openai.azure.com, and its key. packinggoods uses the v1 API under /openai/v1 for Chat Completions and Responses, sends the key in the api-key header, and lists the resource’s deployments as its models. A deployment named for its model, such as gpt-5-codex, goes to Responses first too.
Model list
packinggoods fetches the list from OpenAI, at https://api.openai.com/v1/models, so agents see the models your key can use. Names, context windows, reasoning levels and prices come from models.dev’s openai catalog. A reasoning model OpenAI has just listed, before its levels are known, gets those of the newest reasoning model in its family: gpt-6.1-sol got gpt-6-sol’s. Pick the models agents see in the provider’s model list, or from the terminal:
packinggoods provider models openai +gpt-6.1-sol +gpt-6-luna +gpt-5.5 packinggoods provider refresh-every openai 1d
In each agent
packinggoods claude openai/gpt-6.1-sol packinggoods codex openai/gpt-6.1-sol packinggoods gemini model openai/gpt-6.1-sol packinggoods opencode openai/gpt-6.1-sol
- Claude Code speaks Anthropic Messages, which OpenAI doesn’t serve. packinggoods translates each request to Responses and the reply back; the model’s reasoning summary reaches Claude Code as thinking, then the text. Models in Claude Code.
- Codex speaks Responses, so its requests go to OpenAI as they are: its custom tools such as
apply_patch, its reasoning items and its ownprompt_cache_keyincluded. Codex is also offered Fast here; see Reasoning. Models in Codex. - Gemini CLI speaks Google’s Gemini API. packinggoods translates each request to Responses and the reply back. Models in Gemini CLI.
- OpenCode speaks Chat Completions. OpenAI’s own models go to Responses first, so packinggoods translates its requests there and the replies back; any other model the key lists gets OpenCode’s requests as they are. Models in OpenCode.
What packinggoods does for OpenAI
- A prompt cache key. A translated request to OpenAI that carries no
prompt_cache_keygets one, made from the session the agent names, or else its first user message, and hashed, so it names nothing of the agent. Codex sends its own, which goes on as it is, and one you set yourself wins. If OpenAI answers 400 over the field, packinggoods asks again without it. - Tools loaded where they were loaded. A tool that Claude Code’s tool search loads mid-conversation is sent to OpenAI’s Responses API as an
additional_toolsitem at that point, not added to the tool list, which keeps the cached prefix.additional-tools=offputs it with the other tools. - Sealed reasoning from elsewhere. OpenAI reads only its own sealed reasoning (
encrypted_content). An item sealed under another key, organization or account is refused (“could not be verified”); packinggoods asks again without those items and remembers it for the conversation. Claude’s thinking, which Codex carries in a reasoning item after a turn on a Claude model, is taken out before the request reaches OpenAI. - Earlier responses. A Responses client may send only a turn’s new input and name the response it follows (
previous_response_id). packinggoods keeps each response it gave such a client, in memory and under the caller’s gateway key. OpenAI keeps responses too, so when the same key answered the one named, OpenAI is sent only the new input after its own id. Codex over HTTP saysstorefalse and names none. - Codex’s own compaction. With
compaction=native, Codex’s compaction is asked of OpenAI as Codex sent it and the sealed item comes back to Codex as it came. Only the key that sealed it can read it, so later requests carrying it go only there. The default,compaction=packinggoods, has packinggoods summarise.
packinggoods provider set openai compaction=native packinggoods provider set openai additional-tools=off
Reasoning
- Effort. The effort an agent asks for is fitted to the nearest level the model has, as the catalog lists them:
gpt-6-solhasnone,low,medium,high,xhighandmax. On Responses it is sent asreasoning.effort, withsummaryset toauto, so the model’s reasoning summary comes back. - Reasoning off. When an agent whose requests packinggoods translates, such as Gemini CLI, turns reasoning off and the model lists
noneamong its levels, packinggoods asks for none. - Encrypted reasoning. packinggoods passes on what an agent asks to include, but asks for
reasoning.encrypted_contentonly with reasoning: OpenAI refuses it of a model that doesn’t reason. Codex sends the sealed items back on the next turn, and packinggoods passes them on as they are. - Fast. On an OpenAI key, Codex is offered Fast for GPT and o-series models. packinggoods sends it as
service_tier: "priority", OpenAI’s priority processing. A service tier set for Codex in packinggoods overrides what Codex asked.
Web search
OpenAI’s Responses API searches the web itself. When an agent offers its model web search, as Codex and Claude Code do, packinggoods gives the model OpenAI’s own web_search tool on Responses, and OpenAI runs the search.
Cost and usage
- Cost. The Usage tab prices each call with OpenAI’s prices from models.dev.
- Cache tokens. When a reply reports cached prompt tokens, the Usage tab counts them apart from the rest of the prompt.
- Keeping the cache. With several keys, a conversation stays on its key while its cache is worth keeping, 1,024 tokens or more, and still warm, read within the last five minutes.
- Service tier. Each call records the tier the agent asked for, the one packinggoods sent, and the one OpenAI’s reply says it ran at.
- Balance. packinggoods reads no balance from OpenAI; type it in with
key-balance, and the Usage page shows it less what packinggoods has priced the key’s calls at since.
Several keys and failover
One OpenAI provider can hold several keys: press Add another key under it, or paste several at once. Requests go to the first key that’s on, and when it runs out or is rate limited the next one takes over. To keep keys apart instead, say from two organizations, add the provider again: the second is openai-2.
- Spend caps.
spend-capstops a key at a dollar amount a day, a month or in all, as the Usage tab prices its calls; routing then goes on to the other keys and the fallbacks. - Fallbacks.
fallbacknames where requests go when OpenAI is out of quota or down: another provider’s model or a routing group.
packinggoods provider spend-cap openai <key> 20 month packinggoods provider key-balance openai <key> 25 packinggoods provider fallback openai deepseek/deepseek-v4-pro
Troubleshooting
- “The encrypted content for item rs_… could not be verified”. The conversation carries reasoning sealed under another key, organization or account. packinggoods asks again without those items; see What packinggoods does.
- A model that answers only on
/v1/responses. packinggoods moves it to Responses and remembers it.packinggoods model apis openaishows which API each model is asked on. - A 400 over
prompt_cache_key. packinggoods asks again without the key it added. - Checking a key.
packinggoods provider test openaisends a tiny request through each endpoint, or to each model you name. Add--as codexor--as claude-codeto send it the way that agent would.
Azure OpenAI in Codex, Claude Code and other agents
FAQ
How do I use OpenAI’s models in Claude Code?
Add your OpenAI API key in packinggoods (Providers, Add provider, OpenAI), then pick a model such as gpt-6.1-sol on Claude Code’s row, or run packinggoods claude openai/gpt-6.1-sol. OpenAI serves no Anthropic Messages API, so packinggoods translates Claude Code’s requests to OpenAI’s Responses API at https://api.openai.com/v1 and the replies back, the reasoning summary as thinking.
Can Codex use an OpenAI API key instead of a ChatGPT sign-in?
Yes. Add the key, then run packinggoods codex openai/gpt-6.1-sol. Codex speaks Responses, so its requests go to OpenAI as they are, custom tools and reasoning included, and Fast is sent as priority processing. A ChatGPT Plus or Pro sign-in is set up separately, in Subscriptions.
How do I use GPT models in OpenCode?
Pick the model in packinggoods, or run packinggoods opencode openai/gpt-6.1-sol. OpenCode speaks Chat Completions, but OpenAI’s own models go to Responses first, so packinggoods translates OpenCode’s requests there and the replies back. To send a model on Chat Completions instead, run packinggoods model api openai/gpt-5.5 chat.
Can Gemini CLI use OpenAI?
Yes. Gemini CLI speaks Google’s Gemini API, so packinggoods translates its requests to OpenAI’s Responses API and the replies back, streaming and tool calls included. Run packinggoods gemini model openai/gpt-6.1-sol.
Does packinggoods keep OpenAI’s prompt cache?
Yes. Codex’s own prompt_cache_key goes on as it is. A translated request without one gets a key made from its session or first user message, hashed so it names nothing of the agent. With several keys, a conversation stays on its key while its cache is warm.
Why does OpenAI say the encrypted content could not be verified?
OpenAI reads only reasoning it sealed for the same key, organization or account. When a conversation carries reasoning sealed elsewhere, packinggoods asks again without those items and remembers it for the conversation.
Does packinggoods support Azure OpenAI?
Yes, as its own provider, Azure OpenAI. Give it the resource’s endpoint and key; packinggoods uses the v1 API under /openai/v1, sends the key in the api-key header and lists the resource’s deployments as models.
By provider: DeepSeek · Kimi and Kimi Code · GLM Coding Plan · Volcengine Ark · Tencent Cloud · Baidu Qianfan · SiliconFlow · ModelScope · Huawei Cloud MaaS · Xiaomi MiMo · StepFun · LongCat · Qwen · MiniMax · Anthropic · Gemini · Grok · Mistral · OpenRouter · GitHub Copilot · Ollama
Every agent: Models in Claude Code, Models in Codex, Models in Gemini CLI, Models in OpenCode. Ask on Discord if you get stuck.