Stability AI MCP Server

/** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. */ export interface paths { "/v2alpha/generation/image-to-video": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * image-to-video * @description Generate a short video based on an initial image with [Stable Video Diffusion](https://static1.squarespace.com/static/6213c340453c3f502425776e/t/655ce779b9d47d342a93c890/1700587395994/stable_video_diffusion.pdf), * a latent video diffusion model. * * * * ### How to generate a video * Video generations are asynchronous, so after starting a generation use the `id` returned in the response to poll [/v2alpha/generation/image-to-video/result/{id}](#tag/v2alphageneration/paths/~1v2alpha~1generation~1image-to-video~1result~1%7Bid%7D/get) for results. * * ### Price * Flat rate of 20 cents per generation. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": components["schemas"]["ImageToVideoRequest"]; }; }; responses: { /** @description Video generation started. Poll for results using the `id` in the response [here](#tag/v2alphageneration/paths/~1v2alpha~1generation~1image-to-video~1result~1%7Bid%7D/get). */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": { id: components["schemas"]["GenerationID"]; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2alpha/generation/image-to-video/result/{id}": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * image-to-video/result * @description Fetch the result of an image-to-video generation by ID. Make sure you use the same API key that you used to * generate the video, otherwise you will receive a `404` response. * * ### How is progress reported? * Your generation is either `in-progress` (i.e. status code `202`) or it is complete (i.e. status code `200`). * We may add more fine-grained progress reporting in the future (e.g. a numerical progress). * * ### How long are results stored? * Results are stored for 24 hours after generation. After that, the results are deleted and you will need to * re-generate your video. */ get: { parameters: { query?: never; header: { authorization: string; accept?: "video/*" | "application/json"; }; path: { id: components["schemas"]["GenerationID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description The result of your video generation. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated video. * * To receive the bytes of the video directly, specify `video/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and one or more frames have been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "video/mp4": string; "application/json; type=video/mp4": { /** * @description The generated video, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ video: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and one or more frames have been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Your image-to-video generation is still in-progress. */ 202: { headers: { [name: string]: unknown; }; content: { "application/json": { id: components["schemas"]["GenerationID"]; /** * @description The status of your generation. * @enum {string} */ status: "in-progress"; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description id: the generation either does not exist or has expired. */ 404: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2alpha/generation/stable-image/upscale": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * stable-image/upscale * @description Takes images between 64x64 and 1 megapixel and upscales them all the way to **4K** resolution. Put more * generally, it can upscale images ~20-40x times while preserving, and often enhancing, quality. * * ### How to use * - Invoke this endpoint with the required parameters to start a generation * - Use that `id` in the response to poll for results at the [upscale/result/{id}](#tag/v2alphageneration/paths/~1v2alpha~1generation~1stable-image~1upscale~1result~1%7Bid%7D/get) endpoint * - Rate-limiting or other errors may occur if you poll more than once every 10 seconds * * ### Price * Flat rate of 25 cents per generation. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description The image you wish to upscale. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 1,048,576 pixels * @example ./some/image.png */ image: string; /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "jpeg" | "png" | "webp"; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Indicates how creative the model should be when upscaling an image. * Higher values will result in more details being added to the image during upscaling. * @default 0.3 */ creativity?: number; }; }; }; responses: { /** @description Upscaling was successful! */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": { id: components["schemas"]["GenerationID"]; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2alpha/generation/stable-image/upscale/result/{id}": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * stable-image/upscale/result * @description Fetch the result of an upscale generation by ID. Make sure to use the same API key to fetch the generation result * that you used to create the generation, otherwise you will receive a `404` response. * * ### How is progress reported? * Your generation is either `in-progress` (i.e. status code `202`) or it is complete (i.e. status code `200`). * We may add more fine-grained progress reporting in the future (e.g. a numerical progress). * * ### How long are results stored? * Results are stored for 24 hours after generation. After that, the results are deleted. */ get: { parameters: { query?: never; header: { authorization: string; accept?: "image/*" | "application/json"; }; path: { id: components["schemas"]["GenerationID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description The upscale was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Your upscale generation is still in-progress. */ 202: { headers: { [name: string]: unknown; }; content: { "application/json": { id: components["schemas"]["GenerationID"]; /** * @description The status of your generation. * @enum {string} */ status: "in-progress"; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description id: the generation either does not exist or has expired. */ 404: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2alpha/generation/stable-image/inpaint": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * stable-image/inpaint * @description Inpaint an existing image, with or without a mask, using our latest-and-greatest inpainting model. * * ### Search-and-Replace Mode * This mode is ideal for individuals of all levels of skill in design. It can be used for straightforward * adjustments to images. The service will automatically mask the most appropriate object based on the contents * of the `search_prompt`, and replace it with a generated result based on the `prompt`. * * **How to use:** set the `mode` parameter to `search` and provide a short description of what to * search-and-replace in the `search_prompt` parameter. * * ### Mask Mode * This mode allows for precise control of generative fill tasks on an image, down to the level of * individual pixels. Design professionals can provide a `mask` for the section of the image to be replaced, * and use standard image prompting to describe the full image as it should appear after the editing. * The resulting image will incorporate all of the elements described in the `prompt`. * * **How to use:** set the `mode` parameter to `mask` and either pass in an `image` with an alpha channel * or provide an explicit mask image to the `mask` parameter. If both are present the `mask` parameter will * take precedence. * * ### Price * - Requests with `mode` set to `search` cost 4 cents. * - Requests with `mode` set to `mask` cost 3 cents. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": | components["schemas"]["InpaintingSearchModeRequestBody"] | components["schemas"]["InpaintingMaskingModeRequestBody"]; }; }; responses: { /** @description Inpainting was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/image-to-video": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Start generation * @description Generate a short video based on an initial image with [Stable Video Diffusion](https://static1.squarespace.com/static/6213c340453c3f502425776e/t/655ce779b9d47d342a93c890/1700587395994/stable_video_diffusion.pdf), * a latent video diffusion model. * * * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`. * * The body of the request should include: * - `image` * * The body may optionally include: * - `seed` * - `cfg_scale` * - `motion_bucket_id` * * > **Note:** for more details about these parameters please see the request schema below. * * After invoking this endpoint with the required parameters, use the `id` in the response to poll for results at the * [image-to-video/result/{id}](#tag/Image-to-Video/paths/~1v2beta~1image-to-video~1result~1%7Bid%7D/get) endpoint. Rate-limiting or other errors may occur if you poll more than once every 10 seconds. * * ### Credits * Flat rate of 20 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": components["schemas"]["ImageToVideoRequest"]; }; }; responses: { /** @description Video generation started. Poll for results using the `id` in the response [here](#tag/Image-to-Video/paths/~1v2beta~1image-to-video~1result~1%7Bid%7D/get). */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": { id: components["schemas"]["GenerationID"]; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/image-to-video/result/{id}": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Fetch generation result * @description Fetch the result of an image-to-video generation by ID. * * Make sure to use the same API key to fetch the generation result that you used to create the generation, * otherwise you will receive a `404` response. * * ### How to use * Please invoke this endpoint with a `GET` request. * * The headers of the request must include an API key in the `authorization` field and the ID * of your generation must be in the path. * * ### How is progress reported? * Your generation is either `in-progress` (i.e. status code `202`) or it is complete (i.e. status code `200`). * We may add more fine-grained progress reporting in the future (e.g. a numerical progress). * * ### How long are results stored? * Results are stored for 24 hours after generation. After that, the results are deleted and you will need to * re-generate your video. */ get: { parameters: { query?: never; header: { authorization: string; accept?: "video/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path: { id: components["schemas"]["GenerationID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description The result of your video generation. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated video. * * To receive the bytes of the video directly, specify `video/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and one or more frames have been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "video/mp4": string; "application/json; type=video/mp4": { /** * @description The generated video, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ video: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and one or more frames have been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Your image-to-video generation is still in-progress. */ 202: { headers: { [name: string]: unknown; }; content: { "application/json": { id: components["schemas"]["GenerationID"]; /** * @description The status of your generation. * @enum {string} */ status: "in-progress"; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description id: the generation either does not exist or has expired. */ 404: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/3d/stable-fast-3d": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Stable Fast 3D * @description Stable Fast 3D generates high-quality 3D assets from a single 2D input image. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/Stability-AI/stability-sdk/blob/main/nbs/Stable_Fast_3D_API.ipynb) * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`. * * The body of the request should include: * - `image` * * The body may optionally include: * - `texture_resolution` * - `foreground_ratio` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The output is a binary blob that includes a glTF asset, including JSON, buffers, and images. * See the [GLB File Format Specification](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#glb-file-format-specification) for more details. * * ### Credits * Flat rate of 2 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description The image to generate a 3D model from. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 4,194,304 pixels * @example ./some/image.png */ image: string; /** * @description Determines the resolution of the textures used for both the albedo (color) map * and the normal map. The resolution is specified in pixels, and a higher value * corresponds to a higher level of detail in the textures, allowing for more * intricate and precise rendering of surfaces. However, increasing the resolution * also results in larger asset sizes, which may impact loading times and * performance. 1024 is a good default value and rarely requires changing. * @default 1024 * @enum {string} */ texture_resolution?: "512" | "1024" | "2048"; /** * @description Controls the amount of padding around the object to be processed within the frame. * This ratio determines the relative size of the object compared to the total frame * size. A higher ratio means less padding and a larger object, while a lower ratio * increases the padding, effectively reducing the object’s size within the frame. This * can be useful when a long and narrow object, such as a car or bus, is viewed from the * front (the narrow side). Here, lowering the foreground ratio might help prevent the * generated 3D assets from appearing squished or distorted. The default value of 0.85 * is good for most objects. * @default 0.85 */ foreground_ratio?: number; /** * @description Controls the remeshing algorithm used to generate the 3D model. The remeshing * algorithm determines how the 3D model is constructed from the input image. The * default value of "none" means that the model is generated without remeshing, * which is suitable for most use cases. The "triangle" option generates a model * with triangular faces, while the "quad" option generates a model with quadrilateral * faces. The "quad" option is useful when the 3D model will be used in DCC tools such * as Maya or Blender. * @default none * @enum {string} */ remesh?: "none" | "triangle" | "quad"; /** * @description If specified, the result will have approximately this many vertices (and consequently fewer faces) in the simplified mesh. * * Setting this value to -1 (the default value) means that a limit is not set. * @default -1 */ vertex_count?: number; }; }; }; responses: { /** @description Generation was successful. */ 200: { headers: { /** @description The format of the 3D model. */ "content-type"?: string; [name: string]: unknown; }; content: { "model/gltf-binary": string; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/results/{id}": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Fetch async generation result * @description Fetch the result of a generation by ID. * * Make sure to use the same API key to fetch the generation result that you used to create the generation, * otherwise you will receive a `404` response. * * ### How to use * Please invoke this endpoint with a `GET` request. * * The headers of the request must include an API key in the `authorization` field and the ID * of your generation must be in the path. * * ### How is progress reported? * Your generation is either `in-progress` (i.e. status code `202`) or it is complete (i.e. status code `200`). * We may add more fine-grained progress reporting in the future (e.g. a numerical progress). * * ### How long are results stored? * Results are stored for 24 hours after generation. After that, the results are deleted. */ get: { parameters: { query?: never; header: { authorization: string; accept?: "*/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path: { id: components["schemas"]["GenerationID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description Generation finished. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Your generation is still in-progress. */ 202: { headers: { [name: string]: unknown; }; content: { "application/json": { id: components["schemas"]["GenerationID"]; /** * @description The status of your generation. * @enum {string} */ status: "in-progress"; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description id: the generation either does not exist or has expired. */ 404: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/upscale/conservative": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Conservative * @description Takes images between 64x64 and 1 megapixel and upscales them all the way to 4K resolution. Put more generally, it can upscale images ~20-40x times while preserving all aspects. Conservative Upscale minimizes alterations to the image and should not be used to reimagine an image. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=t1Q4w2uvvza0) * * ### How to use * * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request must include: * - `image` * - `prompt` * * Optionally, the body of the request may also include: * - `negative_prompt` * - `seed` * - `output_format` * - `creativity` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The resolution of the generated image will be 4 megapixels. * * ### Credits * Flat rate of 25 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description The image you wish to upscale. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * - The aspect ratio must be between 1:2.5 and 2.5:1 * @example ./some/image.png */ image: string; /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "jpeg" | "png" | "webp"; creativity?: components["schemas"]["Creativity"]; }; }; }; responses: { /** @description Upscale was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/upscale/creative": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Creative Upscale (async) * @description Takes images between 64x64 and 1 megapixel and upscales them all the way to **4K** resolution. Put more * generally, it can upscale images ~20-40x times while preserving, and often enhancing, quality. * Creative Upscale **works best on highly degraded images and is not for photos of 1mp or above** as it performs * heavy reimagining (controlled by creativity scale). * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=QXxi9tfI425t) * * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`. * * The body of the request should include: * - `image` * - `prompt` * * The body may optionally include: * - `seed` * - `negative_prompt` * - `output_format` * - `creativity` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Results * After invoking this endpoint with the required parameters, use the `id` in the response to poll for results at the * [results/{id} endpoint](#tag/Results/paths/~1v2beta~1results~1%7Bid%7D/get). Rate-limiting or other errors may occur if you poll more than once every 10 seconds. * * ### Credits * Flat rate of 25 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description The image you wish to upscale. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 1,048,576 pixels * @example ./some/image.png */ image: string; /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "jpeg" | "png" | "webp"; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Indicates how creative the model should be when upscaling an image. * Higher values will result in more details being added to the image during upscaling. * @default 0.3 */ creativity?: number; }; }; }; responses: { /** @description Upscale was started. */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": { id: components["schemas"]["GenerationID"]; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/upscale/creative/result/{id}": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Fetch Creative Upscale result * @description Fetch the result of an upscale generation by ID. * * Make sure to use the same API key to fetch the generation result that you used to create the generation, * otherwise you will receive a `404` response. * * ### How to use * Please invoke this endpoint with a `GET` request. * * The headers of the request must include an API key in the `authorization` field and the ID * of your generation must be in the path. * * ### How is progress reported? * Your generation is either `in-progress` (i.e. status code `202`) or it is complete (i.e. status code `200`). * We may add more fine-grained progress reporting in the future (e.g. a numerical progress). * * ### How long are results stored? * Results are stored for 24 hours after generation. After that, the results are deleted. */ get: { parameters: { query?: never; header: { authorization: string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path: { id: components["schemas"]["GenerationID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description Upscale finished. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Your upscale generation is still in-progress. */ 202: { headers: { [name: string]: unknown; }; content: { "application/json": { id: components["schemas"]["GenerationID"]; /** * @description The status of your generation. * @enum {string} */ status: "in-progress"; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description id: the generation either does not exist or has expired. */ 404: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/upscale/fast": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Fast * @description Our Fast Upscaler service enhances image resolution by 4x using predictive and generative AI. This lightweight and fast service (processing in ~1 second) is ideal for enhancing the quality of compressed images, making it suitable for social media posts and other applications. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=t1Q4w2uvvza0) * * ### How to use * * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request must include: * - `image` * * Optionally, the body of the request may also include: * - `output_format` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The resolution of the generated image is 4 times that of the input image with a maximum size of 16 megapixels. * * ### Credits * Flat rate of 1 credit per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description The image you wish to upscale. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Width must be between 32 and 1,536 pixels * - Height must be between 32 and 1,536 pixels * - Total pixel count must be between 1,024 and 1,048,576 pixels * @example ./some/image.png */ image: string; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "jpeg" | "png" | "webp"; }; }; }; responses: { /** @description Upscale was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/edit/erase": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Erase * @description The Erase service removes unwanted objects, such as blemishes on portraits or items on desks, using image masks. * * The mask is provided in one of two ways: * 1. Explicitly passing in a separate image via the `mask` parameter * 2. Derived from the alpha channel of the `image` parameter. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=t1Q4w2uvvza0) * * ### How to use * * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request must include: * - `image` * * Optionally, the body of the request may also include: * - `mask` * - `seed` * - `output_format` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The resolution of the generated image will be 4 megapixels. * * ### Credits * Flat rate of 3 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description The image you wish to erase from. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * @example ./some/image.png */ image: string; /** * Format: binary * @description Controls the strength of the inpainting process on a per-pixel basis, either via a * second image (passed into this parameter) or via the alpha channel of the `image` parameter. * * **Passing in a Mask** * * The image passed to this parameter should be a black and white image that represents, * at any pixel, the strength of inpainting based on how dark or light the given pixel is. * Completely black pixels represent no inpainting strength while completely white pixels * represent maximum strength. * * In the event the mask is a different size than the `image` parameter, it will be automatically resized. * * **Alpha Channel Support** * * If you don't provide an explicit mask, one will be derived from the alpha channel of the `image` parameter. * Transparent pixels will be inpainted while opaque pixels will be preserved. * * In the event an `image` with an alpha channel is provided along with a `mask`, the `mask` will take precedence. * @example ./some/image.png */ mask?: string; /** * @description Grows the edges of the mask outward in all directions by the specified number of pixels. The expanded area around the mask will be blurred, which can help smooth the transition between inpainted content and the original image. * * Try this parameter if you notice seams or rough edges around the inpainted content. * * > Note: Excessive growth may obscure fine details in the mask and/or merge nearby masked regions. * @default 5 */ grow_mask?: number; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "jpeg" | "png" | "webp"; }; }; }; responses: { /** @description Erase was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/edit/inpaint": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Inpaint * @description Intelligently modify images by filling in or replacing specified areas with new content based * on the content of a "mask" image. * * The "mask" is provided in one of two ways: * 1. Explicitly passing in a separate image via the `mask` parameter * 2. Derived from the alpha channel of the `image` parameter. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=t1Q4w2uvvza0) * * ### How to use * * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request must include: * - `image` * - `prompt` * * Optionally, the body of the request may also include: * - `mask` * - `negative_prompt` * - `seed` * - `output_format` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The resolution of the generated image will be 4 megapixels. * * ### Credits * Flat rate of 3 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description The image you wish to inpaint. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * @example ./some/image.png */ image: string; /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * Format: binary * @description Controls the strength of the inpainting process on a per-pixel basis, either via a * second image (passed into this parameter) or via the alpha channel of the `image` parameter. * * **Passing in a Mask** * * The image passed to this parameter should be a black and white image that represents, * at any pixel, the strength of inpainting based on how dark or light the given pixel is. * Completely black pixels represent no inpainting strength while completely white pixels * represent maximum strength. * * In the event the mask is a different size than the `image` parameter, it will be automatically resized. * * **Alpha Channel Support** * * If you don't provide an explicit mask, one will be derived from the alpha channel of the `image` parameter. * Transparent pixels will be inpainted while opaque pixels will be preserved. * * In the event an `image` with an alpha channel is provided along with a `mask`, the `mask` will take precedence. * @example ./some/image.png */ mask?: string; /** * @description Grows the edges of the mask outward in all directions by the specified number of pixels. The expanded area around the mask will be blurred, which can help smooth the transition between inpainted content and the original image. * * Try this parameter if you notice seams or rough edges around the inpainted content. * * > Note: Excessive growth may obscure fine details in the mask and/or merge nearby masked regions. * @default 5 */ grow_mask?: number; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "jpeg" | "png" | "webp"; }; }; }; responses: { /** @description Inpainting was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/edit/outpaint": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Outpaint * @description The Outpaint service inserts additional content in an image to fill in the space in any direction. * Compared to other automated or manual attempts to expand the content in an image, the Outpaint service * should minimize artifacts and signs that the original image has been edited. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=bZ2yK7VQSgLw) * * ### How to use * * Please invoke this endpoint with a POST request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request must include: * - `image` * * Along with _at least one_ outpaint direction: * - `left` * - `right` * - `up` * - `down` * * > **Note:** for best quality use outpaint direction values smaller or equal to your source image dimensions. * * Each of these parameters should be set to a number between 0 and 2000, representing the number of pixels to outpaint in that direction. * * Optionally, the body of the request may also include: * - `prompt` * - `seed` * - `output_format` * - `creativity` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Credits * Flat rate of 4 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description The image you wish to outpaint. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * - The aspect ratio must be between 1:2.5 and 2.5:1 * @example ./some/image.png */ image: string; /** * @description The number of pixels to outpaint on the left side of the image. At least one outpainting direction must be supplied with a non-zero value. * @default 0 */ left?: number; /** * @description The number of pixels to outpaint on the right side of the image. At least one outpainting direction must be supplied with a non-zero value. * @default 0 */ right?: number; /** * @description The number of pixels to outpaint on the top of the image. At least one outpainting direction must be supplied with a non-zero value. * @default 0 */ up?: number; /** * @description The number of pixels to outpaint on the bottom of the image. At least one outpainting direction must be supplied with a non-zero value. * @default 0 */ down?: number; creativity?: components["schemas"]["Creativity"] & unknown; /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt?: string; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "png" | "jpeg" | "webp"; }; }; }; responses: { /** @description Outpainting was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/edit/search-and-replace": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Search and Replace * @description The Search and Replace service is a specific version of inpainting that does not require a mask. * Instead, users can leverage a `search_prompt` to identify an object in simple language to be replaced. * The service will automatically segment the object and replace it with the object requested in the prompt. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=0lDpGa2jAmAs) * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request should include: * - `image` * - `prompt` * - `search_prompt` * * The body may optionally include: * - `seed` * - `negative_prompt` * - `output_format` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The resolution of the generated image will be 4 megapixels. * * ### Credits * Flat rate of 4 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description An image containing content you wish to replace. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * - The aspect ratio must be between 1:2.5 and 2.5:1 * @example ./some/image.png */ image: string; /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** * @description Short description of what to inpaint in the `image`. * @example glasses */ search_prompt: string; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description Grows the edges of the mask outward in all directions by the specified number of pixels. The expanded area around the mask will be blurred, which can help smooth the transition between inpainted content and the original image. * * Try this parameter if you notice seams or rough edges around the inpainted content. * * > Note: Excessive growth may obscure fine details in the mask and/or merge nearby masked regions. * @default 3 */ grow_mask?: number; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "jpeg" | "png" | "webp"; }; }; }; responses: { /** @description Search-and-Replace was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/edit/search-and-recolor": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Search and Recolor * @description The Search and Recolor service provides the ability to change the color of a specific object in an image using a prompt. * This service is a specific version of inpainting that does not require a mask. The Search and Recolor * service will automatically segment the object and recolor it using the colors requested in the prompt. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=mtgSh4Stj3l) * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request should include: * - `image` * - `prompt` * - `select_prompt` * * The body may optionally include: * - `grow_mask` * - `seed` * - `negative_prompt` * - `output_format` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The resolution of the generated image will match the resolution of the input image. * * ### Credits * Flat rate of 5 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description An image containing content you wish to recolor. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * - The aspect ratio must be between 1:2.5 and 2.5:1 * @example ./some/image.png */ image: string; /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** * @description Short description of what to search for in the `image`. * @example glasses */ select_prompt: string; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description Grows the edges of the mask outward in all directions by the specified number of pixels. The expanded area around the mask will be blurred, which can help smooth the transition between inpainted content and the original image. * * Try this parameter if you notice seams or rough edges around the inpainted content. * * > Note: Excessive growth may obscure fine details in the mask and/or merge nearby masked regions. * @default 3 */ grow_mask?: number; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "jpeg" | "png" | "webp"; }; }; }; responses: { /** @description Search-and-Recolor was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/edit/remove-background": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Remove Background * @description The Remove Background service accurately segments the foreground from an image and implements * and removes the background. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=VHofb3LAVmqi) * * * ### How to use * * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request must include: * - `image` * * Optionally, the body of the request may also include: * - `output_format` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Credits * Flat rate of 2 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description The image whose background you wish to remove. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 4,194,304 pixels * @example ./some/image.png */ image: string; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "png" | "webp"; }; }; }; responses: { /** @description Background successfully removed. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/edit/replace-background-and-relight": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Replace Background and Relight (async) * @description The Replace Background and Relight edit service lets users swap backgrounds with * AI-generated or uploaded images while adjusting lighting to match the subject. This * new API provides a streamlined image editing solution and can serve e-commerce, real * estate, photography, and creative projects. * * Some of the things you can do include: * - Background Replacement: Remove existing background and add new ones. * - AI Background Generation: Create new backgrounds using AI generated images based on prompts. * - Relighting: Adjust lighting in images that are under or overexposed. * - Flexible Inputs: Use your own background image or generate one. * - Lighting Adjustments: Modify light reference, direction, and strength. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=mtgSh4Stj3l) * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`. * * The body of the request should include: * - `subject_image` * - `background_prompt` and/or `background_reference` * * The body may optionally include: * - `light_reference` or `light_source_direction` * - `light_source_strength` (requires `light_reference` or `light_source_direction`) * - `foreground_prompt` * - `negative_prompt` * - `preserve_original_subject` * - `original_background_depth` * - `keep_original_background` * - `light_source_strength` * - `seed` * - `output_format` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Results * After invoking this endpoint with the required parameters, use the `id` in the response to poll for results at the * [results/{id} endpoint](#tag/Results/paths/~1v2beta~1results~1%7Bid%7D/get). Rate-limiting or other errors may occur if you poll more than once every 10 seconds. * * ### Credits * Flat rate of 8 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** * Format: binary * @description An image containing the subject that you wish to change background and relight. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * - The aspect ratio must be between 1:2.5 and 2.5:1 * @example ./some/image.png */ subject_image: string; /** * Format: binary * @description An image whose style you wish to use in the background. Similar to the Control: Style API, * stylistic elements from this image are added to the background. * * > **Important:** either `background_reference` or `background_prompt` must be provided. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * @example ./some/image.png */ background_reference?: string; /** @description What you wish to see in the background of the output image. This could be a description * of the desired background scene, or just a description of the lighting if modifying the * light source through `light_source_direction` or `light_reference`. * * > **Important:** either `background_reference` or `background_prompt` must be provided. */ background_prompt?: string; /** @description Description of the subject. Use this to prevent elements of the background from * bleeding into the subject. For example, if you find your subject is turning * green with a forest in the background, try putting a short description of the * subject in this field. */ foreground_prompt?: string; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description How much to overlay the original subject to exactly match the original image. A * 1.0 is an exact pixel match for the subject, and 0.0 is a close match but will * have new lighting qualities. This is an advanced feature. * @default 0.6 */ preserve_original_subject?: number; /** * @description Controls the generated background to have the same depth as the original subject image. This is an advanced feature. * @default 0.5 */ original_background_depth?: number; /** * @description Whether to keep the background of the original image. When this is on, the background * will have different lighting than the original image that changes based on the other * parameters in this API. * @default false * @enum {string} */ keep_original_background?: "true" | "false"; /** * @description Direction of the light source. * @enum {string} */ light_source_direction?: "left" | "right" | "above" | "below"; /** * Format: binary * @description An image with the desired lighting. Lighter sections of the light_reference image will correspond to sections with brighter lighting in the output image. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * @example ./some/image.png */ light_reference?: string; /** * @description If using `light_reference_image` or `light_source_direction`, controls the strength * of the light source. 1.0 is brighter and 0.0 is dimmer. This is an advanced feature. * * > **Important:** Use of this parameter requires `light_reference` or `light_source_direction` to be provided. * @default 0.3 */ light_source_strength?: number; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "jpeg" | "png" | "webp"; }; }; }; responses: { /** @description Replace Background and Relight was started. */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": { id: components["schemas"]["GenerationID"]; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/generate/ultra": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Stable Image Ultra * @description Our most advanced text to image generation service, Stable Image Ultra creates the highest quality images * with unprecedented prompt understanding. Ultra excels in typography, complex compositions, dynamic lighting, * vibrant hues, and overall cohesion and structure of an art piece. Made from the most advanced models, * including Stable Diffusion 3.5, Ultra offers the best of the Stable Diffusion ecosystem. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=yXhs626oZdr1) * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`. The accept header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image in the format specified by the `output_format` parameter, but encoded to base64 in a JSON response. * * The only required parameter is the `prompt` field, which should contain the text prompt for the image generation. * * The body of the request should include: * - `prompt` - text to generate the image from * * The body may optionally include: * - `image` - the image to use as the starting point for the generation * - `strength` - controls how much influence the `image` parameter has on the output image * - `aspect_ratio` - the aspect ratio of the output image * - `negative_prompt` - keywords of what you **do not** wish to see in the output image * - `seed` - the randomness seed to use for the generation * - `output_format` - the the format of the output image * * > **Note:** for the full list of optional parameters, please see the request schema below. * * ### Output * The resolution of the generated image will be 1 megapixel. The default resolution is 1024x1024. * * ### Credits * The Ultra service uses 8 credits per successful result. You will not be charged for failed results. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description Controls the aspect ratio of the generated image. * @default 1:1 * @enum {string} */ aspect_ratio?: | "21:9" | "16:9" | "3:2" | "5:4" | "1:1" | "4:5" | "2:3" | "9:16" | "9:21"; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "jpeg" | "png" | "webp"; /** * Format: binary * @description The image to use as the starting point for the generation. * * > **Important:** The `strength` parameter is required when `image` is provided. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Width must be between 64 and 16,384 pixels * - Height must be between 64 and 16,384 pixels * - Total pixel count must be at least 4,096 pixels * @example ./some/image.png */ image?: string; /** @description Sometimes referred to as _denoising_, this parameter controls how much influence the * `image` parameter has on the generated image. A value of 0 would yield an image that * is identical to the input. A value of 1 would be as if you passed in no image at all. * * > **Important:** This parameter is required when `image` is provided. */ strength?: number; }; }; }; responses: { /** @description Generation was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/generate/core": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Stable Image Core * @description Our primary service for text-to-image generation, Stable Image Core represents the best quality achievable at high * speed. No prompt engineering is required! Try asking for a style, a scene, or a character, and see what you get. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=yXhs626oZdr1) * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request should include: * - `prompt` * * The body may optionally include: * - `aspect_ratio` * - `negative_prompt` * - `seed` * - `style_preset` * - `output_format` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The resolution of the generated image will be 1.5 megapixels. * * ### Credits * Flat rate of 3 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** * @description Controls the aspect ratio of the generated image. * @default 1:1 * @enum {string} */ aspect_ratio?: | "21:9" | "16:9" | "3:2" | "5:4" | "1:1" | "4:5" | "2:3" | "9:16" | "9:21"; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Guides the image model towards a particular style. * @enum {string} */ style_preset?: | "enhance" | "anime" | "photographic" | "digital-art" | "comic-book" | "fantasy-art" | "line-art" | "analog-film" | "neon-punk" | "isometric" | "low-poly" | "origami" | "modeling-compound" | "cinematic" | "3d-model" | "pixel-art" | "tile-texture"; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "png" | "jpeg" | "webp"; }; }; }; responses: { /** @description Generation was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/generate/sd3": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Stable Diffusion 3.0 & 3.5 * @description Generate using Stable Diffusion 3.5 models, Stability AI latest base model: * * - **Stable Diffusion 3.5 Large**: At 8 billion parameters, with superior quality and * prompt adherence, this base model is the most powerful in the Stable Diffusion * family. This model is ideal for professional use cases at 1 megapixel resolution. * * - **Stable Diffusion 3.5 Large Turbo**: A distilled version of Stable Diffusion 3.5 Large. * SD3.5 Large Turbo generates high-quality images with exceptional prompt adherence * in just 4 steps, making it considerably faster than Stable Diffusion 3.5 Large. * * - **Stable Diffusion 3.5 Medium**: With 2.5 billion parameters, the model delivers an * optimal balance between prompt accuracy and image quality, making it an efficient * choice for fast high-performance image generation. * * Read more about the model capabilities [here](https://stability.ai/news/introducing-stable-diffusion-3-5). * * Stable Diffusion 3.0 models are also supported, powered by [Fireworks AI](https://fireworks.ai/). API status can be reviewed [here](https://readme.fireworks.ai/page/application-status). * * - **SD3 Large**: the 8 billion parameter model * - **SD3 Large Turbo**: the 8 billion parameter model with a faster inference time * - **SD3 Medium**: the 2 billion parameter model * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/SD3_API.ipynb) * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`. The accept header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * #### **Generating with a prompt** * Commonly referred to as **text-to-image**, this mode generates an image from text alone. While the only required * parameter is the `prompt`, it also supports an `aspect_ratio` parameter which can be used to control the * aspect ratio of the generated image. * * #### **Generating with a prompt *and* an image** * Commonly referred to as **image-to-image**, this mode also generates an image from text but uses an existing image as the * starting point. The required parameters are: * - `prompt` - text to generate the image from * - `image` - the image to use as the starting point for the generation * - `strength` - controls how much influence the `image` parameter has on the output image * - `mode` - must be set to `image-to-image` * * > **Note:** maximum request size is 10MiB. * * #### **Optional Parameters:** * Both modes support the following optional parameters: * - `model` - the model to use (SD3 Large, SD3 Large Turbo, or SD3 Medium) * - `output_format` - the the format of the output image * - `seed` - the randomness seed to use for the generation * - `negative_prompt` - keywords of what you **do not** wish to see in the output image * - `cfg_scale` - controls how strictly the diffusion process adheres to the prompt text * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The resolution of the generated image will be 1MP. The default resolution is 1024x1024. * * ### Credits * - **SD 3.5 & 3.0 Large**: Flat rate of 6.5 credits per successful generation. * - **SD 3.5 & 3.0 Large Turbo**: Flat rate of 4 credits per successful generation. * - **SD 3.5 & 3.0 Medium**: Flat rate of 3.5 credits per successful generation. * * As always, you will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. */ prompt: string; /** * GenerationMode * @description Controls whether this is a text-to-image or image-to-image generation, which affects which parameters are required: * - **text-to-image** requires only the `prompt` parameter * - **image-to-image** requires the `prompt`, `image`, and `strength` parameters * @default text-to-image * @enum {string} */ mode?: "text-to-image" | "image-to-image"; /** * Format: binary * @description The image to use as the starting point for the generation. * * Supported formats: * - jpeg * - png * - webp * * Supported dimensions: * - Every side must be at least 64 pixels * * > **Important:** This parameter is only valid for **image-to-image** requests. */ image?: string; /** @description Sometimes referred to as _denoising_, this parameter controls how much influence the * `image` parameter has on the generated image. A value of 0 would yield an image that * is identical to the input. A value of 1 would be as if you passed in no image at all. * * > **Important:** This parameter is only valid for **image-to-image** requests. */ strength?: number; /** * @description Controls the aspect ratio of the generated image. Defaults to 1:1. * * > **Important:** This parameter is only valid for **text-to-image** requests. * @default 1:1 * @enum {string} */ aspect_ratio?: | "21:9" | "16:9" | "3:2" | "5:4" | "1:1" | "4:5" | "2:3" | "9:16" | "9:21"; /** * @description The model to use for generation. * * - `sd3.5-large` requires 6.5 credits per generation * - `sd3.5-large-turbo` requires 4 credits per generation * - `sd3.5-medium` requires 3.5 credits per generation * - `sd3-large` requires 6.5 credits per generation * - `sd3-large-turbo` requires 4 credits per generation * - `sd3-medium` requires 3.5 credits per generation * @default sd3.5-large * @enum {string} */ model?: | "sd3.5-large" | "sd3.5-large-turbo" | "sd3.5-medium" | "sd3-medium" | "sd3-large" | "sd3-large-turbo"; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "png" | "jpeg"; /** @description Keywords of what you **do not** wish to see in the output image. * This is an advanced feature. * * > **Important:** This parameter does **not** work with `sd3-large-turbo`. */ negative_prompt?: string; /** @description How strictly the diffusion process adheres to the prompt text (higher values keep your image closer to your prompt). */ cfg_scale?: number; }; }; }; responses: { /** @description Generation was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/control/sketch": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Sketch * @description This service offers an ideal solution for design projects that require brainstorming and * frequent iterations. It upgrades rough hand-drawn sketches to refined outputs with precise * control. For non-sketch images, it allows detailed manipulation of the final appearance by * leveraging the contour lines and edges within the image. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=ZKIAqHzJzzUo) * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request should include: * - `image` * - `prompt` * * The body may optionally include: * - `control_strength` * - `negative_prompt` * - `seed` * - `output_format` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The resolution of the generated image will match that of the input image. * * ### Credits * Flat rate of 3 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** * Format: binary * @description Supported Formats: * - jpeg * - png * - webp * * Image Dimensions: * - Every side must be at least 64 pixels * - The total pixel count cannot exceed 9,437,184 pixels (e.g. 3072x3072, 4096x2304, etc.) * * Image Aspect Ratio: * - Must be between 1:2.5 and 2.5:1 (i.e. cannot be too tall or too wide) * @example ./some/image.png */ image: string; /** * @description How much influence, or control, the `image` has on the generation. Represented as a float between 0 and 1, where 0 is the least influence and 1 is the maximum. * @default 0.7 */ control_strength?: number; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "png" | "jpeg" | "webp"; }; }; }; responses: { /** @description Generation was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/control/structure": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Structure * @description This service excels in generating images by maintaining the structure of an input image, * making it especially valuable for advanced content creation scenarios such as recreating * scenes or rendering characters from models. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=59RaZazXz0AU) * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request should include: * - `image` * - `prompt` * * The body may optionally include: * - `control_strength` * - `negative_prompt` * - `seed` * - `output_format` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The resolution of the generated image will match that of the input image. * * ### Credits * Flat rate of 3 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** * Format: binary * @description An image whose structure you wish to use as the foundation for a generation. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * - The aspect ratio must be between 1:2.5 and 2.5:1 * @example ./some/image.png */ image: string; /** * @description How much influence, or control, the `image` has on the generation. Represented as a float between 0 and 1, where 0 is the least influence and 1 is the maximum. * @default 0.7 */ control_strength?: number; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "png" | "jpeg" | "webp"; }; }; }; responses: { /** @description Generation was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2beta/stable-image/control/style": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Style * @description This service extracts stylistic elements from an input image (control image) and uses it to guide the creation of an output image based on the prompt. The result is a new image in the same style as the control image. * * ### Try it out * Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=y0WKjG72RvTE) * * ### How to use * Please invoke this endpoint with a `POST` request. * * The headers of the request must include an API key in the `authorization` field. The body of the request must be * `multipart/form-data`, and the `accept` header should be set to one of the following: * - `image/*` to receive the image in the format specified by the `output_format` parameter. * - `application/json` to receive the image encoded as base64 in a JSON response. * * The body of the request should include: * - `image` * - `prompt` * * The body may optionally include: * - `negative_prompt` * - `aspect_ratio` * - `fidelity` * - `seed` * - `output_format` * * > **Note:** for more details about these parameters please see the request schema below. * * ### Output * The resolution of the generated image will be 1MP. The default resolution is 1024x1024. * * ### Credits * Flat rate of 4 credits per successful generation. You will not be charged for failed generations. */ post: { parameters: { query?: never; header: { authorization: string; "content-type": string; accept?: "image/*" | "application/json"; "stability-client-id"?: components["schemas"]["StabilityClientID"]; "stability-client-user-id"?: components["schemas"]["StabilityClientUserID"]; "stability-client-version"?: components["schemas"]["StabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: { content: { "multipart/form-data": { /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** * Format: binary * @description An image whose style you wish to use as the foundation for a generation. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * - The aspect ratio must be between 1:2.5 and 2.5:1 * @example ./some/image.png */ image: string; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description Controls the aspect ratio of the generated image. * @default 1:1 * @enum {string} */ aspect_ratio?: | "21:9" | "16:9" | "3:2" | "5:4" | "1:1" | "4:5" | "2:3" | "9:16" | "9:21"; /** * @description How closely the output image's style resembles the input image's style. * @default 0.5 */ fidelity?: number; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed?: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format?: "png" | "jpeg" | "webp"; }; }; }; responses: { /** @description Generation was successful. */ 200: { headers: { /** @description A unique identifier for this request. */ "x-request-id"?: string; /** @description The format of the generated image. * * To receive the bytes of the image directly, specify `image/*` in the accept header. To receive the bytes base64 encoded inside of a JSON payload, specify `application/json`. */ "content-type"?: string; /** @description Indicates the reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `finish_reason`. */ "finish-reason"?: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * * > **NOTE:** This header is absent on JSON encoded responses because it is present in the body as `seed`. * @example 343940597 */ seed?: string; [name: string]: unknown; }; content: { "image/png": string; "application/json; type=image/png": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/jpeg": string; "application/json; type=image/jpeg": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; "image/webp": string; "application/json; type=image/webp": { /** * @description The generated image, encoded to base64. * @example AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1... */ image: string; /** * @description The reason the generation finished. * * - `SUCCESS` = successful generation. * - `CONTENT_FILTERED` = successful generation, however the output violated our content moderation * policy and has been blurred as a result. * @example SUCCESS * @enum {string} */ finish_reason: "SUCCESS" | "CONTENT_FILTERED"; /** * @description The seed used as random noise for this generation. * @default 0 * @example 343940597 */ seed: number; }; }; }; /** @description Invalid parameter(s), see the `errors` field for details. */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was flagged by our content moderation system. */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ContentModerationResponse"]; }; }; /** @description Your request was larger than 10MiB. */ 413: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description Your request was well-formed, but rejected. See the `errors` field for details. */ 422: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description You have made more than 150 requests in 10 seconds. */ 429: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; /** @description An internal error occurred. If the problem persists [contact support](https://stabilityplatform.freshdesk.com/support/tickets/new). */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Short-hand name for an error, useful for discriminating between errors with the same status code. * @example bad_request */ name: string; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; }; }; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v1/generation/{engine_id}/text-to-image": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Text-to-image * @description Generate an image from a text prompt. * ### Using SDXL 1.0 * Use `stable-diffusion-xl-1024-v1-0` as the `engine_id` of your request and pass in `height` & `width` as one of the following combinations: * - 1024x1024 (default) * - 1152x896 * - 896x1152 * - 1216x832 * - 1344x768 * - 768x1344 * - 1536x640 * - 640x1536 * * ### SDXL 1.0 Pricing * When specifying 30 steps or fewer, generation costs 0.9 credits. * * When specifying above 30 steps, generation cost is determiend using the following formula: * * `cost = 0.9 * (steps / 30)` * * ### Using SD 1.6 * SD1.6 is a flexible-resolution base model allowing you to generate non-standard aspect ratios. The model is optimized for a resolution of 512 x 512 pixels. To generate 1 megapixel outputs, we recommend using SDXL 1.0, which is available at the same price. * * Pass in `stable-diffusion-v1-6` as the `engine_id` of your request and ensure the `height` & `width` you pass in adhere to the following restrictions: * - No dimension can be less than 320 pixels * - No dimension can be greater than 1536 pixels * - Height and width must be specified in increments of 64 * - The default resolution is 512 x 512 * */ post: operations["textToImage"]; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v1/generation/{engine_id}/image-to-image": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Image-to-image with prompt * @description Produce an image from an existing image using a text prompt. * ### How to control strength of generation * To preserve only roughly 35% of the initial image, pass in either `init_image_mode=IMAGE_STRENGTH` and `image_strength=0.35` or `init_image_mode=STEP_SCHEDULE` and `step_schedule_start=0.65`. Both of these are equivalent, however `init_image_mode=STEP_SCHEDULE` also lets you pass in `step_schedule_end`, which can provide an extra level of control for those who need it. For more details, see the specific fields below. * * > NOTE: Only **Version 1** engines will work with this endpoint. */ post: operations["imageToImage"]; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v1/generation/{engine_id}/image-to-image/masking": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Image-to-image with a mask * @description Selectively modify portions of an image using a mask. The `mask` must be the same shape and size as the init image. This endpoint also supports `image` parameters with alpha channels. See below for more details. * * > NOTE: Only **Version 1** engines will work with this endpoint. */ post: operations["masking"]; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v1/engines/list": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * List engines * @description List all engines available to your organization/user */ get: operations["listEngines"]; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v1/user/account": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Account details * @description Get information about the account associated with the provided API key */ get: operations["userAccount"]; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v1/user/balance": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Account balance * @description Get the credit balance of the account/organization associated with the API key */ get: operations["userBalance"]; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; } export type webhooks = Record<string, never>; export interface components { schemas: { /** * @description The `id` of a generation, typically used for async generations, that can be used to check the status of the generation or retrieve the result. * @example a6dc6c6e20acda010fe14d71f180658f2896ed9b4ec25aa99a6ff06c796987c4 */ GenerationID: string; ImageToVideoRequest: { /** * Format: binary * @description The source image used in the video generation process. * * Supported Formats: * - jpeg * - png * * Supported Dimensions: * - 1024x576 * - 576x1024 * - 768x768 * @example ./some/image.png */ image: string; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed: number; /** * @description How strongly the video sticks to the original image. Use lower values to allow the model more freedom to make changes and higher values to correct motion distortions. * @default 1.8 */ cfg_scale: number; /** * @description Lower values generally result in less motion in the output video, while higher values generally result in more motion. This parameter corresponds to the motion_bucket_id parameter from the [paper](https://static1.squarespace.com/static/6213c340453c3f502425776e/t/655ce779b9d47d342a93c890/1700587395994/stable_video_diffusion.pdf). * @default 127 */ motion_bucket_id: number; }; /** * @description Your request was flagged by our content moderation system. * @example { * "id": "ed14db44362126aab3cbd25cca51ffe3", * "name": "content_moderation", * "errors": [ * "Your request was flagged by our content moderation system, as a result your request was denied and you were not charged." * ] * } */ ContentModerationResponse: { /** * @description A unique identifier associated with this error. Please include this in any [support tickets](https://stabilityplatform.freshdesk.com/support/tickets/new) * you file, as it will greatly assist us in diagnosing the root cause of the problem. * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 */ id: string; /** * @description Our content moderation system has flagged some part of your request and subsequently denied it. You were not charged for this request. While this may at times be frustrating, it is necessary to maintain the integrity of our platform and ensure a safe experience for all users. * * If you would like to provide feedback, please use the [Support Form](https://stabilityplatform.freshdesk.com/support/tickets/new). * @enum {string} */ name: "content_moderation"; /** * @description One or more error messages indicating what went wrong. * @example [ * "some-field: is required" * ] */ errors: string[]; }; InpaintingSearchModeRequestBody: { /** * @description Controls how the model decides which areas to inpaint and which areas to leave alone. * * Specifying `mask` requires: * - Provide an explicit mask image in the `mask` parameter * - Use the alpha channel of the `image` parameter as the mask * * Specifying `search` requires: * - Provide a small description of what to inpaint in the `search_prompt` parameter (enum property replaced by openapi-typescript) * @enum {string} */ mode: "search"; /** * @description Short description of what to inpaint in the `image`. * @example glasses */ search_prompt: string; /** * Format: binary * @description The image you wish to inpaint. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * @example ./some/image.png */ image: string; /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format: "jpeg" | "png" | "webp"; }; InpaintingMaskingModeRequestBody: { /** * @description Controls how the model decides which areas to inpaint and which areas to leave alone. * * Specifying `mask` requires: * - Provide an explicit mask image in the `mask` parameter * - Use the alpha channel of the `image` parameter as the mask * * Specifying `search` requires: * - Provide a small description of what to inpaint in the `search_prompt` parameter (enum property replaced by openapi-typescript) * @enum {string} */ mode: "mask"; /** * Format: binary * @description Controls the strength of the inpainting process on a per-pixel basis, either via a * second image (passed into this parameter) or via the alpha channel of the `image` parameter. * * **Passing in a Mask** * * The image passed to this parameter should be a black and white image that represents, * at any pixel, the strength of inpainting based on how dark or light the given pixel is. * Completely black pixels represent no inpainting strength while completely white pixels * represent maximum strength. * * In the event the mask is a different size than the `image` parameter, it will be automatically resized. * * **Alpha Channel Support** * * If you don't provide an explicit mask, one will be derived from the alpha channel of the `image` parameter. * Transparent pixels will be inpainted while opaque pixels will be preserved. * * In the event an `image` with an alpha channel is provided along with a `mask`, the `mask` will take precedence. * @example ./some/image.png */ mask?: string; /** * Format: binary * @description The image you wish to inpaint. * * Supported Formats: * - jpeg * - png * - webp * * Validation Rules: * - Every side must be at least 64 pixels * - Total pixel count must be between 4,096 and 9,437,184 pixels * @example ./some/image.png */ image: string; /** @description What you wish to see in the output image. A strong, descriptive prompt that clearly defines * elements, colors, and subjects will lead to better results. * * To control the weight of a given word use the format `(word:weight)`, * where `word` is the word you'd like to control the weight of and `weight` * is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)` * would convey a sky that was blue and green, but more green than blue. */ prompt: string; /** @description A blurb of text describing what you **do not** wish to see in the output image. * This is an advanced feature. */ negative_prompt?: string; /** * @description A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.) * @default 0 */ seed: number; /** * @description Dictates the `content-type` of the generated image. * @default png * @enum {string} */ output_format: "jpeg" | "png" | "webp"; }; /** * @description The name of your application, used to help us communicate app-specific debugging or moderation issues to you. * @example my-awesome-app */ StabilityClientID: string; /** * @description A unique identifier for your end user. Used to help us communicate user-specific debugging or moderation issues to you. Feel free to obfuscate this value to protect user privacy. * @example DiscordUser#9999 */ StabilityClientUserID: string; /** * @description The version of your application, used to help us communicate version-specific debugging or moderation issues to you. * @example 1.2.1 */ StabilityClientVersion: string; /** * @description Controls the likelihood of creating additional details not heavily conditioned by the init image. * @default 0.35 */ Creativity: number; Engine: { description: string; /** * @description Unique identifier for the engine * @example stable-diffusion-v1-6 */ id: string; /** * @description Name of the engine * @example Stable Diffusion XL v1.0 */ name: string; /** * @description The type of content this engine produces * @example PICTURE * @enum {string} */ type: | "AUDIO" | "CLASSIFICATION" | "PICTURE" | "STORAGE" | "TEXT" | "VIDEO"; }; Error: { /** * @description A unique identifier for this particular occurrence of the problem. * @example 296a972f-666a-44a1-a3df-c9c28a1f56c0 */ id: string; /** * @description The short-name of this class of errors e.g. `bad_request`. * @example bad_request */ name: string; /** * @description A human-readable explanation specific to this occurrence of the problem. * @example Header parameter Authorization is required, but not found */ message: string; }; /** * @description How strictly the diffusion process adheres to the prompt text (higher values keep your image closer to your prompt) * @default 7 * @example 7 */ CfgScale: number; /** * @default NONE * @example FAST_BLUE * @enum {string} */ ClipGuidancePreset: | "FAST_BLUE" | "FAST_GREEN" | "NONE" | "SIMPLE" | "SLOW" | "SLOWER" | "SLOWEST"; /** @description Desired height of the output image. Only one of `width` or `height` may be specified. */ UpscaleImageHeight: number; /** @description Desired width of the output image. Only one of `width` or `height` may be specified. */ UpscaleImageWidth: number; /** * @description Height of the image to generate, in pixels, in an increment divisible by 64. * @default 512 * @example 512 */ DiffuseImageHeight: number; /** * @description Width of the image to generate, in pixels, in an increment divisible by 64. * @default 512 * @example 512 */ DiffuseImageWidth: number; /** * @description Which sampler to use for the diffusion process. If this value is omitted we'll automatically select an appropriate sampler for you. * @example K_DPM_2_ANCESTRAL * @enum {string} */ Sampler: | "DDIM" | "DDPM" | "K_DPMPP_2M" | "K_DPMPP_2S_ANCESTRAL" | "K_DPM_2" | "K_DPM_2_ANCESTRAL" | "K_EULER" | "K_EULER_ANCESTRAL" | "K_HEUN" | "K_LMS"; /** * @description Number of images to generate * @default 1 * @example 1 */ Samples: number; /** * @description Random noise seed (omit this option or use `0` for a random seed) * @default 0 * @example 0 */ Seed: number; /** * @description Number of diffusion steps to run. * @default 30 * @example 50 */ Steps: number; /** @description Extra parameters passed to the engine. * These parameters are used for in-development or experimental features and may change * without warning, so please use with caution. */ Extras: Record<string, never>; /** * @description Pass in a style preset to guide the image model towards a particular style. * This list of style presets is subject to change. * @enum {string} */ StylePreset: | "enhance" | "anime" | "photographic" | "digital-art" | "comic-book" | "fantasy-art" | "line-art" | "analog-film" | "neon-punk" | "isometric" | "low-poly" | "origami" | "modeling-compound" | "cinematic" | "3d-model" | "pixel-art" | "tile-texture"; /** @description Text prompt for image generation */ TextPrompt: { /** * @description The prompt itself * @example A lighthouse on a cliff */ text: string; /** * Format: float * @description Weight of the prompt (use negative numbers for negative prompts) * @example 0.8167237 */ weight?: number; }; /** * TextPrompts * @description An array of text prompts to use for generation. * * Given a text prompt with the text `A lighthouse on a cliff` and a weight of `0.5`, it would be represented as: * * ``` * "text_prompts": [ * { * "text": "A lighthouse on a cliff", * "weight": 0.5 * } * ] * ``` */ TextPromptsForTextToImage: components["schemas"]["TextPrompt"][]; /** @description An array of text prompts to use for generation. * * Due to how arrays are represented in `multipart/form-data` requests, prompts must adhere to the format `text_prompts[index][text|weight]`, * where `index` is some integer used to tie the text and weight together. While `index` does not have to be sequential, duplicate entries * will override previous entries, so it is recommended to use sequential indices. * * Given a text prompt with the text `A lighthouse on a cliff` and a weight of `0.5`, it would be represented as: * ``` * text_prompts[0][text]: "A lighthouse on a cliff" * text_prompts[0][weight]: 0.5 * ``` * * To add another prompt to that request simply provide the values under a new `index`: * * ``` * text_prompts[0][text]: "A lighthouse on a cliff" * text_prompts[0][weight]: 0.5 * text_prompts[1][text]: "land, ground, dirt, grass" * text_prompts[1][weight]: -0.9 * ``` */ TextPrompts: components["schemas"]["TextPrompt"][]; /** * Format: binary * @description The image to upscale using ESRGAN. * @example <image binary> */ InputImage: string; /** * Format: binary * @description Image used to initialize the diffusion process, in lieu of random noise. * @example <image binary> */ InitImage: string; /** * Format: float * @description How much influence the `init_image` has on the diffusion process. Values close to `1` will yield images very similar to the `init_image` while values close to `0` will yield images wildly different than the `init_image`. The behavior of this is meant to mirror DreamStudio's "Image Strength" slider. <br/> <br/> This parameter is just an alternate way to set `step_schedule_start`, which is done via the calculation `1 - image_strength`. For example, passing in an Image Strength of 35% (`0.35`) would result in a `step_schedule_start` of `0.65`. * * @default 0.35 * @example 0.4 */ InitImageStrength: number; /** * @description Whether to use `image_strength` or `step_schedule_*` to control how much influence the `init_image` has on the result. * @default IMAGE_STRENGTH * @enum {string} */ InitImageMode: "IMAGE_STRENGTH" | "STEP_SCHEDULE"; /** * @description Skips a proportion of the start of the diffusion steps, allowing the init_image to influence the final generated image. Lower values will result in more influence from the init_image, while higher values will result in more influence from the diffusion steps. (e.g. a value of `0` would simply return you the init_image, where a value of `1` would return you a completely different image.) * @default 0.65 * @example 0.4 */ StepScheduleStart: number; /** * @description Skips a proportion of the end of the diffusion steps, allowing the init_image to influence the final generated image. Lower values will result in more influence from the init_image, while higher values will result in more influence from the diffusion steps. * @example 0.01 */ StepScheduleEnd: number; /** * Format: binary * @description Optional grayscale mask that allows for influence over which pixels are eligible for diffusion and at what strength. Must be the same dimensions as the `init_image`. Use the `mask_source` option to specify whether the white or black pixels should be inpainted. * @example <image binary> */ MaskImage: string; /** @description For any given pixel, the mask determines the strength of generation on a linear scale. This parameter determines where to source the mask from: * - `MASK_IMAGE_WHITE` will use the white pixels of the mask_image as the mask, where white pixels are completely replaced and black pixels are unchanged * - `MASK_IMAGE_BLACK` will use the black pixels of the mask_image as the mask, where black pixels are completely replaced and white pixels are unchanged * - `INIT_IMAGE_ALPHA` will use the alpha channel of the init_image as the mask, where fully transparent pixels are completely replaced and fully opaque pixels are unchanged */ MaskSource: string; /** @description Represents the optional parameters that can be passed to any generation request. */ GenerationRequestOptionalParams: { cfg_scale?: components["schemas"]["CfgScale"]; clip_guidance_preset?: components["schemas"]["ClipGuidancePreset"]; sampler?: components["schemas"]["Sampler"]; samples?: components["schemas"]["Samples"]; seed?: components["schemas"]["Seed"]; steps?: components["schemas"]["Steps"]; style_preset?: components["schemas"]["StylePreset"]; extras?: components["schemas"]["Extras"]; }; RealESRGANUpscaleRequestBody: { image: components["schemas"]["InputImage"]; width?: components["schemas"]["UpscaleImageWidth"]; height?: components["schemas"]["UpscaleImageHeight"]; }; ImageToImageRequestBody: { text_prompts: components["schemas"]["TextPrompts"]; init_image: components["schemas"]["InitImage"]; init_image_mode?: components["schemas"]["InitImageMode"]; image_strength?: components["schemas"]["InitImageStrength"]; step_schedule_start?: components["schemas"]["StepScheduleStart"]; step_schedule_end?: components["schemas"]["StepScheduleEnd"]; cfg_scale?: components["schemas"]["CfgScale"]; clip_guidance_preset?: components["schemas"]["ClipGuidancePreset"]; sampler?: components["schemas"]["Sampler"]; samples?: components["schemas"]["Samples"]; seed?: components["schemas"]["Seed"]; steps?: components["schemas"]["Steps"]; style_preset?: components["schemas"]["StylePreset"]; extras?: components["schemas"]["Extras"]; }; ImageToImageUsingImageStrengthRequestBody: { text_prompts: components["schemas"]["TextPrompts"]; init_image: components["schemas"]["InitImage"]; init_image_mode?: components["schemas"]["InitImageMode"]; image_strength?: components["schemas"]["InitImageStrength"]; } & components["schemas"]["GenerationRequestOptionalParams"]; ImageToImageUsingStepScheduleRequestBody: { text_prompts: components["schemas"]["TextPrompts"]; init_image: components["schemas"]["InitImage"]; init_image_mode?: components["schemas"]["InitImageMode"]; step_schedule_start?: components["schemas"]["StepScheduleStart"]; step_schedule_end?: components["schemas"]["StepScheduleEnd"]; } & components["schemas"]["GenerationRequestOptionalParams"]; MaskingRequestBody: { init_image: components["schemas"]["InitImage"]; mask_source: components["schemas"]["MaskSource"]; mask_image?: components["schemas"]["MaskImage"]; text_prompts: components["schemas"]["TextPrompts"]; cfg_scale?: components["schemas"]["CfgScale"]; clip_guidance_preset?: components["schemas"]["ClipGuidancePreset"]; sampler?: components["schemas"]["Sampler"]; samples?: components["schemas"]["Samples"]; seed?: components["schemas"]["Seed"]; steps?: components["schemas"]["Steps"]; style_preset?: components["schemas"]["StylePreset"]; extras?: components["schemas"]["Extras"]; }; MaskingUsingMaskImageRequestBody: { text_prompts: components["schemas"]["TextPrompts"]; init_image: components["schemas"]["InitImage"]; mask_source: components["schemas"]["MaskSource"]; mask_image: components["schemas"]["MaskImage"]; } & components["schemas"]["GenerationRequestOptionalParams"]; MaskingUsingInitImageAlphaRequestBody: { text_prompts: components["schemas"]["TextPrompts"]; init_image: components["schemas"]["InitImage"]; mask_source: components["schemas"]["MaskSource"]; } & components["schemas"]["GenerationRequestOptionalParams"]; /** @example { * "cfg_scale": 7, * "height": 512, * "width": 512, * "sampler": "K_DPM_2_ANCESTRAL", * "samples": 1, * "seed": 0, * "steps": 30, * "text_prompts": [ * { * "text": "A lighthouse on a cliff", * "weight": 1 * } * ] * } */ TextToImageRequestBody: { height?: components["schemas"]["DiffuseImageHeight"]; width?: components["schemas"]["DiffuseImageWidth"]; text_prompts: components["schemas"]["TextPromptsForTextToImage"]; } & components["schemas"]["GenerationRequestOptionalParams"]; AccountResponseBody: { /** * Format: email * @description The user's email * @example example@stability.ai */ email: string; /** * @description The user's ID * @example user-1234 */ id: string; /** * @description The user's organizations * @example [ * { * "id": "org-5678", * "name": "Another Organization", * "role": "MEMBER", * "is_default": true * }, * { * "id": "org-1234", * "name": "My Organization", * "role": "MEMBER", * "is_default": false * } * ] */ organizations: components["schemas"]["OrganizationMembership"][]; /** * Format: uri * @description The user's profile picture * @example https://api.stability.ai/example.png */ profile_picture?: string; }; /** @example { * "credits": 0.07903292496944721 * } */ BalanceResponseBody: { /** * Format: double * @description The balance of the account/organization associated with the API key * @example 0.41122252265928866 */ credits: number; }; /** * @description The engines available to your user/organization * @example [ * { * "description": "Stability-AI Stable Diffusion v1.6", * "id": "stable-diffusion-v1-6", * "name": "Stable Diffusion v1.6", * "type": "PICTURE" * }, * { * "description": "Stability-AI Stable Diffusion XL v1.0", * "id": "stable-diffusion-xl-1024-v1-0", * "name": "Stable Diffusion XL v1.0", * "type": "PICTURE" * } * ] */ ListEnginesResponseBody: components["schemas"]["Engine"][]; /** * @description The result of the generation process. * - `SUCCESS` indicates success * - `ERROR` indicates an error * - `CONTENT_FILTERED` indicates the result affected by the content filter and may be blurred. * * This header is only present when the `Accept` is set to `image/png`. Otherwise it is returned in the response body. * @enum {string} */ FinishReason: "SUCCESS" | "ERROR" | "CONTENT_FILTERED"; /** @example [ * { * "base64": "...very long string...", * "finishReason": "SUCCESS", * "seed": 1050625087 * }, * { * "base64": "...very long string...", * "finishReason": "CONTENT_FILTERED", * "seed": 1229191277 * } * ] */ Image: { /** @description Image encoded in base64 */ base64?: string; /** * @example CONTENT_FILTERED * @enum {string} */ finishReason?: "SUCCESS" | "ERROR" | "CONTENT_FILTERED"; /** * @description The seed associated with this image * @example 1229191277 */ seed?: number; }; OrganizationMembership: { /** @example org-123456 */ id: string; /** @example false */ is_default: boolean; /** @example My Organization */ name: string; /** @example MEMBER */ role: string; }; }; responses: { /** @description unauthorized: API key missing or invalid */ 401: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Error"]; }; }; /** @description permission_denied: You lack the necessary permissions to perform this action */ 403: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Error"]; }; }; /** @description not_found: The requested resource/engine was not found */ 404: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Error"]; }; }; /** @description server_error: Some unexpected server error occurred */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Error"]; }; }; /** @description Generation successful. */ GenerationResponse: { headers: { "Content-Length": components["headers"]["Content-Length"]; "Content-Type": components["headers"]["Content-Type"]; "Finish-Reason": components["headers"]["Finish-Reason"]; Seed: components["headers"]["Seed"]; [name: string]: unknown; }; content: { "application/json": { artifacts?: components["schemas"]["Image"][]; }; "image/png": string; }; }; /** @description bad_request: one or more parameters were invalid. */ "400FromGeneration": { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Error"]; }; }; /** @description One or more parameters were invalid. */ "400FromUpscale": { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Error"]; }; }; }; parameters: { upscaleEngineID: string; engineID: string; /** * @description Allows for requests to be scoped to an organization other than the user's default. If not provided, the user's default organization will be used. * @example org-123456 */ organization: string; /** * @description Used to identify the source of requests, such as the client application or sub-organization. Optional, but recommended for organizational clarity. * @example my-great-plugin */ stabilityClientID: string; /** * @description Used to identify the version of the application or service making the requests. Optional, but recommended for organizational clarity. * @example 1.2.1 */ stabilityClientVersion: string; /** @description The format of the response. Leave blank for JSON, or set to 'image/png' for a PNG image. */ accept: "application/json" | "image/png"; }; requestBodies: never; headers: { "Content-Length": number; "Content-Type": "application/json" | "image/png"; "Finish-Reason": components["schemas"]["FinishReason"]; /** * @description The seed used to generate the image. This header is only present when the `Accept` is set to `image/png`. Otherwise it is returned in the response body. * @example 3817857576 */ Seed: number; }; pathItems: never; } export type $defs = Record<string, never>; export interface operations { textToImage: { parameters: { query?: never; header?: { /** @description The format of the response. Leave blank for JSON, or set to 'image/png' for a PNG image. */ Accept?: components["parameters"]["accept"]; /** * @description Allows for requests to be scoped to an organization other than the user's default. If not provided, the user's default organization will be used. * @example org-123456 */ Organization?: components["parameters"]["organization"]; /** * @description Used to identify the source of requests, such as the client application or sub-organization. Optional, but recommended for organizational clarity. * @example my-great-plugin */ "Stability-Client-ID"?: components["parameters"]["stabilityClientID"]; /** * @description Used to identify the version of the application or service making the requests. Optional, but recommended for organizational clarity. * @example 1.2.1 */ "Stability-Client-Version"?: components["parameters"]["stabilityClientVersion"]; }; path: { engine_id: components["parameters"]["engineID"]; }; cookie?: never; }; requestBody: { content: { /** @example { * "cfg_scale": 7, * "height": 512, * "width": 512, * "sampler": "K_DPM_2_ANCESTRAL", * "samples": 1, * "steps": 30, * "text_prompts": [ * { * "text": "A lighthouse on a cliff", * "weight": 1 * } * ] * } */ "application/json": components["schemas"]["TextToImageRequestBody"]; }; }; responses: { 200: components["responses"]["GenerationResponse"]; 400: components["responses"]["400FromGeneration"]; 401: components["responses"]["401"]; 403: components["responses"]["403"]; 404: components["responses"]["404"]; 500: components["responses"]["500"]; }; }; imageToImage: { parameters: { query?: never; header?: { /** @description The format of the response. Leave blank for JSON, or set to 'image/png' for a PNG image. */ Accept?: components["parameters"]["accept"]; /** * @description Allows for requests to be scoped to an organization other than the user's default. If not provided, the user's default organization will be used. * @example org-123456 */ Organization?: components["parameters"]["organization"]; /** * @description Used to identify the source of requests, such as the client application or sub-organization. Optional, but recommended for organizational clarity. * @example my-great-plugin */ "Stability-Client-ID"?: components["parameters"]["stabilityClientID"]; /** * @description Used to identify the version of the application or service making the requests. Optional, but recommended for organizational clarity. * @example 1.2.1 */ "Stability-Client-Version"?: components["parameters"]["stabilityClientVersion"]; }; path: { engine_id: components["parameters"]["engineID"]; }; cookie?: never; }; requestBody: { content: { "multipart/form-data": components["schemas"]["ImageToImageRequestBody"]; }; }; responses: { 200: components["responses"]["GenerationResponse"]; 400: components["responses"]["400FromGeneration"]; 401: components["responses"]["401"]; 403: components["responses"]["403"]; 404: components["responses"]["404"]; 500: components["responses"]["500"]; }; }; masking: { parameters: { query?: never; header?: { /** @description The format of the response. Leave blank for JSON, or set to 'image/png' for a PNG image. */ Accept?: components["parameters"]["accept"]; /** * @description Allows for requests to be scoped to an organization other than the user's default. If not provided, the user's default organization will be used. * @example org-123456 */ Organization?: components["parameters"]["organization"]; /** * @description Used to identify the source of requests, such as the client application or sub-organization. Optional, but recommended for organizational clarity. * @example my-great-plugin */ "Stability-Client-ID"?: components["parameters"]["stabilityClientID"]; /** * @description Used to identify the version of the application or service making the requests. Optional, but recommended for organizational clarity. * @example 1.2.1 */ "Stability-Client-Version"?: components["parameters"]["stabilityClientVersion"]; }; path: { /** @example stable-diffusion-xl-1024-v1-0 */ engine_id: string; }; cookie?: never; }; requestBody: { content: { "multipart/form-data": components["schemas"]["MaskingRequestBody"]; }; }; responses: { 200: components["responses"]["GenerationResponse"]; 400: components["responses"]["400FromGeneration"]; 401: components["responses"]["401"]; 403: components["responses"]["403"]; 404: components["responses"]["404"]; 500: components["responses"]["500"]; }; }; listEngines: { parameters: { query?: never; header?: { /** * @description Allows for requests to be scoped to an organization other than the user's default. If not provided, the user's default organization will be used. * @example org-123456 */ Organization?: components["parameters"]["organization"]; /** * @description Used to identify the source of requests, such as the client application or sub-organization. Optional, but recommended for organizational clarity. * @example my-great-plugin */ "Stability-Client-ID"?: components["parameters"]["stabilityClientID"]; /** * @description Used to identify the version of the application or service making the requests. Optional, but recommended for organizational clarity. * @example 1.2.1 */ "Stability-Client-Version"?: components["parameters"]["stabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: never; responses: { /** @description OK response. */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ListEnginesResponseBody"]; }; }; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; userAccount: { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; requestBody?: never; responses: { /** @description OK response. */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["AccountResponseBody"]; }; }; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; userBalance: { parameters: { query?: never; header?: { /** * @description Allows for requests to be scoped to an organization other than the user's default. If not provided, the user's default organization will be used. * @example org-123456 */ Organization?: components["parameters"]["organization"]; /** * @description Used to identify the source of requests, such as the client application or sub-organization. Optional, but recommended for organizational clarity. * @example my-great-plugin */ "Stability-Client-ID"?: components["parameters"]["stabilityClientID"]; /** * @description Used to identify the version of the application or service making the requests. Optional, but recommended for organizational clarity. * @example 1.2.1 */ "Stability-Client-Version"?: components["parameters"]["stabilityClientVersion"]; }; path?: never; cookie?: never; }; requestBody?: never; responses: { /** @description OK response. */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["BalanceResponseBody"]; }; }; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; }