Skip to content

Docs

Set up Codexwith LotusAI.

One command points the Codex CLI and IDE extension at LotusAI. This guide covers the installer, the exact config.toml, models, reasoning effort, the API and fixes for common errors.
~/project
$ npx lotusai
LotusAI setup wizard for Codex
Your LotusAI key: sk-lotus-••••••••
Codex config updated: ~/.codex/config.toml (key stored in the lotusai block)
LOTUSAI_API_KEY saved for SDKs and curl
Default model: gpt-6.1-sol
Key verified
$ codex

01 / Quick start

From key to codex in two minutes.

Get a key from your reseller, run one command, start Codex. The installer writes the key into the lotusai provider block in ~/.codex/config.toml, so Codex finds it in every terminal and in the IDE extension.
  1. Get a key

    Get Plus or Pro from the authorised reseller who referred you. Get access explains how. Your key starts with sk-lotus.

  2. Run the installer

    Pick your system below. One command writes the provider block, key included.

  3. Start codex

    Open a terminal in your project and run codex. Inside, /status shows the provider: lotusai.

One key, one person: a key works on up to 5 devices at the same time. Keys used on more devices are treated as shared and suspended without refund.

bash or zsh
$ curl -fsSL https://lotusai.pro/setup.sh | bash
  • Asks for your key once, or reads LOTUSAI_API_KEY from the environment
  • Writes the key into a marked lotusai provider block in ~/.codex/config.toml and backs up the old file
  • Codex finds the key in every terminal, the IDE extension and the Codex app
  • Keeps every other setting and provider you already have
  • Installs the Codex CLI with npm when it is missing
  • Checks the key against the API before it finishes
  • Safe to run again: it replaces its own block, never appends twice
  • Also saves LOTUSAI_API_KEY in your shell profile, for curl and SDKs
optional: no prompt, or a different default model
$ curl -fsSL https://lotusai.pro/setup.sh | bash -s -- sk-lotus-...
$ curl -fsSL https://lotusai.pro/setup.sh | LOTUSAI_MODEL=gpt-6-astra bash

When it is done, go to a project and run codex.

Prefer to read a script before you run it? Both installers are plain text at lotusai.pro/setup.sh and lotusai.pro/setup.ps1.

02 / Manual setup

Or edit the file yourself.

This is what the installer writes for Codex: one provider block in the Codex config, with your key in it.

1. Add the provider to ~/.codex/config.toml

~/.codex/config.toml
model_provider = "lotusai"
model = "gpt-6.1-sol"
[model_providers.lotusai]
name = "LotusAI"
base_url = "https://api.lotusai.pro/v1"
experimental_bearer_token = "sk-lotus-..."
wire_api = "responses"
requires_openai_auth = false
  • model_provider and model go at the top of the file, above any [table].
  • On Windows the file is %USERPROFILE%\.codex\config.toml. If you set CODEX_HOME, it lives there instead.
  • wire_api must be "responses": current Codex rejects "chat".
  • experimental_bearer_token holds your key, and requires_openai_auth = false stops Codex asking for a separate sign-in.
  • There is no env_key line on purpose. With it, Codex stops with Missing environment variable in any terminal, editor or app that does not have the variable, and it checks env_key before the key in the block.
  • Keep the provider id lotusai as written. Codex treats some provider names specially, so do not rename it.

2. Replace the placeholder with your key

Put your key between the quotes on the experimental_bearer_token line, in place of sk-lotus-.... The key stays in config.toml, so keep that file private: out of repositories, screenshots and shared dotfiles.

macOS and Linux: make the file readable only by you
$ chmod 600 ~/.codex/config.toml

3. Start Codex

terminal
$ cd ~/your-project
$ codex

Treat the key like a password. If it leaks, ask your reseller to rotate it, then put the new key on the same line.

03 / Choosing a model

Every model, one key.

