How to Connect OpenAI Models to OpenClaw

OpenClaw can run OpenAI's GPT models with a Platform API key or with your ChatGPT account through Codex login. This guide shows which sign-in to pick, the exact setup commands, which model reference to use, and how images, voice and costs work on each route.

Quick answer

Using a ChatGPT plan? Run openclaw models auth login --provider openai and sign in in your browser. Paying per use? Run openclaw onboard --openai-api-key "$OPENAI_API_KEY". Either way, check your models with openclaw models list --provider openai. New setups default to openai/gpt-6-astra.

Three sign-in methods

API key, Codex login or Sign in with ChatGPT?

All three use the same provider name, openai, and the same model references such as openai/gpt-6-astra. What changes is who pays and which extra OpenAI tools work.

uses your ChatGPT plan

Codex login

  • Sign in with your ChatGPT account. No API key.
  • Uses your Codex allowance and shows quota in OpenClaw
  • Device-code option for servers without a browser
  • Models depend on what your plan offers
pay per use

Platform API key

  • Billed to your OpenAI Platform project
  • Full access to images, voice, speech and embeddings
  • Supports Fast mode and Admin usage reports
  • Pay for every token, so set a budget
beta

Sign in with ChatGPT

  • Authorizes OpenClaw as its own app on your account
  • Uses your Codex allowance
  • No image generation, voice or embeddings yet
  • Your workspace must have it enabled by OpenAI
Is using a ChatGPT plan allowed?

Yes. The OpenClaw docs state that OpenAI explicitly supports subscription sign-in in external tools such as OpenClaw. Usage still counts against your plan's limits.

Sign-in picker

Which OpenAI sign-in fits you?

