This is an asynchronous Swift client library for calling OpenAI’s API across Apple platforms. It provides native access to chat completions, image generation and editing, speech synthesis and transcription, text embeddings, and content moderation through a single interface built on Swift’s async-await concurrency model.
The client supports structured output generation by constraining model responses to a provided JSON schema, and enables real-time consumption of generated text through streaming responses delivered as an AsyncSequence. It includes a thread-based conversation model for managing assistant workflows, with support for creating and running assistants, managing messages and runs, and submitting tool outputs. The library also provides a Model Context Protocol bridge for connecting external tools and data sources at runtime, and a provider compatibility layer that adjusts parsing logic to tolerate non-standard responses from third-party OpenAI-compatible services.
Beyond core API calls, the client handles multipart file uploads for assistants and image variations, computes text embeddings for similarity search, and offers configurable web search parameters. It includes image variation and editing capabilities, speech streaming, and audio translation. The library is distributed as a Swift package and supports cancellation of in-flight requests through Swift’s structured concurrency model.