Both plans include every model. Start on gpt-6.1-sol, the model Codex recommends, and switch when the task changes. This list is read live from GET /v1/models.
Models available on every LotusAI key
Model idTypeReasoningReach for it when
gpt-6.1-solGPT-6.1 SolRecommendedlow to maxFeatures and fixes, Multi-file refactors, Long agentic sessions
gpt-6.2-astraGPT-6.2 AstraFlagshiplow to maxHardest problems, Architecture and migrations, Long agentic projects
gpt-6.2-solGPT-6.2 SolNewlow to maxEveryday coding, Agents at scale, Features and fixes
gpt-6.1-terraGPT-6.1 TerraEfficientnone to maxRoutine tasks, Screenshots and UI work, Docs and writing
gpt-6-astraGPT-6 AstraFlagshiplow to maxHard debugging, Architecture and migrations, High-stakes changes
gpt-6-solGPT-6 SolAll-roundernone to maxCode review, Test generation, Day-to-day work
gpt-6-lunaGPT-6 LunaFastnone to maxQuick edits, Lint and format fixes, High-volume CI jobs
gpt-5.6-solGPT-5.6 SolPrevious gennone to maxExisting workflows, Balanced everyday work
gpt-5.6-terraGPT-5.6 TerraPrevious gennone to maxRoutine tasks, Steady batch work
gpt-5.6-lunaGPT-5.6 LunaPrevious gennone to maxLight edits, High-volume jobs
gpt-5.5GPT-5.5Previous gennone to xhighPinned prompts, Reproducible runs
for one session
$ codex -m gpt-6.2-astra
inside a session
/model
as the default, in ~/.codex/config.toml
model = "gpt-6-luna"
one non-interactive run
$ codex exec -m gpt-6-luna "fix the lint errors"

Rule of thumb: gpt-6.1-sol for everyday work, gpt-6.2-astra for the hardest problems, gpt-6-luna for quick edits and high volume. Compare them side by side on the Models page.

04 / Reasoning effort

Dial depth up or down.

Reasoning effort trades speed for depth. Low answers quickly; high and above think longer before they write code.

low and medium

Everyday edits, small features and quick questions. Fast, and light on your window.

high

Multi-file refactors, tricky tests and code review, where a little more thinking pays off.

xhigh and max

Root-causing hard bugs, migrations and architecture changes. Pair with gpt-6.2-astra.

as the default, in ~/.codex/config.toml
model_reasoning_effort = "high"
for one session
$ codex -c model_reasoning_effort="high"

Inside a session, /model lets you pick the effort along with the model. Through the API, send "reasoning": { "effort": "high" }. Each model's range is in the table above. Higher effort usually spends more output tokens, so it draws the 5-hour window down faster.

05 / IDE extension

Same config, in your editor.

The Codex IDE extension for VS Code and compatible editors reads the same ~/.codex/config.toml as the CLI. Set up once and both work.
  1. 01Run the installer or the manual setup above.
  2. 02Install the Codex extension from your editor's extension marketplace.
  3. 03Open the Codex panel and pick a model from its model menu. It uses the lotusai provider from your config.

The key is in the provider block, so the extension needs no environment variable. It works the same whether the editor starts from the Dock, the Start menu or a terminal, on macOS, Linux and Windows.

06 / Using the API directly

The same key, outside Codex.

Base URL https://api.lotusai.pro/v1, key as a Bearer token. The API speaks the Responses API, which Codex uses, and Chat Completions, so OpenAI-compatible SDKs and tools work unchanged.
API endpoints
EndpointAuthWhat it does
POST/v1/responsesKeyResponses API, as Codex sends it: input items, function tools, reasoning.effort, streaming.
POST/v1/chat/completionsKeyChat Completions for OpenAI-compatible SDKs: messages, tool_calls, images, streaming.
GET/v1/modelsNoneThe live model list with context sizes. Public, so tools can fill a model picker.
GET/api/key-statusKeyPlan, expiry and window usage for a key, the data behind Check key.

The samples read the key from LOTUSAI_API_KEY. The installers save it for terminals opened after setup; Codex itself does not need it. To set it by hand:

for curl and SDKs
# macOS and Linux
export LOTUSAI_API_KEY="sk-lotus-..."
# Windows PowerShell
$env:LOTUSAI_API_KEY = "sk-lotus-..."
POST /v1/responses
curl https://api.lotusai.pro/v1/responses \
  -H "Authorization: Bearer $LOTUSAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6.1-sol",
    "reasoning": { "effort": "medium" },
    "input": "Write a SQL migration that adds a nullable email column to users."
  }'
