MacPaw/OpenAI

Swift community driven package for OpenAI public API

What it solves

This project provides a community-maintained Swift library that simplifies connecting Apple-based applications to the OpenAI API. It handles the complexities of network requests, data formatting, and API interactions so developers can focus on building features rather than writing boilerplate code.

How it works

Developers initialize an OpenAI instance with their API token and use it to call various endpoints—such as chat completions, image generation, or audio processing—using Swift’s native syntax. The library mirrors the structure of the official OpenAI REST API, supporting both modern Swift Concurrency (async/await) and older closure-based patterns. It also supports other OpenAI-compatible providers like Gemini, DeepSeek, and Perplexity.

Who it’s for

This library is designed for Swift and iOS/macOS developers who want to integrate AI capabilities into their apps. It is particularly useful for those who need a reliable, type-safe way to handle complex AI responses, function calling, and file management within the Apple ecosystem.

Highlights

  • Full support for OpenAI features including Chat Completions, DALL-E image generation, audio transcription, and Assistants API.
  • Native Swift implementation with support for Swift Package Manager.
  • Built-in support for function calling and structured outputs.
  • Compatible with other AI providers that use OpenAI-compatible APIs.
  • Flexible request handling with built-in support for cancellation via Swift Concurrency, Combine, or closures.

Related

  • Project
  • Project
  • Project
  • Project
  • Project