Skip to content

OpenAIKit 4.2.0

Latest

Choose a tag to compare

@MarcoDotIO MarcoDotIO released this 26 Nov 06:30
eb9848c
.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) and OpenAIKitAdmin (Administration API). The OpenAIKit product 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.

  • Generated models no longer each carry a CodingKeys enum and a synthesized ==/hash(into:). They decode with shared string keys, and OpenAIModel supplies Equatable and Hashable once for all types. Equality compares canonical JSON, so nil and an omitted field compare equal, as on the wire. It costs more per comparison than synthesized equality, so compare ids 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.