Deploy for-agentrouter-d4f to Fix DeepSeek Thinking 400

Introduction

We already have a specially modified version of cpa-for-agentrouter-d4f to address the issue encountered by deepseek-v4-flash on agentrouter: HTTP 400: The content[].thinking

However, the request-format: anthropic parameter added by this modified version is not supported by the web management interface.

So, what is the most elegant way to use it?


Putting the Agent to Work

The blockquotes below contain the natural-language prompts I send to the Agent.


Use an agent to deploy for-agentrouter-d4f 

Study this guide: https://github.com/crazypeace/CLIProxyAPI/blob/for-agentrouter-d4f/docs/agentrouter-deepseek-v4-flash-setup_CN.md

Additional information:
You already have a CPA connected to agentrouter running in your environment
/home/ubuntu/cliproxyapi

* Note: A prerequisite for using the for-agentrouter-d4f version of CPA is that you have already deployed a CPA and configured the parameters required by agentrouter, and that it works as expected when tested in CPA.
 /home/ubuntu/cliproxyapi should be the actual path to your CPA. Of course, you can also let the Agent locate the details of the CPA you have already deployed on its own.


Agent deployment complete.

Connection information provided by the Agent after deployment: base_url http://127.0.0.1:9417/v1, api_key, model deepseek-v4-flash, and the startup command


Start the newly deployed modified for-agentrouter-d4f CPA yourself.
Then, in the original CPA, add an OpenAI-compatible provider named for-agentrouter-d4f, and set the base url, api key, and model to the values from the newly deployed modified for-agentrouter-d4f CPA


Then, you can see it in the web management interface of the original CPA.

Edit dialog for an OpenAI-compatible provider in the original CPA web management interface, showing the service address http://127.0.0.1:9417/v1 and the custom model deepseek-v4-flashNext, all you need to do is disable the original  deepseek-v4-flash model on agentrouter.


All right, you can try out the new system. Your Agent should not require any changes. This is because a request to the original CPA for the deepseek-v4-flash model will invoke the newly deployed CPA, which will then call agentrouter.


If it works properly, you can ask the Agent to run the modified   for-agentrouter-d4f CPA as a system service, making long-term operation easier.


Results

Model usage distribution chart in the CPA web interface, showing deepseek-v4-flash usage for each period, totaling $133.40


Comments