Docs
Set up Codexwith LotusAI.
config.toml, models, reasoning effort, the API and fixes for common errors.01 / Quick start
From key to codex in two minutes.
lotusai provider block in ~/.codex/config.toml, so Codex finds it in every terminal and in the IDE extension.Get a key
Get Plus or Pro from the authorised reseller who referred you. Get access explains how. Your key starts with
sk-lotus.Run the installer
Pick your system below. One command writes the provider block, key included.
Start codex
Open a terminal in your project and run
codex. Inside,/statusshows 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.
$ 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
$ curl -fsSL https://lotusai.pro/setup.sh | bash -s -- sk-lotus-...
$ curl -fsSL https://lotusai.pro/setup.sh | LOTUSAI_MODEL=gpt-6-astra bashWhen it is done, go to a project and run codex.
irm https://lotusai.pro/setup.ps1 | iex- 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 stores LOTUSAI_API_KEY in your user environment, for curl and SDKs
$env:LOTUSAI_API_KEY = "sk-lotus-..."
$env:LOTUSAI_MODEL = "gpt-6-astra"
irm https://lotusai.pro/setup.ps1 | iexWorks in Windows PowerShell 5.1 and PowerShell 7. When it is done, go to a project and run codex.
$ npx lotusaiThe setup wizard does the same as the installers on macOS, Linux and Windows, and lets you pick the default model from the live list.
$ npx lotusai --key sk-lotus-...
$ npx lotusai --model gpt-6-astra
$ npx lotusai verify
$ npx lotusai print
$ npx lotusai uninstallverify checks the key and the API, print shows the config block for a manual setup, uninstall removes exactly what setup added.
Add this to ~/.codex/config.toml and replace sk-lotus-... with your key. The two top lines must sit above any [table] in the file.
Why the key goes in the file, and how to keep it private, is in Manual setup.
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.
1. Add the provider to ~/.codex/config.toml
model_providerandmodelgo at the top of the file, above any[table].- On Windows the file is
%USERPROFILE%\.codex\config.toml. If you setCODEX_HOME, it lives there instead. wire_apimust be"responses": current Codex rejects"chat".experimental_bearer_tokenholds your key, andrequires_openai_auth = falsestops Codex asking for a separate sign-in.- There is no
env_keyline on purpose. With it, Codex stops withMissing environment variablein any terminal, editor or app that does not have the variable, and it checksenv_keybefore the key in the block. - Keep the provider id
lotusaias 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.
$ chmod 600 ~/.codex/config.toml3. Start Codex
$ cd ~/your-project
$ codexTreat 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.
gpt-6.1-sol, the model Codex recommends, and switch when the task changes. This list is read live from GET /v1/models.| Model id | Type | Reasoning | Reach for it when |
|---|---|---|---|
gpt-6.1-solGPT-6.1 Sol | Recommended | low to max | Features and fixes, Multi-file refactors, Long agentic sessions |
gpt-6.2-astraGPT-6.2 Astra | Flagship | low to max | Hardest problems, Architecture and migrations, Long agentic projects |
gpt-6.2-solGPT-6.2 Sol | New | low to max | Everyday coding, Agents at scale, Features and fixes |
gpt-6.1-terraGPT-6.1 Terra | Efficient | none to max | Routine tasks, Screenshots and UI work, Docs and writing |
gpt-6-astraGPT-6 Astra | Flagship | low to max | Hard debugging, Architecture and migrations, High-stakes changes |
gpt-6-solGPT-6 Sol | All-rounder | none to max | Code review, Test generation, Day-to-day work |
gpt-6-lunaGPT-6 Luna | Fast | none to max | Quick edits, Lint and format fixes, High-volume CI jobs |
gpt-5.6-solGPT-5.6 Sol | Previous gen | none to max | Existing workflows, Balanced everyday work |
gpt-5.6-terraGPT-5.6 Terra | Previous gen | none to max | Routine tasks, Steady batch work |
gpt-5.6-lunaGPT-5.6 Luna | Previous gen | none to max | Light edits, High-volume jobs |
gpt-5.5GPT-5.5 | Previous gen | none to xhigh | Pinned prompts, Reproducible runs |
$ codex -m gpt-6.2-astra/modelmodel = "gpt-6-luna"$ 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.
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.
model_reasoning_effort = "high"$ 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.
~/.codex/config.toml as the CLI. Set up once and both work.- 01Run the installer or the manual setup above.
- 02Install the Codex extension from your editor's extension marketplace.
- 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.
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.| Endpoint | Auth | What it does |
|---|---|---|
POST/v1/responses | Key | Responses API, as Codex sends it: input items, function tools, reasoning.effort, streaming. |
POST/v1/chat/completions | Key | Chat Completions for OpenAI-compatible SDKs: messages, tool_calls, images, streaming. |
GET/v1/models | None | The live model list with context sizes. Public, so tools can fill a model picker. |
GET/api/key-status | Key | Plan, 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:
# macOS and Linux
export LOTUSAI_API_KEY="sk-lotus-..."
# Windows PowerShell
$env:LOTUSAI_API_KEY = "sk-lotus-..."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."
}'# 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.completedcurl https://api.lotusai.pro/v1/chat/completions \
-H "Authorization: Bearer $LOTUSAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6-luna",
"stream": true,
"messages": [
{ "role": "system", "content": "You are a terse senior engineer." },
{ "role": "user", "content": "Why is my build slow?" }
]
}'# pip install openai
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.lotusai.pro/v1",
api_key=os.environ["LOTUSAI_API_KEY"],
)
response = client.responses.create(
model="gpt-6.1-sol",
reasoning={"effort": "medium"},
input="Refactor this function so it has no side effects: ...",
)
print(response.output_text)// npm install openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.lotusai.pro/v1",
apiKey: process.env.LOTUSAI_API_KEY,
});
const stream = await client.chat.completions.create({
model: "gpt-6-luna",
stream: true,
messages: [{ role: "user", content: "Explain this stack trace: ..." }],
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}- Tool calling. Responses returns
function_callitems; answer withfunction_call_outputitems in the next request. Chat Completions returnstool_calls; answer with atoolmessage. - Images. Send
input_imageparts (Responses) orimage_urlparts (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
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.
$ codex -i screenshot.png "make the settings page match this layout"08 / Limits and usage
Limits that refill.
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.
| Status | error.code or type | What it means |
|---|---|---|
| 400 | invalid_request_error | Malformed body or unknown parameter. context_length_exceeded means the conversation outgrew the window. |
| 401 | invalid_api_key | The key is missing, mistyped or not recognised. |
| 403 | account_deactivated | The key was disabled, has expired, or was suspended for sharing. The message says which. Ask the reseller who issued it. |
| 404 | model_not_found | The model id is not on this server. Use an id from GET /v1/models. |
| 413 | invalid_request_error | The request is too large. Shrink images or trim history. |
| 429 | rate_limit_exceeded | More than the per-minute limit. Wait a few seconds; Codex retries on its own. |
| 429 | insufficient_quota | The 5-hour window is used up. Requests work again after it resets. |
| 503 | service_unavailable | Maintenance or no capacity right now. Honour Retry-After and try again. |
| 5xx | server_error | A temporary fault on our side. Retry with backoff. |
{
"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.
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.
$ npx lotusai@latestNo Node.js? Run the one-line installer for your OS again instead. It rewrites the block the same way.
$ curl -fsSL https://lotusai.pro/setup.sh | bashirm https://lotusai.pro/setup.ps1 | iexOr 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.
[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:
# macOS and Linux
echo $LOTUSAI_API_KEY
# Windows PowerShell
echo $env:LOTUSAI_API_KEYThen 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.
[model_providers.lotusai]
wire_api = "responses"Codex asks me to sign in, or ignores the lotusai provider
model_provider = "lotusai"andmodelmust be top-level keys, above every[table]in the file. A key written under a table belongs to that table.- Keep
requires_openai_auth = falsein the provider block, so Codex never asks for a separate sign-in. - If your config sets
profile = "...", that profile'smodel_providerwins. Set it tolotusaithere 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.
export HTTPS_PROXY=http://proxy.example.com:8080
curl -sS https://api.lotusai.pro/v1/models503 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.tomlas 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 oldenv_keyline. Runnpx lotusai@latestagain, 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.
10 / Uninstall
Undo it in one line.
$ npx lotusai uninstall$ curl -fsSL https://lotusai.pro/setup.sh | bash -s -- --uninstall$env:LOTUSAI_UNINSTALL = "1"
irm https://lotusai.pro/setup.ps1 | iexSet 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.