Swift SDK for OpenAI API access
Top 25.6% on sourcepulse
This Swift library provides a community-maintained wrapper for the OpenAI HTTP API, enabling developers to integrate functionalities like text completion, chat, image generation, and moderation into their iOS, macOS, watchOS, and tvOS applications. It offers a convenient interface for accessing powerful AI models, simplifying the process of building AI-powered features.
How It Works
The library acts as a client, abstracting the complexities of direct HTTP requests to the OpenAI API. It serializes Swift objects into JSON payloads for requests and deserializes JSON responses back into Swift objects. This approach leverages Swift's strong typing and modern concurrency features (async/await) for cleaner, more robust API interactions compared to raw HTTP calls.
Quick Start & Requirements
.package(url: "https://github.com/adamrushy/OpenAISwift.git", from: "1.2.0")
or CocoaPods: pod 'OpenAISwift'
.OpenAISwift
and initialize with your API key.Highlighted Details
model
, maxTokens
, and temperature
.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
The library does not support streaming message content before completion for chat requests.
5 months ago
1 day