guitaripod/deepseekkit
Swift SDK for the DeepSeek API with streaming, function calling, and reasoning model support.
Installation
dependencies: [
.package(url: "https://github.com/guitaripod/DeepSeekKit", from: "1.0.0")
]Quick Start
import DeepSeekKit
let client = DeepSeekClient(apiKey: "your-api-key")
// Chat
let response = try await client.chat.createCompletion(
ChatCompletionRequest(
model: .chat,
messages: [.user("What is the capital of France?")]
)
)
// Streaming
for try await chunk in client.chat.createStreamingCompletion(request) {
print(chunk.choices.first?.delta.content ?? "", terminator: "")
}
// Function calling
let weatherTool = FunctionBuilder(
name: "get_weather",
description: "Get the current weather"
)
.addStringParameter("location", description: "City name", required: true)
.buildTool()
// Reasoning model
let reasoning = try await client.chat.createCompletion(
ChatCompletionRequest(
model: .reasoner,
messages: [.user("Solve: 2 + 2 * 3")]
)
)Features
- π Native streaming on all platforms
- π Function calling for AI agents
- π§ Reasoning model with step-by-step explanations
- π± macOS, iOS, tvOS, watchOS, visionOS, Mac Catalyst, Linux
- π¦ Zero dependencies
- π§ Type-safe API
CLI
# Install
swift build -c release
cp .build/release/deepseek-cli /usr/local/bin/
# Use
export DEEPSEEK_API_KEY="your-key"
deepseek-cli chat "Hello!"
deepseek-cli stream "Tell me a story" --show-reasoning
deepseek-cli balanceDocker
# Build and run
docker build -t deepseek-kit .
docker run --rm -e DEEPSEEK_API_KEY="your-key" deepseek-kit chat "Hello from Docker!"Documentation
License
MIT
Package Metadata
Repository: guitaripod/deepseekkit
Default branch: master
README: README.md