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
+61-5
Original file line number
Diff line number
Diff line change
@@ -134,7 +134,6 @@ let service = OpenAIServiceFactory.service(apiKey: apiKey, organizationID: ogani
134
134
135
135
That's all you need to begin accessing the full range of OpenAI endpoints.
136
136
137
-
138
137
### How to get the status code of network errors
139
138
140
139
You may want to build UI around the type of error that the API returns.
@@ -3289,19 +3288,76 @@ For more inofrmation about the `OpenRouter` api visit its [documentation](https:
3289
3288
3290
3289
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
3290
3291
+
Creating the service
3292
+
3292
3293
```swift
3293
-
// Creating the service
3294
3294
3295
3295
let apiKey ="your_api_key"
3296
3296
let service = OpenAIServiceFactory.service(
3297
3297
apiKey: apiKey,
3298
3298
overrideBaseURL: "https://api.deepseek.com")
3299
+
```
3299
3300
3300
-
// Making a request
3301
+
Non-Streaming Example
3301
3302
3303
+
```swift
3302
3304
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)
0 commit comments