mikeee
(mikeee)
1
复制 redteam-deepseek - a Hugging Face Space by mikeee 。测试,例如:
curl -sS "https://mikeee-redteam-deepseek.hf.space/hf/v1/models" | jq ".data[].id"
输出
"deepseek-chat"
"deepseek-coder"
然后就是用 token 发请求给 /hf/v1/chat/completions。例如:
curl -XPOST https://mikeee-redteam-deepseek.hf.space/hf/v1/chat/completions -H "Authorization: Bearer %TOKEN%" -H "Content-Type: application/json" --data "{\"model\": \"deepseek-chat\", \"messages\": [{\"role\": \"user\", \"content\": \"Say this is a test!\"}]}"
输出:
{"id":"","model":"deepseek_chat","object":"chat.completion",
"choices":[{"index":0,"message":{"role":"assistant",
"content":"好的,这是一次测试!让我们开始
吧。"},"finish_reason":"stop"}],"usage":
{"prompt_tokens":1,"completion_tokens":1,"total_tokens":2},"created":1718946537}
%TOKEN% 部分填访问 https://chat.deepseek.com/ F12 取到的 userToken。
或整合成 oneapi/newapi 渠道。例如,代理: https://mikeee-redteam-deepseek.hf.space/hf, 密钥:%TOKEN%
抱抱脸空间需提子才能访问。但可以在小鸡上跑 newapi/oneapi 加渠道。多倒一次但节省了小鸡跑代理的资源。
40 个赞
lee_jack
(lvsbnhdbx)
6
不行啊,使用https://mikeee-redteam-deepseek.hf.space作为代理报错:
{"error":{"proxy_note":"Server unavailable, error code: 349453"}}
mikeee
(mikeee)
8
呃……好像 POST 跑不通——可能是 v1 的事?要像薅 reka 的空间一样将路径改成 /hf/v1/chat/completions 可能?
好像不行啊
{
“error”: {
“message”: “bad response status code 200 (request id: 2024061707581112038091675458373)”,
“type”: “upstream_error”,
“param”: “200”,
“code”: “bad_response_status_code”
}
}
mikeee
(mikeee)
10
应该修好了,例如:
curl https://mikeee-redteam-deepseek.hf.space/hf/v1/models -H "Authorization: Bearer %TOKEN%"
# {"data":[{"id":"deepseek-chat","object":"model","owned_by":"deepseek-free-api"},{"id":"deepseek-coder","object":"model","owned_by":"deepseek-free-api"}]}
curl -XPOST https://mikeee-redteam-deepseek.hf.space/hf/v1/chat/completions -H "Authorization: Bearer %TOKEN%" -H "Content-Type: application/json" --data "{\"model\": \"deepseek-chat\", \"messages\": [{\"role\": \"user\", \"content\": \"Say this is a test!\"}]}"
# {"id":"","model":"deepseek_chat","object":"chat.completion","choices"
# :[{"index":0,"message":{"role":"assistant","content":"好的,这是一次测试!让我们开始吧。"},"finish_reason":"stop"}],
# "usage": "prompt_tokens":1,"completion_tokens":1,"total_tokens":2},
# "created":1718946537}
%TOKEN% 部分填访问 https://chat.deepseek.com/ F12 取到的 userToken。
drfy
(drfy)
12
官网上有代码助手和对话助手,如何区分两个API呢,我看token是一样的
1 个赞
mikeee
(mikeee)
13
只是模型的区别,{\"model\": \"deepseek-chat\"
改成{\"model\": \"deepseek-coder\"
就可以了
drfy
(drfy)
16
无法使用了,返回信息:服务暂时不可用,第三方响应错误_
无法使用了,返回信息:服务暂时不可用,第三方响应错误_
mikeee
(mikeee)
21
看了下日志
可能要更新源码,因为其他小鸡上部署的原readteam deepseek 正常运行。可能要重新拉源码修改(避开hf禁止的/v1),或是看看readteam 有没有加入避开/v1机制。
1 个赞