KtorStabilityAiGenerationApi

class KtorStabilityAiGenerationApi(val httpClient: HttpClient, val baseUrl: String, val json: Json = defaultNetworkJson) : StabilityAiGenerationApi(source)

Ktor implementation of Stability AI generation calls with counted inference traffic.

Author

Dmitriy Moroz

Parameters

httpClient

Configured Ktor client used to send provider requests.

baseUrl

Stability AI API base URL.

json

JSON codec used for counted request/response payloads.

Constructors

Link copied to clipboard
constructor(httpClient: HttpClient, baseUrl: String, json: Json = defaultNetworkJson)
constructor(baseUrl: String)

Types

Link copied to clipboard
private object Companion

Properties

Link copied to clipboard
private val baseUrl: String

Exposes the baseUrl value used by the SDAI network layer.

Link copied to clipboard
private val httpClient: HttpClient

Exposes the httpClient value used by the SDAI network layer.

Link copied to clipboard
private val json: Json

Exposes the json value used by the SDAI network layer.

Functions

Link copied to clipboard
open suspend override fun fetchCredits(apiKey: String): StabilityCreditsResponse

Loads SDAI data through fetchCredits.

Link copied to clipboard
open suspend override fun imageToImage(apiKey: String, engineId: String, imageBytes: ByteArray, parameters: Map<String, String>): StabilityGenerationResponse

Executes the imageToImage step in the SDAI network layer.

Link copied to clipboard
private suspend fun <T> mapStabilityError(block: suspend () -> T): T
Link copied to clipboard
open suspend override fun textToImage(apiKey: String, engineId: String, request: StabilityTextToImageRequest): StabilityGenerationResponse

Executes the textToImage step in the SDAI network layer.

Link copied to clipboard
open suspend override fun validateBearerToken(apiKey: String)

Executes the validateBearerToken step in the SDAI network layer.