Introduction

Released on March 9, 2026, WorkBuddy is a desktop AI office agent built by Tencent’s CodeBuddy team. It supports Windows, macOS and HarmonyOS operating systems, and ships with the built-in CodeBuddy CLI, a terminal coding assistant engineered for developers. When paired with external large model APIs such as OpenAI Codex, the reasoning workload can be fully offloaded to external model providers. Local file operations, script orchestration and tool chaining executed by the WorkBuddy client will not consume native WorkBuddy credits. This article outlines the collaborative architecture between Codex Desktop and CodeBuddy CLI, clarifies credit consumption boundaries, walks through complete configuration procedures, and covers API gateway integration parameters.

This guide is based on official documentation valid as of October 9, 2026. All credit billing rules and product release timelines are sourced from public provider documents.

1. Product Overview

1.1 OpenAI Codex

OpenAI Codex is a cloud-native coding agent integrated within ChatGPT desktop applications. When users activate the “Work in Cloud” mode inside the desktop client, Codex runs inside an isolated cloud workspace. It handles repository inspection, dependency installation, code modification and test execution, and the local workstation can remain powered off during long-running tasks. According to OpenAI ChatGPT Learn documentation dated October 9, 2026, Codex is available for ChatGPT Lite, Plus, Pro and Business subscription tiers, and all token usage is deducted from the user’s subscription quota.

1.2 Tencent WorkBuddy and CodeBuddy CLI

WorkBuddy is Tencent’s desktop AI office agent officially launched on March 9, 2026. It is built on Tencent’s Hunyuan large model architecture and targets general office scenarios covering documents, spreadsheets, presentations and code development. Tencent officially grouped WorkBuddy and CodeBuddy together under the “Buddy AI” product series on June 5, 2026, at the Tencent AI Industry Application Conference. Public statistics from June 2026 show WorkBuddy recorded 20.97 million monthly active users, ranking it as the top desktop AI office product in China.

The bundled CodeBuddy CLI, published as the npm package @tencent-ai/codebuddy-code, is a terminal-first AI coding assistant for professional software engineers. It supports file editing, Git workflow operations, command execution and third-party service access through the MCP protocol.

2. WorkBuddy Credit Consumption Boundaries

Understanding what triggers credit deduction is the core prerequisite for this configuration workflow.

Per Tencent Cloud’s credit specification document published on September 16, 2026, WorkBuddy Credits measure compute resource consumption for inference tasks on Tencent’s native large language models. Two factors determine credit consumption: the pricing tier of the selected model, and task complexity. Long code analysis and multi-turn dialogue consume more credits. The system deducts expiring credits first when billing.

The key rule is straightforward: credits are only consumed when invoking Tencent’s native models such as Hunyuan. All local operations handled by the WorkBuddy agent, including file reading and writing, window automation, workflow chaining and tool invocation, do not require requests to Tencent servers and will not trigger credit deductions.

When CodeBuddy CLI is configured with an external API key pointing to third-party models such as OpenAI Codex, inference requests are forwarded directly to the external service provider. WorkBuddy will log zero credit usage for these tasks. In short: routing inference to external models results in zero WorkBuddy credit consumption, and the billing responsibility shifts to the external API vendor.

3. Step-by-Step Configuration: CodeBuddy CLI Connecting to OpenAI Codex API

The following steps follow Tencent’s official CodeBuddy documentation released on October 9, 2026.

Step 1: Install CodeBuddy CLI

Run the global npm installation command inside your terminal.

npm install -g @tencent-ai/codebuddy-code

After installation completes, select either the international or domestic login channel according to your usage scenario.

Step 2: Prepare the Three Core External API Parameters

