You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-4
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,6 @@ An open-source Swift package designed for effortless interaction with OpenAI's p
56
56
-[Vector store File](#vector-store-file)
57
57
-[Vector store File Batch](#vector-store-file-batch)
58
58
59
-
60
59
## Getting an API Key
61
60
62
61
⚠️ **Important**
@@ -105,6 +104,7 @@ SwiftOpenAI supports various providers that are OpenAI-compatible, including but
105
104
-[Ollama](#ollama)
106
105
-[Groq](#groq)
107
106
-[OpenRouter](#openRouter)
107
+
-[DeepSeek](#deepseek)
108
108
-[AIProxy](#aiproxy)
109
109
110
110
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
3257
3257
3258
3258
## OpenRouter
3259
3259
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.
[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
+
3264
3264
```swift
3265
3265
3266
3266
// Creating the service
@@ -3274,12 +3274,38 @@ let servcie = OpenAIServiceFactory.service(apiKey: apiKey,
3274
3274
"X-Title":"<YOUR_SITE_NAME>"// Optional. Site title for rankings on openrouter.ai.
3275
3275
])
3276
3276
3277
-
// Making a
3277
+
// Making a request
3278
+
3278
3279
let prompt ="What is the Manhattan project?"
3279
3280
let parameters =ChatCompletionParameters(messages: [.init(role: .user, content: .text(prompt))], model: .custom("deepseek/deepseek-r1:free"))
3280
3281
let stream = service.startStreamedChat(parameters: parameters)
3281
3282
```
3282
3283
3284
+
For more inofrmation about the `OpenRouter` api visit its [documentation](https://openrouter.ai/docs/quick-start).
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
+
3283
3309
## Gemini
3284
3310
3285
3311
<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