From 4060c29790425a3f562b1ec9ba177b2b810a1b6c Mon Sep 17 00:00:00 2001 From: daisyfaithauma Date: Tue, 31 Dec 2024 16:31:20 +0000 Subject: [PATCH 1/6] DeepSeek initial documentation --- .../docs/ai-gateway/providers/deepseek.mdx | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/content/docs/ai-gateway/providers/deepseek.mdx diff --git a/src/content/docs/ai-gateway/providers/deepseek.mdx b/src/content/docs/ai-gateway/providers/deepseek.mdx new file mode 100644 index 00000000000000..8cb7a448cd6b8f --- /dev/null +++ b/src/content/docs/ai-gateway/providers/deepseek.mdx @@ -0,0 +1,80 @@ +--- +title: DeepSeek AI +pcx_content_type: get-started +sidebar: + badge: + text: Beta +--- + +[DeepSeek AI](https://www.deepseek.com/) helps you build quickly with DeepSeek's advanced AI models. + +## Endpoint + +```txt +https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek +``` + +## What you need + +When making requests to DeepSeek AI, you will need: + +- AI Gateway Account ID +- AI Gateway gateway name +- DeepSeek AI API token +- DeepSeek AI model name + +## URL structure + +Your new base URL will use the data above in this structure: +`https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/`. + +Then you can append the endpoint you want to hit, for example: `chat/completions`. + +So your final URL will come together as: +`https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/chat/completions`. + +## Examples + +### cURL + +```bash title="Example fetch request" +curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/chat/completions \ + --header 'content-type: application/json' \ + --header 'Authorization: Bearer DEEPSEEK_TOKEN' \ + --data '{ + "model": "openai/gpt-3.5-turbo", + "messages": [ + { + "role": "user", + "content": "What is Cloudflare?" + } + ] +}' +``` + +### Use `openai` package with JavaScript + +If you are using the `openai` package, you can set your endpoint like this: + +```js title="JavaScript example" +import OpenAI from "openai"; + +const openai = new OpenAI({ + apiKey: env.DEEPSEEK_TOKEN, + baseURL: + "https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek", +}); + +try { + const chatCompletion = await openai.chat.completions.create({ + model: "deepseek-chat", + messages: [{ role: "user", content: "What is Cloudflare?" }], + }); + + const response = chatCompletion.choices[0].message; + + return new Response(JSON.stringify(response)); +} catch (e) { + return new Response(e); +} +``` From 9f937494eaeacf6ced1569a36e7b80988b989365 Mon Sep 17 00:00:00 2001 From: daisyfaithauma Date: Thu, 2 Jan 2025 11:10:17 +0000 Subject: [PATCH 2/6] Update src/content/docs/ai-gateway/providers/deepseek.mdx Co-authored-by: Jun Lee --- src/content/docs/ai-gateway/providers/deepseek.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/docs/ai-gateway/providers/deepseek.mdx b/src/content/docs/ai-gateway/providers/deepseek.mdx index 8cb7a448cd6b8f..e16677b1b2cac8 100644 --- a/src/content/docs/ai-gateway/providers/deepseek.mdx +++ b/src/content/docs/ai-gateway/providers/deepseek.mdx @@ -26,6 +26,7 @@ When making requests to DeepSeek AI, you will need: ## URL structure Your new base URL will use the data above in this structure: + `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/`. Then you can append the endpoint you want to hit, for example: `chat/completions`. From b0dbda0e0d9cc758b3b8b3e57e1359e4b56e20c2 Mon Sep 17 00:00:00 2001 From: daisyfaithauma Date: Thu, 2 Jan 2025 11:10:33 +0000 Subject: [PATCH 3/6] Update src/content/docs/ai-gateway/providers/deepseek.mdx Co-authored-by: Jun Lee --- src/content/docs/ai-gateway/providers/deepseek.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/ai-gateway/providers/deepseek.mdx b/src/content/docs/ai-gateway/providers/deepseek.mdx index e16677b1b2cac8..507ca63fb5b7ff 100644 --- a/src/content/docs/ai-gateway/providers/deepseek.mdx +++ b/src/content/docs/ai-gateway/providers/deepseek.mdx @@ -14,7 +14,7 @@ sidebar: https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek ``` -## What you need +## Prerequisites When making requests to DeepSeek AI, you will need: From 7335bca2f86d7bb4943c968953612d2d8c1cb255 Mon Sep 17 00:00:00 2001 From: daisyfaithauma Date: Thu, 2 Jan 2025 11:10:48 +0000 Subject: [PATCH 4/6] Update src/content/docs/ai-gateway/providers/deepseek.mdx Co-authored-by: Jun Lee --- src/content/docs/ai-gateway/providers/deepseek.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/docs/ai-gateway/providers/deepseek.mdx b/src/content/docs/ai-gateway/providers/deepseek.mdx index 507ca63fb5b7ff..9a5be9606df0e2 100644 --- a/src/content/docs/ai-gateway/providers/deepseek.mdx +++ b/src/content/docs/ai-gateway/providers/deepseek.mdx @@ -32,6 +32,7 @@ Your new base URL will use the data above in this structure: Then you can append the endpoint you want to hit, for example: `chat/completions`. So your final URL will come together as: + `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/chat/completions`. ## Examples From 45b4b0ce9a0e59f0e81bdf0a4506800361c9ad16 Mon Sep 17 00:00:00 2001 From: daisyfaithauma Date: Thu, 2 Jan 2025 11:10:57 +0000 Subject: [PATCH 5/6] Update src/content/docs/ai-gateway/providers/deepseek.mdx Co-authored-by: Jun Lee --- src/content/docs/ai-gateway/providers/deepseek.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/ai-gateway/providers/deepseek.mdx b/src/content/docs/ai-gateway/providers/deepseek.mdx index 9a5be9606df0e2..885a0a154b60cc 100644 --- a/src/content/docs/ai-gateway/providers/deepseek.mdx +++ b/src/content/docs/ai-gateway/providers/deepseek.mdx @@ -29,7 +29,7 @@ Your new base URL will use the data above in this structure: `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/`. -Then you can append the endpoint you want to hit, for example: `chat/completions`. +You can then append the endpoint you want to hit, for example: `chat/completions`. So your final URL will come together as: From d817f5c0500c1e7a22dbd96fbedb8e067f437b68 Mon Sep 17 00:00:00 2001 From: Kathy <153706637+kathayl@users.noreply.github.com> Date: Fri, 3 Jan 2025 04:39:53 +0900 Subject: [PATCH 6/6] Update deepseek.mdx fixed model in curl --- src/content/docs/ai-gateway/providers/deepseek.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/ai-gateway/providers/deepseek.mdx b/src/content/docs/ai-gateway/providers/deepseek.mdx index 885a0a154b60cc..7ea7a86d4278d7 100644 --- a/src/content/docs/ai-gateway/providers/deepseek.mdx +++ b/src/content/docs/ai-gateway/providers/deepseek.mdx @@ -44,7 +44,7 @@ curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/cha --header 'content-type: application/json' \ --header 'Authorization: Bearer DEEPSEEK_TOKEN' \ --data '{ - "model": "openai/gpt-3.5-turbo", + "model": "deepseek-chat", "messages": [ { "role": "user",