Skip to content

Commit 06b1bee

Browse files
daisyfaithaumaOxyjunkathayl
authored
[AIG]DeepSeek initial documentation (#18973)
* DeepSeek initial documentation * Update src/content/docs/ai-gateway/providers/deepseek.mdx Co-authored-by: Jun Lee <[email protected]> * Update src/content/docs/ai-gateway/providers/deepseek.mdx Co-authored-by: Jun Lee <[email protected]> * Update src/content/docs/ai-gateway/providers/deepseek.mdx Co-authored-by: Jun Lee <[email protected]> * Update src/content/docs/ai-gateway/providers/deepseek.mdx Co-authored-by: Jun Lee <[email protected]> * Update deepseek.mdx fixed model in curl --------- Co-authored-by: Jun Lee <[email protected]> Co-authored-by: Kathy <[email protected]>
1 parent f5290a6 commit 06b1bee

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
title: DeepSeek AI
3+
pcx_content_type: get-started
4+
sidebar:
5+
badge:
6+
text: Beta
7+
---
8+
9+
[DeepSeek AI](https://www.deepseek.com/) helps you build quickly with DeepSeek's advanced AI models.
10+
11+
## Endpoint
12+
13+
```txt
14+
https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek
15+
```
16+
17+
## Prerequisites
18+
19+
When making requests to DeepSeek AI, you will need:
20+
21+
- AI Gateway Account ID
22+
- AI Gateway gateway name
23+
- DeepSeek AI API token
24+
- DeepSeek AI model name
25+
26+
## URL structure
27+
28+
Your new base URL will use the data above in this structure:
29+
30+
`https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/`.
31+
32+
You can then append the endpoint you want to hit, for example: `chat/completions`.
33+
34+
So your final URL will come together as:
35+
36+
`https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/chat/completions`.
37+
38+
## Examples
39+
40+
### cURL
41+
42+
```bash title="Example fetch request"
43+
curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/chat/completions \
44+
--header 'content-type: application/json' \
45+
--header 'Authorization: Bearer DEEPSEEK_TOKEN' \
46+
--data '{
47+
"model": "deepseek-chat",
48+
"messages": [
49+
{
50+
"role": "user",
51+
"content": "What is Cloudflare?"
52+
}
53+
]
54+
}'
55+
```
56+
57+
### Use `openai` package with JavaScript
58+
59+
If you are using the `openai` package, you can set your endpoint like this:
60+
61+
```js title="JavaScript example"
62+
import OpenAI from "openai";
63+
64+
const openai = new OpenAI({
65+
apiKey: env.DEEPSEEK_TOKEN,
66+
baseURL:
67+
"https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek",
68+
});
69+
70+
try {
71+
const chatCompletion = await openai.chat.completions.create({
72+
model: "deepseek-chat",
73+
messages: [{ role: "user", content: "What is Cloudflare?" }],
74+
});
75+
76+
const response = chatCompletion.choices[0].message;
77+
78+
return new Response(JSON.stringify(response));
79+
} catch (e) {
80+
return new Response(e);
81+
}
82+
```

0 commit comments

Comments
 (0)