ImageGenerationRequest - TypeScript SDK

ImageGenerationRequest type definition

The TypeScript SDK and docs are currently in beta. Report issues on GitHub.

Image generation request input

Example Usage

1import { ImageGenerationRequest } from "@openrouter/sdk/models";
2
3let value: ImageGenerationRequest = {
4 model: "bytedance-seed/seedream-4.5",
5 prompt: "a red panda astronaut floating in space, studio lighting",
6};

Fields

FieldTypeRequiredDescriptionExample
aspectRatiomodels.ImageGenerationRequestAspectRatioNormalized aspect ratio of the generated image. Providers clamp to their supported subset.16:9
backgroundmodels.ImageGenerationRequestBackgroundBackground treatment. transparent requires an output_format that supports alpha (png or webp).auto
inputReferencesmodels.ContentPartImage[]Reference images to guide image-to-image generation, as base64 data URLs or HTTP(S) URLs.
modelstring✔️The image generation model to usebytedance-seed/seedream-4.5
nnumberNumber of images to generate (1-10). Providers that only support single-image generation reject n > 1.1
outputCompressionnumberCompression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob.100
outputFormatmodels.ImageGenerationRequestOutputFormatEncoding of the returned image bytes.png
promptstring✔️Text description of the desired imagea red panda astronaut floating in space, studio lighting
providermodels.ImageGenerationRequestProviderProvider-specific passthrough configuration
qualitymodels.ImageGenerationRequestQualityRendering quality. Providers without a quality knob ignore this.high
resolutionmodels.ImageGenerationRequestResolutionNormalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider.2K
seednumberIf specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers.
sizestringOptional. A convenience shorthand for output dimensions — pass a tier (“2K”, “4K”) or explicit pixels (“2048x2048”) and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected.2K
streambooleanIf true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response.