尝试把DS官方key整合进CPA中,但是使用了一会儿发现问题。即cpa统计面板中统计的token全为0.
我使用的时候上游是既有Anthropic也有/chat/completions的,但是结果都是0.
问了一下AI,说是大概是上游没返回或者cpa没拿到数据,anthropic格式如果出错没法修。只有openai格式流式传输的时候才会在chunk最后附带total_token。在payload里强制走流式之后手动发post,
payload:
override:
- models:
- name: "deepseek-*"
protocol: "openai"
params:
"stream_options.include_usage": true
能看到回传data:
{“id”:“baa853cb-c5ba-4b2f-8c63-c4e2b4bf7977”,“object”:“chat.completion.chunk”,
“created”:1777450811,“model”:“deepseek-v4-pro”,“system_fingerprint”:
“fp_9954b31ca7_prod0820_fp8_kvcache_20260402”,“choices”:[{“index”:0,“delta”:{“content”:“”,
“reasoning_content”:null},“logprobs”:null,“finish_reason”:“stop”}],“usage”:{“prompt_tokens”:7,
“completion_tokens”:105,“total_tokens”:112,“prompt_tokens_details”:{“cached_tokens”:0},
“completion_tokens_details”:{“reasoning_tokens”:103},“prompt_cache_hit_tokens”:0,
“prompt_cache_miss_tokens”:7}}
怀疑是cpa流式链路统计的时候出错了?不知道佬友有没有相关的问题。
1 个帖子 - 1 位参与者