|
## 利用 Hugging Face 空间进行测试
复制 redteam-deepseek 空间:[https://huggingface.co/spaces/mikeee/redteam-deepseek](https://huggingface.co/spaces/mikeee/redteam-deepseek)
**测试步骤:**
1. 获取模型列表:
```bash
curl -sS "https://mikeee-redteam-deepseek.hf.space/hf/v1/models" | jq ".data[].id"
```
输出:
```
"deepseek-chat"
"deepseek-coder"
```
2. 发送请求:
```bash
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!\"}]}"
```
输出:
```json
{"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/](https://chat.deepseek.com/) 获取的 `userToken`。
* Hugging Face 空间需要订阅才能访问,但可以在小鸡上运行 newapi/oneapi 代理,节省资源。 |
|