Complete Guide: Connecting Codex and Claude Code via an API Relay Service

How to configure an API relay service for Codex and Claude Code in three simple steps.
This guide walks through connecting Codex and Claude Code to AI models via a third-party API relay service. It covers creating an API key, selecting the correct billing group, importing CCS configuration, and common troubleshooting steps — along with a key warning to avoid Chinese characters in installation paths and an honest risk disclaimer about using relay services.
Introduction: Why Use an API Relay Service
As AI-powered coding tools like GPT and Claude become more widely adopted, more developers want to integrate these powerful models into local coding assistants like Codex and Claude Code. However, calling the official APIs directly often comes with barriers — high account requirements, limited payment options, and unstable access. API relay services have become a practical workaround for many developers, routing requests to the target model service through a unified proxy interface.
At its core, an API relay service is a reverse proxy server that sits between the client and the official API. Technically, it receives HTTP requests from the user, forwards them to the official endpoints of providers like OpenAI or Anthropic, and returns the response as-is. Since relay services are fully compatible with official API formats (such as OpenAI's REST interface spec), client tools require zero changes to their underlying code — you simply replace BaseURL in your configuration with the relay address and swap the API Key for the relay's key. This "transparent proxy" behavior is what makes it a common technique for working around regional access restrictions.
This guide is based on a practical walkthrough shared by a Bilibili creator, covering how to create an API key on a relay platform and connect it to Codex. The same approach applies to Claude Code. One important caveat upfront: relay services are third-party channels and carry compliance and stability risks. This article documents the technical process only — readers should assess the risks before proceeding.
Step 1: Create an API Key
The first step is to generate a dedicated API key on the relay platform. After logging in, navigate to the "API Keys" section and click "Create Key."
On the creation screen, you can name the key anything you like. A descriptive name is recommended so you can quickly identify it when managing multiple keys later.

The Critical Part: Choosing the Right Group
Once you've entered a name, pay close attention to the Group option. You must select the group that matches your actual subscription plan. If you're on a free tier (sometimes referred to as a "freebie subscription"), simply select the "Subscription" group.
The group system functions as a resource routing policy: different groups correspond to different billing modes, model permissions, and backend provider pools. Choosing the wrong group may result in the key failing to match the correct quota or model resources — at best you'll get request errors, at worst you'll accidentally consume paid credits. Don't skip this step. Once you've made your selection, click "Create" and your API key will be generated.

Step 2: Import the CCS Configuration and Connect to Codex
After your API key is created, look for the "Import CCS" option next to the key. CCS is a local tool for managing and switching between model configurations — think of it as the nrm (registry manager) of the Node.js ecosystem. It abstracts environment variables and configuration files into a graphical interface or one-click operations, designed specifically to simplify switching between multiple models and API endpoints. When used with Codex, developers don't need to manually edit config files — CCS handles endpoint replacement and key injection automatically, significantly lowering the barrier to entry.
After clicking Import, go into the CCS interface, find the Enable button, and click it. Your integration is essentially complete. Codex can now call the corresponding model capabilities through the relay service.
Troubleshooting When Things Don't Work
If calls still fail after completing the configuration, the most straightforward fix is to restart both CCS and Codex. Many integration failures are simply caused by the configuration not yet taking effect or a stale cache — a restart usually resolves them.

This "restart fix" is extremely common in local toolchain integration scenarios. Configuration files are typically loaded at program startup — dynamically imported configs during runtime won't trigger a hot-reload. A restart forces the program to re-read the configuration file. This is standard behavior for Electron-based desktop apps and local CLI assistants.
Step 3: Reference the Full Tutorial and Installation Notes
If you hit any roadblocks with the steps above, the platform's announcement section on the homepage provides a complete illustrated tutorial you can follow step by step. It also includes download links for the CCS and Codex installers, saving you the trouble of searching for them yourself.

Important: Watch Your Installation Path
Here's a commonly overlooked but critical detail: when installing CCS and Codex, avoid any installation path that contains Chinese characters.
The root cause is character encoding incompatibility. Windows defaults to GBK encoding for Chinese characters, while many developer tools built on Node.js, Python, or Electron rely on ASCII or UTF-8 standards for internal path parsing. When a program calls system APIs to read a path containing Chinese characters, the GBK-to-UTF-8 conversion fails — resulting in invalid file handles, broken dependency module loading, or config file read errors. This issue is widespread across VSCode extensions, command-line tools, and local AI assistants; it's not specific to relay tools. The safest approach is to use a purely English path (e.g., C:\dev\tools) to completely bypass the encoding conversion chain.
The installation instructions explicitly warn about this and provide corresponding solutions. As long as you follow each step carefully, installation and integration should go smoothly.
Summary and Risk Disclaimer
Connecting Codex via an API relay service isn't particularly complicated. The core process comes down to three steps: create a key, select the right group, import CCS and enable it. Combined with a restart and a clean installation path, most issues can be resolved on your own.
As responsible technical content, the following risks must be clearly stated:
- Compliance risk: The service origins and authorization status of third-party relay services are often opaque and may violate official API terms of service.
- Data security risk: All requests pass through the relay server. Your code and conversation content could potentially be logged — never transmit sensitive information.
- Stability risk: Relay service availability is not guaranteed and may be interrupted at any time due to policy changes or supply issues.
For developers who have the means, using official channels is always the recommended approach. API relay services are better suited as a transitional option for learning and experimentation. Please weigh the pros and cons carefully before using them.
Key Takeaways
Related articles

From Chat to Agent: Automating Your Entire Business Workflow with AI Agents
Veteran AI practitioner Remy breaks down the leap from chat models to AI agents: how agents work, the three pillars of context, tools, and skills, MCP connections, and hands-on architecture to make you a 100x employee.

Understand Anything: The AI Skill That Turns Code into Interactive Knowledge Graphs
Understand Anything is a high-star open-source GitHub skill that runs static analysis on any codebase and generates interactive knowledge graphs. It supports Claude Code, Cursor, Copilot and other agents, letting engineers ask questions in natural language with path references.

Kimi K3 Released: How a 2.8 Trillion Parameter Open Model Reshapes AI Cost-Effectiveness
Moonshot AI unveils Kimi K3: a 2.8 trillion parameter, 1M context, natively multimodal open model. With KDA architecture and ultra-low cost, it rivals GPT-5.6 and Fable 5, redefining AI cost-effectiveness.