streaming
# Add "stream": true to the body for server-sent events:
# response.created
# response.output_item.added
# response.output_text.delta      (repeats)
# response.output_item.done
# response.completed
  • Tool calling. Responses returns function_call items; answer with function_call_output items in the next request. Chat Completions returns tool_calls; answer with a tool message.
  • Images. Send input_image parts (Responses) or image_url parts (Chat Completions), as a URL or base64 data.
  • Usage. Every response reports its input and output tokens, and they count toward the same 5-hour window as Codex.
  • Keys stay server-side. Never ship the key in browser or mobile app code; call the API from your backend.

07 / Web search and images

Nothing extra to install.

Web search and image understanding run on the LotusAI side, so they work in Codex and through the API with the same key.

Web search

When a task needs fresh information, like a library's latest release notes or a new error message, the model can search the web and read the results before it answers. No search key, no plugin.

Images

Give the model a screenshot, a design mock or a photo of a whiteboard. Paste an image into the Codex prompt, or attach it when you start a session.

attach an image
$ codex -i screenshot.png "make the settings page match this layout"

08 / Limits and usage

Limits that refill.

Every key has two limits: a token allowance per rolling 5-hour window, and 60 requests per minute.

Per 5-hour window

Plus: 7,000,000 tokens. Pro: 25,000,000 tokens. The window opens with your first request and resets 5 hours later.

Per minute

60 requests per minute per key on both plans. Going over returns a 429 for a few seconds, and Codex retries on its own.

What counts

The input and output tokens of every request in the window, from Codex and the API alike. Bigger models and higher effort can draw it down faster.

When the window is used up, requests answer with a usage-limit message until it resets, and you pick up where you left off. Check key shows how much is used and the exact reset time, with no login.

Status codes

Errors use the standard OpenAI-compatible envelope, with real HTTP statuses that Codex and SDKs act on.

HTTP status codes and error types the API returns
Statuserror.code or typeWhat it means
400invalid_request_errorMalformed body or unknown parameter. context_length_exceeded means the conversation outgrew the window.
401invalid_api_keyThe key is missing, mistyped or not recognised.
403account_deactivatedThe key was disabled, has expired, or was suspended for sharing. The message says which. Ask the reseller who issued it.
404model_not_foundThe model id is not on this server. Use an id from GET /v1/models.
413invalid_request_errorThe request is too large. Shrink images or trim history.
429rate_limit_exceededMore than the per-minute limit. Wait a few seconds; Codex retries on its own.
429insufficient_quotaThe 5-hour window is used up. Requests work again after it resets.
503service_unavailableMaintenance or no capacity right now. Honour Retry-After and try again.
5xxserver_errorA temporary fault on our side. Retry with backoff.
error body
{
  "error": {
    "message": "Usage limit reached. Please wait for your 5-hour window to reset and try again.",
    "type": "insufficient_quota",
    "param": null,
    "code": "insufficient_quota"
  }
}

09 / Troubleshooting

When something looks off.

The common fixes, in the order people need them.
Missing environment variable: LOTUSAI_API_KEY

Your config is from an older setup that told Codex to read the key from LOTUSAI_API_KEY with an env_key line. Any terminal, editor or app that does not have that variable stops with this error. The current setup puts the key straight into the provider block, so Codex finds it everywhere. The quickest fix is to run the wizard again: it rewrites the block and keeps your other settings.

any OS
$ npx lotusai@latest

No Node.js? Run the one-line installer for your OS again instead. It rewrites the block the same way.

macOS and Linux
$ curl -fsSL https://lotusai.pro/setup.sh | bash
Windows PowerShell
irm https://lotusai.pro/setup.ps1 | iex

Or fix it by hand: in the [model_providers.lotusai] block of ~/.codex/config.toml, replace the env_key line with this line, holding your key. The other lines stay as they are. Leave no env_key line behind: Codex checks it first, even when the key is there too.

~/.codex/config.toml
[model_providers.lotusai]
# name, base_url, wire_api and the rest stay as they are
experimental_bearer_token = "sk-lotus-..."
401: invalid API key