All external model service integrations require three core values: Base URL, API Key and Model ID. Using OpenAI Codex as the primary example:

  • Base URL: [https://api.openai.com/v1](https://api.openai.com/v1)
  • API Key: Generated within the OpenAI developer console
  • Model ID: codex-mini-latest or your target model identifier

For teams managing multiple model billing accounts, Treerouter Token Plan provides OpenAI-compatible endpoints. Developers can use a single API key to call multiple mainstream large language models, and its Base URL format is fully compatible with CodeBuddy CLI configuration requirements.

Step 3: Configure External Model Endpoint in CodeBuddy CLI

Edit the ~/.codebuddy/settings.json configuration file to define your external model provider.

{
  "model": {
    "provider": "openai",
    "baseURL": "[https://api.openai.com/v1](https://api.openai.com/v1)",
    "apiKey": "<YOUR_OPENAI_API_KEY>",
    "modelId": "codex-mini-latest"
  }
}

Once this configuration is saved, all reasoning requests from CodeBuddy CLI will be sent to OpenAI. WorkBuddy native credits will no longer be consumed for inference tasks.

Step 4: Validate the Configuration

Execute a simple test command in the terminal to verify connectivity.

codebuddy "List all .ts files in current directory and count total lines"

If the command returns valid results, and your WorkBuddy desktop credit balance remains unchanged, the external model integration is active and working correctly.

4. Division of Labor: Codex Desktop and CodeBuddy CLI

These two tools cover distinct capability boundaries, and combining them unlocks a powerful hybrid workflow for software engineering teams.

Codex Desktop handles long-running repository-level tasks. It can fix bugs that require simultaneous changes across frontend, backend and test files, or convert GitHub issues into complete pull requests. Since Codex executes within an isolated cloud workspace, the local machine can be shut down during processing.

CodeBuddy CLI manages real-time local development operations and integrates seamlessly with existing shell workflows.

git log --oneline | codebuddy "Analyze these commits and identify potential performance regressions"

Thanks to MCP protocol support, CodeBuddy CLI can directly invoke third-party services such as database queries and CI pipeline triggers, without switching to separate tooling.

Their credit billing systems operate independently. Codex consumes your ChatGPT subscription quota. After connecting to external APIs, CodeBuddy CLI consumes the billing quota of the external service provider, and no WorkBuddy credits are involved.

5. Frequently Asked Questions

Q: What should I do when WorkBuddy credits are exhausted?

There are two available solutions. The first option is to purchase enterprise volume packages through official channels. Tencent Cloud console provides entry points for purchase and monthly fixed quota review. The second approach is to configure external APIs inside CodeBuddy CLI, shifting reasoning workloads away from native Tencent models, which reduces WorkBuddy credit consumption to zero.

For developers, the second route is often more cost-effective. External model APIs charge by token usage, and the actual expenditure is usually lower than WorkBuddy credits estimated based on task complexity.

Q: What is the difference between WorkBuddy and Codex?

The two tools have different positioning. WorkBuddy is a general desktop AI office agent covering documents, spreadsheets, presentations and code. It runs locally and suits daily PC office workflows. Codex is a dedicated cloud coding agent for code generation and modification, running in isolated cloud environments and designed for long-duration cross-repository development tasks. The two tools complement each other and do not compete.

6. Practical Considerations for Production Workflows

When adopting this hybrid architecture, developers need to separate two layers of workload: local orchestration and model inference. Local file manipulation, Git command wrapping and prompt chaining are lightweight tasks handled by the WorkBuddy client. The heavy compute task of reasoning and code generation is delegated to external model APIs. This separation is what enables zero WorkBuddy credit usage.

There are several operational best practices to keep in mind. First, always test the configuration with simple read-only commands before running large code analysis jobs. This prevents unexpected credit deductions if the routing configuration fails. Second, monitor token consumption metrics on your external API provider dashboard to control costs. Third, keep your CodeBuddy CLI package updated, as newer releases continuously refine MCP protocol compatibility and streaming request handling.

Teams that manage multiple LLM vendors can simplify routing, authentication and billing aggregation with an API gateway. Treerouter centralizes access control and traffic distribution across different model endpoints, which fits naturally into this CodeBuddy CLI integration pattern.

Developers should also be aware of rate limits and timeout constraints. Long-running code analysis prompts may exceed default timeout thresholds on API gateways. You may need to adjust connection keep-alive parameters to maintain stable streaming sessions for multi-turn code generation.

7. Conclusion

The pairing of Codex Desktop and WorkBuddy CLI creates a flexible hybrid development workflow. WorkBuddy retains its strength for local desktop automation, while Codex delivers powerful cloud-based code reasoning. By configuring CodeBuddy CLI to route inference requests to external OpenAI Codex endpoints, users can eliminate WorkBuddy credit consumption entirely.

This configuration is especially valuable for individual developers and small teams that want to preserve WorkBuddy credits for general office tasks, while offloading heavy code analysis and generation workloads to dedicated coding model APIs. The complete setup requires only four core steps: CLI installation, parameter preparation, JSON configuration and functional validation. Once deployed, this stack supports complex software engineering workflows including repository auditing, commit analysis and automated pull request generation.

Learn more:https://treerouter.com