How do you want to pay?
Where does OpenClaw run?
Do you need images, voice or memory search?
Recommendation
    See the steps
    Route 1

    Connect with your ChatGPT account (Codex login)

    1

    Sign in

    Run this on the computer running OpenClaw. It opens your browser to sign in to ChatGPT:

    Terminal
    openclaw models auth login --provider openai

    On a server without a browser, use the device-code flow and approve it from your phone or laptop:

    Terminal
    openclaw models auth login --provider openai --method device-code

    The setup wizard does the same: openclaw onboard --auth-choice openai. OpenClaw no longer imports logins from ~/.codex, so sign in through one of these.

    2

    Choose the model

    Terminal
    openclaw config set agents.defaults.model.primary openai/gpt-6-astra

    No runtime setting is needed. OpenClaw may run the turn through its bundled Codex app-server runtime, and it installs or repairs the Codex plugin when that happens. If your plan doesn't include Astra, pick another model from openclaw models list --provider openai.

    3

    Verify

    Terminal, then chat
    openclaw models list --provider openai
    # then, in a chat with your assistant:
    /codex status
    /status

    /status shows Runtime: OpenAI Codex when the Codex runtime is active.

    Route 2

    Connect with an OpenAI Platform API key

    1

    Create a key

    Create a key at platform.openai.com/api-keys, add credit, and set a project budget. Make a separate key for OpenClaw so you can revoke it on its own.

    2

    Run onboarding

    Terminal
    export OPENAI_API_KEY="sk-..."
    openclaw onboard --openai-api-key "$OPENAI_API_KEY"

    Onboarding saves the key as an openai auth profile, which agent turns use. The OPENAI_API_KEY variable alone is a fallback for other OpenAI features such as images and speech.

    3

    Pick a model and test

    Terminal
    openclaw models list --provider openai
    openclaw models set openai/gpt-6-astra
    openclaw models status --probe --probe-provider openai
    Beta

    Sign in with ChatGPT (SIWC)

    SIWC authorizes OpenClaw as its own app on your ChatGPT account and spends your Codex allowance. Your account and workspace must have SIWC and token sharing enabled by OpenAI.

    Terminal
    openclaw models auth login --provider openai --method siwc
    1. Approve token sharing during sign-in. If you approve identity only, OpenClaw saves the account but can't run models with it.
    2. The browser returns to http://localhost:8080/auth/callback. If your browser is on another computer, forward the port first:
      On your browser's computer
      ssh -N -L 8080:127.0.0.1:8080 user@gateway-host
    3. Check shared usage at ChatGPT Settings → Usage. OpenClaw doesn't show SIWC quota.
    Current SIWC limits

    Function tools and web search work. OpenAI-hosted plugins, connected apps, hosted MCP tools and hosted image generation don't yet. SIWC also can't be used for image generation, transcription, speech or memory embeddings. Add a separate key or provider for those.

    Models

    Choose a GPT model

    Run openclaw models list --provider openai to see what your account can use. API projects and ChatGPT plans can offer different models.

    ModelReferenceReasoning off?API price in / out*
    GPT-6 Astra defaultopenai/gpt-6-astraNo$10 / $50
    GPT-6.1 Solopenai/gpt-6.1-solNo$2 / $10
    GPT-6 Solopenai/gpt-6-solYes$2 / $10
    GPT-6 Luna low costopenai/gpt-6-lunaYes$0.10 / $0.50
    GPT-5.6 Sol / Terra / Lunaopenai/gpt-5.6-sol, -terra, -luna—See OpenAI
    GPT-5.5openai/gpt-5.5—See OpenAI
    ChatGPT Instant (moving alias)openai/chat-latest—API key only

    *US dollars per million tokens at standard API rates, as listed in the OpenClaw docs. Check OpenAI's pricing page for current rates. GPT-6 models accept text and images and have a 1,050,000-token context window. OpenClaw uses 272,000 tokens of active input by default. For images, use openai/gpt-image-2.

    OpenClaw won't swap your model silently

    If your account can't use the model you picked, you'll see OpenAI's access error. Choose another, for example openclaw models set openai/gpt-5.5. GPT-5.4 and GPT-5.4 Mini are retired on the ChatGPT route, and openclaw doctor --fix moves them to GPT-5.6 Terra and Luna.

    Make it yours

    OpenAI config builder

    Build your OpenAI settings

    Sign in first with the commands above. Then copy this into ~/.openclaw/openclaw.json and run openclaw gateway restart.

    ~/.openclaw/openclaw.json (JSON5)

    Check your real profile names with openclaw models auth list --provider openai and adjust the auth.order list to match. With a backup key, OpenClaw tries the plan first, then the key.

    Reasoning

    Set the reasoning effort

    GPT-6 models default to medium effort. Change it from any chat:

    In a chat with your assistant
    /think high      # harder problems
    /think default   # back to medium
    /think ultra     # lets OpenClaw split big jobs across sub-agents
    /fast on         # Fast mode (API key, higher price)
    • /think off works on GPT-6 Sol and Luna. Astra and GPT-6.1 Sol can't turn reasoning off.
    • /think ultra isn't a raw API setting. It's OpenClaw's orchestration mode, running at max effort.
    • A saved minimal setting becomes low.
    Beyond chat

    Images, voice and memory search

    Not every OpenAI tool works with every sign-in. Here's what each one covers, according to the OpenClaw docs:

    FeatureAPI keyCodex loginSIWC
    Chat, tools, web searchYesYesYes
    Image generationYesWith OpenClaw sign-inNo
    Audio transcriptionYesDepends on planNo
    Realtime voiceYesSome routesNo
    Text-to-speech, memory embeddingsYesSeparate key neededSeparate key needed

    Use OpenAI embeddings for OpenClaw's memory search:

    ~/.openclaw/openclaw.json (JSON5)
    {
      memory: {
        search: {
          provider: "openai",
          model: "text-embedding-3-small",
        },
      },
    }
    Spend

    Cost and usage tracking

    Plan quota

    Codex login shows your plan, quota windows and credit balance in OpenClaw.

    Real API spend

    Set OPENAI_ADMIN_KEY to see 30 days of actual cost in the Control UI Usage page. OPENAI_PROJECT_ID limits it to one project.

    Long prompts cost more

    Above 272,000 input tokens, OpenAI bills the whole request at 2x input and 1.5x output rates.

    Fast mode stacks with long-context pricing

    Fast mode (formerly Priority processing) sends service_tier: "priority" and costs more. On GPT-5.6 Sol it's another 2x, so a long Fast request can cost 4x normal input. Keep it off unless speed really matters. More: OpenClaw running costs.

    Troubleshooting

    Fix common OpenAI connection problems

    Diagnose first
    openclaw models status
    openclaw models auth list --provider openai
    openclaw doctor --fix
    openclaw config validate
    No usable OpenAI profile

    Sign in again with openclaw models auth login --provider openai, then run openclaw models status --probe --probe-provider openai.

    Old codex/… model refs

    openclaw doctor --fix rewrites legacy codex/*, openai-codex/* and codex-cli/* refs to openai/*.

    Model not available

    Your account doesn't include it. Run openclaw models list --provider openai and pick one that's listed, for example openai/gpt-5.5.

    Missing billing

    The API key's organization has no credit. Top up at platform.openai.com/account/billing.

    SIWC signed in but can't chat

    You approved identity only. Sign in again and approve token sharing.

    Sign-in page won't return

    On a remote server, use --method device-code, or forward port 8080 over SSH for SIWC.

    More fixes: troubleshooting guide.

    FAQ

    OpenAI and OpenClaw questions

    Can I use my ChatGPT subscription with OpenClaw?

    Yes. Run openclaw models auth login --provider openai and sign in with your ChatGPT account. OpenClaw then uses your Codex allowance. According to the OpenClaw docs, OpenAI explicitly supports subscription sign-in in external tools like OpenClaw.

    Which OpenAI model does OpenClaw use by default?

    Fresh setups use openai/gpt-6-astra with either an API key or a ChatGPT plan. Lower-cost options include GPT-6 Sol and GPT-6 Luna. Run openclaw models list --provider openai to see which models your account can use.

    How do I connect OpenAI on a server without a browser?

    Use the device-code flow: openclaw models auth login --provider openai --method device-code. Approve the code in a browser on any other device. Or use a Platform API key instead.

    Do I still need an API key if I use Codex login?

    Not for chat. You may want one for memory embeddings, text-to-speech or as a backup when your plan's allowance runs out. Add it with openclaw models auth login --provider openai --method api-key.

    What is the difference between Codex login and Sign in with ChatGPT?

    Both use your ChatGPT account and Codex allowance. Codex login uses the Codex product sign-in and supports image generation. Sign in with ChatGPT is a beta that authorizes OpenClaw as its own app, but it doesn't support image generation, voice or embeddings yet.

    Can I use Azure OpenAI with OpenClaw?

    Yes. The bundled openai provider can point at an Azure OpenAI resource. On Azure, model names are your deployment names. See the official OpenClaw Azure OpenAI page for setup.

    Related guides