Codex for Beginners: Connecting DeepSeek and Token-Saving Tips

Codex installation and configuration tutorial: connect DeepSeek and use tips to save Tokens
The article targets beginners discouraged by network environments and account registration, offering a complete solution for using Codex while bypassing obstacles. Download the ChatGPT-merged client from the official channel, use API login to connect third-party models via CC Switch and DeepSeek, then apply four optimization tips—Guide mode, memory, Karpathy's agent.md template, and the Ponytail and Caveman Skills—to cut Token consumption by 60% to 80%.
Codex is becoming a popular choice in the AI coding assistant space, but many newcomers get discouraged by network environment issues, account registration, and phone verification problems. In fact, by connecting a domestic model, you can skip all of these hassles entirely. This tutorial will walk you through Codex installation and configuration step by step, and share a set of tips to make Codex smarter and more cost-effective.
Installing Codex: Start from the Official Channel
First, visit the official Codex page to download the installer. In newer versions, ChatGPT and Codex have been officially merged, so what you download is actually the ChatGPT client. After double-clicking to open it, you'll see two login methods: if you already have a Plus or Pro account, simply log in; the other option is to log in with an API, which is exactly the key entry point for switching to a domestic model.

The installation process is very simple—just click through to the end. Once complete, don't rush to log in yet; we still need a tool to configure the third-party model.
Configuring a Domestic Model: Connecting DeepSeek via CC Switch
To use a domestic model in Codex, we need the CC Switch tool. Go to the CC Switch website to download and install it. After opening, select Codex from the AI tools list in the left sidebar. Next, click "Add Provider" in the top right corner—this lists numerous model vendors. We'll choose DeepSeekAd, then click "Get API Key" on the API Key row, and your browser will automatically redirect to the official DeepSeek page.
On the DeepSeek page, create an API Key with any name you like (e.g., Codex01). After successful creation, you'll receive a key string—note that this key is only displayed once, so be sure to copy and save it first. For security reasons, don't leak the key to others. Back in CC Switch, paste the copied API Key, click Add, then click Enable.

Finally, completely exit Codex and reopen it. At this point, you've successfully connected DeepSeek to Codex and can start using it.
What is an API Key?
An API Key is an identity credential issued by a model service provider (such as DeepSeek), essentially the "password" for calling the interface. The program carries this key when making requests to the server, which uses it to identify the user, bill them, and control permissions. It typically starts with sk- and has full access to the account quota, so it must be safeguarded like a bank card password: don't commit it to public repositories, don't post it in group chats or screenshots, and if you suspect a leak, immediately revoke it in the provider's backend and regenerate a new one. When Codex logs in via API, it uses this key instead of a ChatGPT account to complete authentication, thereby bypassing regional and account restrictions.
Advanced Tips: Make Codex Understand You Better and Save Money
Installation is just the first step. The following "inner techniques" will make your Codex more usable, smarter, and can even help you reduce Token consumption by 60% to 80%.
Adjust Permissions and Handling Method
Open Codex settings and enable "Full Access" under "General." At the same time, set the "Follow-up Handling Method" below to "Guide." For example: when Codex is executing a task and you notice it's deviating from expectations, you need to issue a new instruction. In "Queue" mode, it will first finish executing the current incorrect operation before executing your new instruction; in "Guide" mode, it will immediately stop the incorrect approach and switch to the new instruction. This effectively avoids unnecessary Token waste.
Enable Memory and Customize the Employee Handbook
In the "Personalization" interface, turn on the "Memory" feature. This way, Codex will remember your previous interactions and increasingly understand your communication style and work habits. Below, find "Codex Instructions"—this is actually the agent.md file, which you can think of as the AI's employee handbook. Codex reads and follows it before every task.

