Skip to content

Commit c581d02

Browse files
Merge pull request #113 from jamesrochabrun/jroch-more-models
DeepSeek demo
2 parents d48aa1b + 549cb00 commit c581d02

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

README.md

+30-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ An open-source Swift package designed for effortless interaction with OpenAI's p
5656
- [Vector store File](#vector-store-file)
5757
- [Vector store File Batch](#vector-store-file-batch)
5858

59-
6059
## Getting an API Key
6160

6261
⚠️ **Important**
@@ -105,6 +104,7 @@ SwiftOpenAI supports various providers that are OpenAI-compatible, including but
105104
- [Ollama](#ollama)
106105
- [Groq](#groq)
107106
- [OpenRouter](#openRouter)
107+
- [DeepSeek](#deepseek)
108108
- [AIProxy](#aiproxy)
109109

110110
Check OpenAIServiceFactory for convenience initializers that you can use to provide custom URLs.
@@ -3257,10 +3257,10 @@ For Supported API's using Groq visit its [documentation](https://console.groq.co
32573257

32583258
## OpenRouter
32593259

3260-
[OpenRouter](https://openrouter.ai/docs/quick-start) provides an OpenAI-compatible completion API to 314 models & providers that you can call directly, or using the OpenAI SDK. Additionally, some third-party SDKs are available.
3261-
32623260
<img width="734" alt="Image" src="https://github.com/user-attachments/assets/2d658d07-0b41-4b5f-a094-ec7856f6fe98" />
32633261

3262+
[OpenRouter](https://openrouter.ai/docs/quick-start) provides an OpenAI-compatible completion API to 314 models & providers that you can call directly, or using the OpenAI SDK. Additionally, some third-party SDKs are available.
3263+
32643264
```swift
32653265

32663266
// Creating the service
@@ -3274,12 +3274,38 @@ let servcie = OpenAIServiceFactory.service(apiKey: apiKey,
32743274
"X-Title": "<YOUR_SITE_NAME>" // Optional. Site title for rankings on openrouter.ai.
32753275
])
32763276

3277-
// Making a
3277+
// Making a request
3278+
32783279
let prompt = "What is the Manhattan project?"
32793280
let parameters = ChatCompletionParameters(messages: [.init(role: .user, content: .text(prompt))], model: .custom("deepseek/deepseek-r1:free"))
32803281
let stream = service.startStreamedChat(parameters: parameters)
32813282
```
32823283

3284+
For more inofrmation about the `OpenRouter` api visit its [documentation](https://openrouter.ai/docs/quick-start).
3285+
3286+
## DeepSeek
3287+
3288+
![Image](https://github.com/user-attachments/assets/7733f011-691a-4de7-b715-c090e3647304)
3289+
3290+
The [DeepSeek](https://api-docs.deepseek.com/) API uses an API format compatible with OpenAI. By modifying the configuration, you can use SwiftOpenAI to access the DeepSeek API.
3291+
3292+
```swift
3293+
// Creating the service
3294+
3295+
let apiKey = "your_api_key"
3296+
let service = OpenAIServiceFactory.service(
3297+
apiKey: apiKey,
3298+
overrideBaseURL: "https://api.deepseek.com")
3299+
3300+
// Making a request
3301+
3302+
let prompt = "What is the Manhattan project?"
3303+
let parameters = ChatCompletionParameters(messages: [.init(role: .user, content: .text(prompt))], model: .custom("deepseek-reasoner"))
3304+
let stream = service.startStreamedChat(parameters: parameters)
3305+
```
3306+
3307+
For more inofrmation about the `DeepSeek` api visit its [documentation](https://api-docs.deepseek.com).
3308+
32833309
## Gemini
32843310

32853311
<img width="982" alt="Screenshot 2024-11-12 at 10 53 43 AM" src="https://github.com/user-attachments/assets/cebc18fe-b96d-4ffe-912e-77d625249cf2">

0 commit comments

Comments
 (0)