Swift package for interacting with the OpenAI API
Top 47.9% on sourcepulse
This Swift package provides a community-driven client for interacting with the OpenAI API, targeting Swift developers building applications that leverage AI capabilities. It simplifies API calls for various OpenAI services, offering a convenient way to integrate advanced AI features into Swift projects.
How It Works
OpenAIKit utilizes Swift's native URLSession
or the swift-server/async-http-client
for making HTTP requests to the OpenAI API. It abstracts the complexities of request formatting and response parsing, allowing developers to interact with models, completions, embeddings, and more through a clean Swift interface. The package emphasizes secure API key management by recommending environment variables and advising against client-side exposure.
Quick Start & Requirements
Package.swift
: .package(url: "https://github.com/dylanshine/openai-kit.git", from: "1.0.0")
OPENAI_API_KEY
and OPENAI_ORGANIZATION
are recommended.Highlighted Details
URLSession
and async-http-client
integrations.OpenAIKit.APIErrorResponse
.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
Function calling and fine-tuning features are not yet implemented. The project strongly advises against exposing API keys directly in client-side applications due to security risks.
11 months ago
1 day