Kotlin SDKGen 0.4.0 adds immutable client-scoped configuration, explicit SSE envelope payload projection, correct parameter wire encoding, and configuration-cache-safe generated-source wiring for JVM, Kotlin Multiplatform, and Android consumers.
Breaking
- Generated streaming API: operations configured with
x-sdkgen-streaming.payloadPropertynow returnFlowof the JSON value carried by each SSEdata:field instead ofFlowof the declared envelope model. In the OpenRouter conformance SDK, this correctsChatClient.sendChatCompletionRequestStream,ImagesClient.createImagesStream,AnthropicMessagesClient.createMessagesStream, andBetaResponsesClient.createResponsesStream. Consumers of those generated methods must update their stream element types.
Added
SdkClientConfig, an immutable client-scoped runtime configuration value for retry and deadline defaults, request hooks, logical and attempt middleware, lifecycle observers, shared retry budgets, and product identity. Generated root and resource clients share one configuration instance while retaining the 0.3.0 constructor ABI.runtime.defaultServerandruntime.userAgentSuffixconfiguration now reach generated constructors and request identity, with fail-closed validation for invalid URLs and line breaks.x-sdkgen-streaming.payloadPropertyprojects an SSE envelope property into the generated stream element type and rejects missing or non-object envelope contracts.SdkGenConfiguration.generatedSourcesexposes the generation task's output as a Gradle file collection for Android and custom Kotlin Multiplatform source-set wiring.
Changed
- The OpenRouter conformance overlay now projects the documented
datapayload for chat, image, Anthropic message, and beta response streams; envelope models remain generated. - Generated union predicates and parameter encoding omit redundant casts, statically decided type checks, and unnecessary
toString()calls, eliminating the tracked high-volume OpenRouter compiler warnings without changing acceptance semantics. StreamingModel.SsegainspayloadPropertywhile retaining a three-argument secondary constructor for source compatibility.
Fixed
- Enum-typed path, query, and header parameters use their documented wire values rather than Kotlin enum case names across scalar, repeated, comma-joined, Stripe-indexed, and deep-object encodings.
- Nullable union branches accept explicit JSON
nullfor nullable properties instead of incorrectly raisingNoMatchException. - Gradle generated-source wiring no longer queries mapped task output during configuration, restoring Android compilation and configuration-cache reuse.
- ktlint integration uses the supported filtering API across plugin application order and class-loader boundaries.
Verification
- The protected release workflow passed the JVM, JS, Android, Linux, and Apple target lanes, API/ABI checks, live cross-corpus parity, benchmark budgets, isolated publication, signed artifact, SBOM, attestation, and external-consumer gates.
- The OpenRouter corpus generates all 89 operations with zero blockers. The 0.3.0-to-0.4.0 compatibility packet records four intended breaking stream element-type corrections, 29 additive declarations, two unknown digest-level changes, and explicitly unavailable behavior and generated-SDK ABI layers.
Coordinates
- Maven Central:
io.github.nabobery:kotlin-sdkgen-*:0.4.0 - Gradle Plugin Portal:
io.github.nabobery.kotlin-sdkgenversion0.4.0
See the changelog, ADR 0022, compatibility evidence, and support policy.
Full changelog: v0.3.0...v0.4.0