Contents

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 balance

Docker

# Build and run
docker build -t deepseek-kit .
docker run --rm -e DEEPSEEK_API_KEY="your-key" deepseek-kit chat "Hello from Docker!"

Documentation

Interactive tutorials and API documentation β†’

License

MIT

Package Metadata

Repository: guitaripod/deepseekkit

Default branch: master

README: README.md