-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[AIG]DeepSeek initial documentation #18973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4060c29
DeepSeek initial documentation
daisyfaithauma 9f93749
Update src/content/docs/ai-gateway/providers/deepseek.mdx
daisyfaithauma b0dbda0
Update src/content/docs/ai-gateway/providers/deepseek.mdx
daisyfaithauma 7335bca
Update src/content/docs/ai-gateway/providers/deepseek.mdx
daisyfaithauma 45b4b0c
Update src/content/docs/ai-gateway/providers/deepseek.mdx
daisyfaithauma d817f5c
Update deepseek.mdx
kathayl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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/`. | ||
daisyfaithauma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Then you can append the endpoint you want to hit, for example: `chat/completions`. | ||
daisyfaithauma marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| So your final URL will come together as: | ||
| `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/chat/completions`. | ||
daisyfaithauma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## 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); | ||
| } | ||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.