Repository navigation
.package(url: "https://github.com/OpenDive/OpenAIKit.git", from: "4.2.0")To keep your app small, depend on OpenAIKitCore (plus OpenAIKitRealtime, OpenAIKitBeta or OpenAIKitAdmin if you use them) instead of OpenAIKit. See Keep your app small.
Added
- Separate products, so apps link only the APIs they use:
OpenAIKitCore,OpenAIKitRealtime(Realtime and Live),OpenAIKitBeta(Agents, Vaults, Assistants, Threads, ChatKit, beta Responses) andOpenAIKitAdmin(Administration API). TheOpenAIKitproduct still includes everything and re-exports all four modules, so existing code compiles unchanged. OpenAIModel, the protocol every generated model conforms to.
Changed
-
Much smaller apps. A minimal app making one Responses call and one Chat Completions stream (release build, stripped):
- 33.4 MB → 7.4 MB (−78%) with
OpenAIKitCore; - 33.4 MB → 18.0 MB (−46%) with
OpenAIKit.
Clean release builds take 40–69 s instead of 152 s.
- 33.4 MB → 7.4 MB (−78%) with
-
Generated models no longer each carry a
CodingKeysenum and a synthesized==/hash(into:). They decode with shared string keys, andOpenAIModelsuppliesEquatableandHashableonce for all types. Equality compares canonical JSON, soniland an omitted field compare equal, as on the wire. It costs more per comparison than synthesized equality, so compareids in hot loops. -
Constant discriminator fields (
type,object) fall back to their known value when a response omits them. -
Documentation on the Swift Package Index is built for all four modules and leaves out compiler-synthesized pages, which halves its size.