Bridging AI Coding Assistants to Chinese LLMs: A Protocol Adapter Guide

    This article explains why AI coding assistants built on the Responses API fail to connect directly with Chinese LLM providers that expose only the Chat Completions API, and provides a practical solution through a local protocol conversion proxy. It covers the technical roots of the incompatibility, a step-by-step guide to setting up the proxy adapter, key considerations for streaming, tool calls, and reasoning content, plus a troubleshooting checklist for common issues.

    Why Direct Connections Fail: Two Divergent API Protocols

    AI coding tools and model services communicate over HTTP APIs, but not all APIs speak the same language. The root cause of most integration failures lies in the differing protocol specifications adopted by different vendors.

    Two dominant conversational API protocols exist in the industry today:

    1. Chat Completions Protocol: The widely adopted classic protocol. Requests are structured around a messages array with roles such as system, user, assistant, and tool. Responses include a choices list, and streaming output is delivered incrementally via the delta field.
    2. Responses Protocol: A newer protocol designed around “complete task-based interactions.” Requests are organized around an input structure, and responses consist of a series of structured events and items. It natively supports reasoning fields, built-in tool orchestration, and more granular streaming state events.

    Many mainstream AI coding assistant clients have fully transitioned to the Responses protocol, while most Chinese LLM vendors continue to expose Chat Completions as their primary API. In short, the two sides are not speaking the same language. When a client sends a request in a format the upstream model cannot parse—and the upstream returns a response the client cannot interpret—the direct connection either errors out or returns an empty response.

    The Solution: A Protocol Conversion Proxy

    Since the two protocols are incompatible, the natural solution is to introduce a “translation layer” between the client and the model service: a local protocol conversion proxy. Its core responsibility is bidirectional conversion:

    • Request Direction: Intercept the Responses-format request from the coding assistant, break it down, and reassemble it as a Chat Completions request. The input array must be mapped to the messages array; reasoning parameters are mapped to the corresponding upstream fields; and tool definitions are converted to the standard tools structure.
    • Response Direction: Reconstruct the Chat Completions response from the upstream into the Responses format. Fidelity is critical here: streaming deltas must be converted piece by piece into the corresponding event stream; reasoning content must be mapped to a dedicated reasoning item; and tool call arguments must be correctly aggregated and routed, otherwise the assistant’s tool execution logic will break.

    A properly functioning conversion proxy must handle the following key aspects:

    1. Streaming State Completeness: The coding assistant’s UI relies on the event stream to render the thinking process and output in real time. Any lost events will cause the interface to freeze or the output to truncate.
    2. Tool Call Round-Tripping: Coding assistants heavily depend on tool calls (reading/writing files, executing commands, etc.). The conversion layer must guarantee that tool_calls IDs and arguments map one-to-one throughout the round trip, with no mismatches.
    3. Reasoning Content Pass-Through: If the chain-of-thought content from a Chinese reasoning model is discarded, the user experience suffers significantly. If it is mixed into the main output, it pollutes the code results. It must therefore be mapped to an independent channel.
    4. Error Pass-Through and Retry: Upstream errors such as rate limiting or timeouts need to be relayed back in a format the client can understand for efficient troubleshooting.

    Approach 1: Using a Local Proxy Tool with Protocol Conversion

    This approach requires the least configuration. The key is to use a proxy tool with “local route mapping” capabilities that performs the protocol translation for you.

    Step 1: Prepare the proxy tool. Choose a local proxy tool that supports multiple provider management and includes built-in conversion capabilities from Responses to Chat Completions. Verify that the installed version supports this feature (older versions often only forward requests without converting them). Run it as a local service after installation.

    Step 2: Obtain the model service key. Log in to the target Chinese LLM’s open platform, navigate to the API key management page, create a new key, and copy it. Keys typically start with a fixed prefix. Store it securely and never commit it to a code repository.

    Step 3: Add a provider configuration. In the proxy tool, switch to the configuration page corresponding to your coding assistant, add a new provider, select the built-in preset for the Chinese model (or manually enter the API base URL and model name), and paste the copied key.

    Step 4: Enable the local route mapping switch. This is the most critical step. This switch determines whether the proxy performs protocol conversion. When enabled, the proxy converts the Responses request from the coding assistant into a Chat Completions request for the upstream model, then rebuilds the response back into the Responses format—preserving reasoning content, tool calls, and streaming state. Without this switch enabled, the proxy acts as a direct connection and will inevitably fail.

    Step 5: Verify connectivity. Send a simple coding question from the coding assistant and observe whether streaming output works and whether tool calls (like file read/write) trigger correctly. You can also check the proxy’s request logs to confirm the request passed through conversion and that the upstream returned a 200 status.

    Approach 2: Using a GUI-Based Coding Assistant Enhancement Tool

    If you prefer a visual interface, GUI-based coding assistant configuration tools are a viable alternative. These tools typically come with built-in connection templates for common model services. Configuration is done by filling out forms with your API key and model name, and the protocol adaptation is handled internally. The selection criteria are the same as Approach 1: confirm the tool supports Responses-to-Chat-Completions conversion and verify that the tool call chain functions correctly.

    Notes on Accounts and Cost

    Note that some coding assistant clients require their own account system (e.g., a paid subscription or region-specific phone verification). This is separate from which model you connect to and must be resolved in advance. On the model side, costs are relatively manageable: API pricing for Chinese LLMs is generally low and usage-based, well-suited for high-frequency coding assistance. If your organization has private deployment or compliance requirements, you can deploy the model on a self-hosted container platform and connect through the same conversion proxy, pointing the upstream address to your internal service. The overall architecture remains unchanged.

    Troubleshooting Checklist

    1. Empty responses or format errors: Most likely the local route mapping switch is off, so the proxy is not performing protocol conversion.
    2. Output has text but no reasoning content: The proxy version is too old and does not support reasoning content mapping. Upgrade and retry.
    3. Tool calls fail or hang: Check whether the conversion layer is correctly mapping tool_calls IDs. Compare the request and response in the proxy logs.
    4. Frequent timeouts: Verify network connectivity to the upstream API and adjust the proxy’s timeout and retry parameters if necessary.
    5. Authentication errors (401/403): Check whether the API key was copied completely or whether the account has insufficient credits or has been disabled.

    Conclusion

    Enabling a coding assistant built on the Responses protocol to work with Chinese LLMs is fundamentally a protocol adaptation problem. By introducing a local proxy for bidirectional conversion—breaking down Responses requests into Chat Completions on the request side, and rebuilding the results back into Responses with preserved reasoning, tool calls, and streaming state on the response side—you can complete the integration without modifying the client. The two approaches (lightweight proxy tool or GUI-based tool) suit different user preferences, but the key checkpoints remain the same: whether conversion capability exists, whether the mapping switch is enabled, and whether the tool call chain has been validated. Once you master this approach, you can apply the same method to any model service that only supports Chat Completions in the future.