If you do not have an API Key yet, read Get API Key first.
Before You Start
Prepare the following:- AiToEarn API Key.
- A working Codex installation.
- cc-switch. Download the version for your operating system from cc-switch releases.
| Site | OpenAI Chat Completions endpoint |
|---|---|
| China site | https://aitoearn.cn/api/ai/chat/completions |
| International site | https://aitoearn.ai/api/ai/chat/completions |
Configure cc-switch
Open cc-switch and switch the top mode tocodex.


- Provider name: use
aitoearnso it is easy to recognize. - API Key: paste the API Key created in AiToEarn.
- API request URL: enter the OpenAI Chat Completions endpoint that matches your API Key site.

Enable the Provider
Return to the provider list and enable the AiToEarn configuration you just created.



Verify the Setup
Keep cc-switch running, then open Codex and send a simple message. If Codex returns a normal response, it is using AiToEarn through cc-switch. If the request fails, check:- Whether the API Key belongs to the site used in the request URL.
- Whether the API request URL matches the API Key site.
- Whether the AiToEarn provider is enabled.
- Whether cc-switch Codex routing is enabled.
- Whether the Codex model name comes from Chat models.

