@archastro/sdk
    Preparing search index...

    Class ImageResource

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Edit an image with a text prompt Applies a text-guided edit to one or more source images and returns the resulting image. Pass the source images as base64-encoded objects in the images array alongside a prompt describing the desired modification. The underlying provider is selected by the model parameter. Omit model to use the platform default. Size, quality, style, and format options are forwarded to the provider as-is; unsupported combinations for a given model return a 422 error with the provider's error message. This endpoint requires authentication. The request is billed against the workspace associated with the authenticated user.

      Parameters

      • input: {
            aspect_ratio?: string;
            background?: string;
            height?: number;
            image_size?: string;
            images: { image_data: string; image_type: string }[];
            model?: string;
            output_format?: string;
            prompt: string;
            quality?: string;
            size?: string;
            style?: string;
            width?: number;
        }

        Request body.

        • Optionalaspect_ratio?: string

          Desired aspect ratio of the output, e.g. "1:1" or "16:9". Not supported by all models; omit to use the model's default.

        • Optionalbackground?: string

          Background treatment for the output. Accepted values and behavior are model-dependent.

        • Optionalheight?: number

          Explicit output height in pixels. Takes precedence over size when both are provided. Not supported by all models.

        • Optionalimage_size?: string

          Output resolution tier for Gemini models, e.g. "1K", "2K", or "4K". Ignored by non-Gemini models.

        • images: { image_data: string; image_type: string }[]

          One or more source images to edit. Each image must be supplied as a base64-encoded object.

        • Optionalmodel?: string

          Model identifier to use for editing. Omit to use the platform default image model.

        • Optionaloutput_format?: string

          Desired MIME type or format for the returned image. Common values: "png", "jpeg", "webp". Defaults to the model's native format.

        • prompt: string

          Natural-language description of the edit to apply to the source image(s).

        • Optionalquality?: string

          Quality preset for the output image. Accepted values and behavior are model-dependent.

        • Optionalsize?: string

          Output dimensions as a WxH string, e.g. "1024x1024". Applies to OpenAI-compatible models. Omit to use the model's default.

        • Optionalstyle?: string

          Style preset applied to the edit. Accepted values and behavior are model-dependent.

        • Optionalwidth?: number

          Explicit output width in pixels. Takes precedence over size when both are provided. Not supported by all models.

      Returns Promise<AIImageResult>

      The resulting edited image, including base64 data or a URL depending on the model.

    • Generate an image from a text prompt Generates one or more images from a natural-language prompt using the specified AI image model. The response contains the first generated image; use n to request additional images (where supported by the model). The underlying provider is selected by the model parameter. Omit model to use the platform default. Size, quality, style, and format options are forwarded to the provider as-is; unsupported combinations for a given model return a 422 error with the provider's error message. This endpoint requires authentication. The request is billed against the workspace associated with the authenticated user.

      Parameters

      • input: {
            aspect_ratio?: string;
            background?: string;
            height?: number;
            image_size?: string;
            model?: string;
            n?: number;
            output_format?: string;
            prompt: string;
            quality?: string;
            size?: string;
            style?: string;
            width?: number;
        }

        Request body.

        • Optionalaspect_ratio?: string

          Desired aspect ratio of the output, e.g. "1:1" or "16:9". Not supported by all models; omit to use the model's default.

        • Optionalbackground?: string

          Background treatment for the output. Accepted values and behavior are model-dependent.

        • Optionalheight?: number

          Explicit output height in pixels. Takes precedence over size when both are provided. Not supported by all models.

        • Optionalimage_size?: string

          Output resolution tier for Gemini models, e.g. "1K", "2K", or "4K". Ignored by non-Gemini models.

        • Optionalmodel?: string

          Model identifier to use for generation. Omit to use the platform default image model.

        • Optionaln?: number

          Number of images to generate. Defaults to 1. Values greater than 1 are only supported by models that allow batch generation.

        • Optionaloutput_format?: string

          Desired MIME type or format for the returned image. Common values: "png", "jpeg", "webp". Defaults to the model's native format.

        • prompt: string

          Natural-language description of the image to generate.

        • Optionalquality?: string

          Quality preset for the output image. Accepted values and behavior are model-dependent.

        • Optionalsize?: string

          Output dimensions as a WxH string, e.g. "1024x1024". Applies to OpenAI-compatible models. Omit to use the model's default.

        • Optionalstyle?: string

          Style preset applied to the generated image. Accepted values and behavior are model-dependent.

        • Optionalwidth?: number

          Explicit output width in pixels. Takes precedence over size when both are provided. Not supported by all models.

      Returns Promise<AIImageResult>

      The generated image, including base64 data or a URL depending on the model.

    • List available image generation models Returns the list of image generation models available on the platform. Exactly one entry in the list carries default: true, indicating the model used when no model parameter is supplied to the generation or editing endpoints. This endpoint requires authentication and reflects the models enabled for the authenticated user's workspace.

      Returns Promise<
          {
              data: {
                  capabilities: "search"
                  | "image"
                  | "thinking"[];
                  default: boolean;
                  id: string;
                  input_media_formats: string[];
                  name: string;
                  output_media_formats: string[];
              }[];
          },
      >

      Successful response