For beginners, you can directly refer to the open-source template by AI expert Karpathy, which has received over 220,000 stars on GitHub. Its core principles are four: think before coding—stop and ask when confused; simplicity first—if 50 lines of code can do the job, never write 100; precise modification—only change the code that needs changing; goal-driven—iterate and verify until the goal is achieved. Once you're proficient, you can add your own rules or customize it anew.
agent.md and the AGENTS.md Convention
agent.md (actually named AGENTS.md in most tools) is a plain-text instruction file placed in the project root directory. AI coding assistants automatically read the instructions in it before starting a task, serving as the "system prompt" for the session. It differs from the model's built-in memory: memory is user preferences accumulated across sessions, while agent.md is a set of rules versioned alongside the codebase and effective for all team members. Common contents include the project's tech stack, directory structure, code style, testing and commit conventions, directories that must not be modified, etc. Writing rules into a file rather than explaining them verbally each time makes collaboration more stable, results more reproducible, and easier to revise as the project evolves.
Two Useful Skills
The first is the famous Ponytail, which, while ensuring safety, makes Codex write less unnecessary code and avoid reinventing the wheel. Under the same task, without Ponytail the agent wrote 335 lines of code, while with Ponytail it needed only a short 10 lines. Installation is simple—just send a specified passage to Codex.

The second is Caveman, which perfectly solves the problem of AI wasting Tokens with useless chatter. In a comparison test, without Caveman it consumed 63 Tokens, while with Caveman it needed only 20 Tokens, and the answer quality was the same. Similarly, sending the installation instructions to Codex completes the installation.
What is a Skill?
In the context of AI coding assistants, a Skill usually refers to an instruction package or prompt module that the AI can read and follow. Once installed, it is automatically loaded during relevant tasks, essentially adding a specialized behavioral plugin to the assistant. The difference from traditional plugins: plugins extend program functionality, while Skills constrain and optimize the model's thinking and output—for example, forcing it to confirm requirements first, limiting output length, or prioritizing reuse of existing code. Skills are typically distributed as Markdown files or repositories. Sending the installation instructions to Codex completes the configuration, after which they take effect for all projects and can also be enabled per project.
Conclusion
By now, you're able to successfully use Codex and have mastered tips to make it more efficient. From installation and configuration to connecting a domestic model to optimizing usage habits, this workflow helps you bypass network and account obstacles and directly enjoy the convenience of AI programming. Next, it's time to explore your own new AI world.
One-line Summary
Codex installation and configuration tutorial: connect DeepSeek and use tips to save Tokens
Paragraph Summary
The article targets beginners discouraged by network environments and account registration, offering a complete solution for using Codex while bypassing obstacles. First, download the client (now merged with ChatGPT) from the official channel and choose API login as the entry point for connecting third-party models; then use the CC Switch tool to add the DeepSeek provider, create and paste the API Key, and restart to use it. The advanced section offers four optimization suggestions: set the follow-up handling method to "Guide" to avoid wasting Tokens executing incorrect instructions, enable the memory feature to help the AI better understand user habits, refer to Karpathy's open-source agent.md template to standardize coding behavior, and install the two Skills Ponytail and Caveman, which respectively reduce redundant code and compress verbose output—tests show they can cut Token consumption by 60% to 80%.
Related articles

The Most Detailed Codex Beginner's Guide on Bilibili: From Installation to Real-World Pitfall Avoidance
Bilibili creator shares a complete Codex onboarding guide: GPT account registration, desktop install pitfalls, login verification and 403 error fixes, reconnect-5-times repair, permission settings, and Plus/Pro quota mechanics, plus the plan upgrade price-difference process.

The Most Detailed Codex Tutorial on Bilibili: 5 Hours from Installation to 80% Cost Reduction
Based on Bilibili creator Wei Fanshi's detailed Codex tutorial, this guide covers official download, connecting DeepSeek API via CCSwitch, and tuning methods including guided mode, memory, the Agent manual, and the Ponytail and Caveman Skills—helping domestic users bypass network and account barriers and reduce token consumption.

Codex Getting Started in Practice: A Full Breakdown of the Four Forms of AI Coding Agents
Codex is OpenAI's AI coding agent, fundamentally different from ChatGPT. This article breaks down Codex's four forms (CLI, web, IDE plugin, standalone app), compares their use cases, and explores why developers in the AI era need to master agent tools like Codex.