# DeepSeek API

DeepSeek API 使用与 OpenAI 兼容的 API 格式。通过修改配置，您可以使用 OpenAI SDK 或者兼容 OpenAI API 的软件来访问 DeepSeek API。

| PARAM    | VALUE                |
| -------- | -------------------- |
| api\_url | 从 emchub 获取 api\_url |
| api\_key | 从 emchub 获取 api\_key |

***

**调用 Chat API**

一旦您获得了 API key，就可以使用以下示例脚本来访问 DeepSeek API。以下示例是非流式的，如果需要流式响应，可以将 `stream` 参数设置为 `true`。

* **curl 示例**:

```bash

curl <api_url> \
 -H "Content-Type: application/json" \
 -H "Authorization: Bearer <api_key>" \
 -d '{
       "model": "emchubSDK-chat",
       "messages": [
         {"role": "system", "content": "You are a helpful assistant."},
         {"role": "user", "content": "Hello!"}
       ],
       "stream": false
     }'

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emc.network/emc/zhong-wen/emc-network/he-xin-chan-pin/emc-hub/deepseek-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
