How to Configure Codex with a Third-Party OpenAI-Compatible API
To use Codex with Chonway API, point `OPENAI_BASE_URL` to `https://api.wos.one/v1` and use an API key issued by the same service. The Base URL and API key must come from the same provider, or authentication and model errors become much more likely.
Direct answer
Codex can work with a third-party OpenAI-compatible API when the client supports API-key-based configuration and reads the correct environment variables. For Chonway API, the OpenAI-compatible Base URL is https://api.wos.one/v1.
Who this is for
- Developers already using Codex or similar OpenAI-compatible tools.
- Small teams that want a unified API entry point and centralized billing visibility.
- Users validating third-party API routing before rolling it into a broader workflow.
What to distinguish first
ChatGPT subscription login
This is not the same thing as API credit or a third-party OpenAI-compatible API key.
Official OpenAI API key
This key belongs with the official OpenAI API endpoint.
Third-party OpenAI-compatible API key
This key belongs with the third-party service that issued it. For Chonway API, that means pairing it with https://api.wos.one/v1.
Minimal configuration
| Variable | Value |
|---|---|
OPENAI_BASE_URL | https://api.wos.one/v1 |
OPENAI_API_KEY | sk-your-api-key |
Platform-specific setup
Linux / macOS
export OPENAI_BASE_URL=https://api.wos.one/v1
export OPENAI_API_KEY=sk-your-api-key
WSL
export OPENAI_BASE_URL=https://api.wos.one/v1
export OPENAI_API_KEY=sk-your-api-key
Do not assume the current WSL shell automatically shares the same environment as a Windows terminal session.
Windows PowerShell
$env:OPENAI_BASE_URL = "https://api.wos.one/v1"
$env:OPENAI_API_KEY = "sk-your-api-key"
If you change persistent environment variables, open a new terminal before testing.
Common setup mistakes
Login mode and API key mode get mixed
Some tools support both account login and API-key-based access. If the tool is still using a login-based mode, your third-party API variables may not actually control the request path.
Old environment variables are still active
This is common when multiple shells, IDEs, or terminal profiles define different values for the same variable.
/v1 is missing from the Base URL
For the OpenAI-compatible interface discussed here, Chonway API should be configured as:
https://api.wos.one/v1
The API key comes from the wrong service
Base URL and API key must match the same provider. Mixing providers often results in 401, 403, or model access failures.
The model name is wrong
Even with the correct Base URL and key, a bad model name can still fail. Use the current callable model list from the console as the source of truth.
Network or DNS issues
If the request cannot connect, times out, or fails to resolve, confirm whether the issue is local networking, DNS, or service-side availability before changing application logic.
Limitations and risks
- A third-party OpenAI-compatible API does not guarantee that every Codex feature behaves exactly the same as an official endpoint.
- Tool upgrades can change configuration behavior, so re-check settings after version updates.
- For production workflows, keep a fallback plan instead of relying on one API path only.
Next steps
- For Anthropic-compatible CLI setup, see How to Use Claude Code with Chonway API.
- For the full integration entry point, see Integration Docs.
- For pricing logic and billing guidance, see Pricing & Billing.
FAQ
Can I treat a ChatGPT subscription as API credit?
No. Subscription login and API billing are separate systems.
Does this mean every Codex capability will work through a third-party API?
No. Compatibility depends on the tool version, the request path, and the specific feature being used.