Codex CLI

Use Codex with your asAi credits.

asAi provides a Codex-compatible POST /v1/responses endpoint over HTTP streaming. codex-cli 0.148.0 was tested with the previous GPT-5.6 Sol alias; the GPT-6 Sol migration is pending a separately approved live Codex verification.

This is a tested Codex compatibility surface, not the complete OpenAI Responses API. Your normal asAi email-verification, balance, model-control, request-limit, accounting, and Logs rules still apply.

1. Prepare your API key

Create an API key under API keys. Never paste a real key into config.toml or commit it to a repository. Keep it in the ASAI_API_KEY environment variable instead. The value uses the form asai_sk_....

Linux, macOS, or a Codespace:

export ASAI_API_KEY="asai_sk_..."

Windows PowerShell, for the current terminal:

$env:ASAI_API_KEY="asai_sk_..."

2. Install the tested Codex version

npm install -g @openai/[email protected]
codex --version

The version check should print codex-cli 0.148.0. A newer Codex release may change its Responses wire format, so treat other versions as unverified until listed here.

3. Configure the asAi provider

Recommended — run the setup script and it handles everything:

macOS / Linux / WSL / Git Bash:

curl -fsSL https://serveras.click/static/codex-setup.sh | bash

The script will:

  • Prompt for your asAi API key (input is hidden)
  • Store the key as the ASAI_API_KEY environment variable — never inside config.toml
  • Back up an existing ~/.codex/config.toml before touching it
  • Write only a clearly marked asAi block into config.toml; any other configuration is left untouched

For CI, Codespaces, or any environment where you already have ASAI_API_KEY set, pass the key and optionally a model:

curl -fsSL https://serveras.click/static/codex-setup.sh | bash -s -- --key "$ASAI_API_KEY" --model asai/gpt-6-luna

Supported --model values are the asai/gpt-* entries in the model catalog. The default is asai/gpt-6-sol.

Option B — manual setup. If you prefer not to run a setup script, create or edit ~/.codex/config.toml. On Windows, the same file is under %USERPROFILE%\.codex\config.toml:

model = "asai/gpt-6-sol"
model_provider = "asai"
model_reasoning_effort = "low"
approval_policy = "never"
sandbox_mode = "workspace-write"

[model_providers.asai]
name = "asAi"
base_url = "https://serveras.click/v1"
env_key = "ASAI_API_KEY"
wire_api = "responses"
requires_openai_auth = false
supports_websockets = false
request_max_retries = 0
stream_max_retries = 0

Keep /v1 in the base URL. Codex appends /responses. The tested transport is HTTP SSE, so WebSockets stay disabled.

The tested profile uses workspace-write and approval_policy = "never". Start Codex only inside a project you intend it to modify, and review the resulting diff before committing.

4. Start and verify

cd path/to/your/project
codex
  1. Ask Codex to read a small file.
  2. Ask it to make one controlled edit.
  3. Ask it to run the relevant test.
  4. Review the diff, then check Logs for the charged request.

Supported compatibility

  • Text instructions and conversation history.
  • Streaming and non-streaming Responses output.
  • Codex function tools, namespaced additional tools, and the tested exec custom tools flow.
  • Fragmented or multiple tool calls with tool-result continuation.
  • Usage-based settlement through the same shared asAi accounting path.

Current limits

  • Only asai/gpt-* models are accepted on this compatibility endpoint (the full GPT lineup in the model catalog).
  • HTTP SSE is supported; Responses-over-WebSocket is not.
  • previous_response_id, stored responses, and background mode are not supported.
  • Reasoning summaries, structured text.format, image input, PDFs, and hosted/server tools are not supported.
  • Unsupported semantic fields are rejected instead of being silently ignored.

Windows PowerShell

The same setup is available as a PowerShell script:

irm https://serveras.click/static/codex-setup.ps1 | iex

It stores ASAI_API_KEY as a user environment variable and writes the same asAi block into %USERPROFILE%\.codex\config.toml, backing up the file first.

Uninstall

Reverse all changes with one command — the asAi block is removed from config.toml and the stored key is deleted:

macOS / Linux / WSL / Git Bash:

curl -fsSL https://serveras.click/static/codex-setup.sh | bash -s -- --uninstall

Windows PowerShell:

& ([scriptblock]::Create((irm https://serveras.click/static/codex-setup.ps1))) 'uninstall'

Troubleshooting

  • 401: confirm ASAI_API_KEY exists in the same terminal that starts Codex. Check presence without printing it: test -n "$ASAI_API_KEY" && echo ready.
  • 402: your available credits cannot cover the request reservation. Check your balance under Top up.
  • 403: verify your email and confirm the account and key are active.
  • 400 unsupported model: keep the model set to an asai/gpt-* model from the catalog.
  • If Codex uses another provider, confirm model_provider = "asai" and start a fresh terminal session after changing the config.