Codex could not send a key the API recognises. Open ~/.codex/config.toml and check the experimental_bearer_token line in the [model_providers.lotusai] block: the whole key, in quotes, starting with sk-lotus-. Running npx lotusai@latest again with the right key rewrites it.

Seeing the 401 from curl or an SDK instead? The samples read LOTUSAI_API_KEY, so check it is set in that terminal:

is the key set for curl and SDKs?
# macOS and Linux
echo $LOTUSAI_API_KEY
# Windows PowerShell
echo $env:LOTUSAI_API_KEY

Then paste the key into Check key to confirm it is active.

403: key disabled, expired or suspended

The key exists but is switched off or past its end date. Your reseller can renew or re-enable it, usually without giving you a new key. Check key shows the expiry date.

If the message says the key was suspended because it was used on more devices at the same time than it allows, it was treated as shared. One key, one person: a key works on up to 5 devices at the same time. Keys used on more devices are treated as shared and suspended without refund.

404: model not found

Use an exact id from the model list or Models page, for example gpt-6.1-sol. Ids are lowercase. GET /v1/models returns the live list and needs no key.

Codex rejects wire_api = "chat"

Current Codex only speaks the Responses API to custom providers. Set wire_api = "responses" in the [model_providers.lotusai] block, or run the installer again and it rewrites the block for you.

~/.codex/config.toml
[model_providers.lotusai]
wire_api = "responses"
Codex asks me to sign in, or ignores the lotusai provider
  • model_provider = "lotusai" and model must be top-level keys, above every [table] in the file. A key written under a table belongs to that table.
  • Keep requires_openai_auth = false in the provider block, so Codex never asks for a separate sign-in.
  • If your config sets profile = "...", that profile's model_provider wins. Set it to lotusai there as well.
  • Using CODEX_HOME? The config lives in that folder, not in ~/.codex.
429: rate limit or usage limit

Two different limits answer 429. rate_limit_exceeded means more than 60 requests in a minute: wait a few seconds and Codex carries on. insufficient_quota means the 5-hour window is used up: requests work again after the reset, and Check key shows exactly when. Hitting it often? Ask your reseller about Pro.

Context length exceeded

Every model has 1.05M tokens of context, but a long session keeps growing. Run /compact in Codex to summarise the conversation so far, or /new to start fresh in the same project.

Behind a corporate proxy or firewall

Codex needs HTTPS (port 443) to api.lotusai.pro. If your network uses a proxy, set it in the environment that runs Codex. If the network inspects TLS, ask IT to allow api.lotusai.pro.

proxy and a quick reachability test
export HTTPS_PROXY=http://proxy.example.com:8080
curl -sS https://api.lotusai.pro/v1/models
503 with Retry-After

Planned maintenance, or no capacity for that model for a moment. Wait the number of seconds in the header and retry, or switch model with /model. Live health is on the status page.

The IDE extension cannot find the key
  • The extension reads the key from the same ~/.codex/config.toml as the CLI, so there is nothing to set in the editor, and it does not matter how the editor was started.
  • It says Missing environment variable? The file still has the old env_key line. Run npx lotusai@latest again, or see the fix at the top of this list.
  • Edited the file while the editor was open? Reload the editor window so the extension reads it again.

Still stuck?

The reseller who issued your key is the fastest help with it. Check key shows whether it is active and when the window resets.

Check your key

10 / Uninstall

Undo it in one line.

Each route removes exactly what it added and puts back any model or provider it replaced. The Codex CLI itself stays installed.
any OS
$ npx lotusai uninstall
macOS / Linux
$ curl -fsSL https://lotusai.pro/setup.sh | bash -s -- --uninstall
Windows PowerShell
$env:LOTUSAI_UNINSTALL = "1"
irm https://lotusai.pro/setup.ps1 | iex

Set it up by hand? Delete the [model_providers.lotusai] block and the two top lines from ~/.codex/config.toml. Your key lives in that block, so it goes with it. If you also set LOTUSAI_API_KEY for curl or SDKs, remove it from your shell profile or user environment.

$ codex

Have a key?Go build.

No key yet? Get one from the authorised reseller who referred you, then check it any time on Check key.