Router.Images.Generations
Create a Generation
Create an Imagefrom orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.router.images.generations.create(prompt="<value>", model="2", n=1, retry={
"on_codes": [
429,
500,
502,
503,
504,
],
}, cache={
"ttl": 3600,
"type": "exact_match",
}, load_balancer={
"type": "weight_based",
"models": [],
}, timeout={
"call_timeout": 30000,
}, orq={
"retry": {
"on_codes": [
429,
500,
502,
503,
504,
],
},
"fallbacks": [
{
"model": "openai/gpt-4o-mini",
},
],
"identity": {
"id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"display_name": "Jane Doe",
"email": "jane.doe@example.com",
"metadata": [
{
"department": "Engineering",
"role": "Senior Developer",
},
],
"logo_url": "https://example.com/avatars/jane-doe.jpg",
"tags": [
"hr",
"engineering",
],
},
"cache": {
"ttl": 3600,
"type": "exact_match",
},
"load_balancer": {
"type": "weight_based",
"models": [
{
"model": "openai/gpt-4o",
"weight": 0.7,
},
{
"model": "anthropic/claude-3-5-sonnet",
"weight": 0.3,
},
],
},
"timeout": {
"call_timeout": 30000,
},
})
# Handle response
print(res)
Show Parameters
Show Parameters
A text description of the desired image(s).
Allows to set transparency for the background of the generated image(s). This parameter is only supported for
openai/gpt-image-1.The model to use for image generation. One of
openai/dall-e-2, openai/dall-e-3, or openai/gpt-image-1.Control the content-moderation level for images generated by
gpt-image-1. Must be either low or auto.The number of images to generate. Must be between 1 and 10. For
dall-e-3, only n=1 is supported.The compression level (0-100%) for the generated images. This parameter is only supported for
gpt-image-1 with the webp or jpeg output formats.The format in which the generated images are returned. This parameter is only supported for
openai/gpt-image-1.The quality of the image that will be generated.
auto will automatically select the best quality for the given model.The format in which generated images are returned. Must be one of
url or b64_json. This parameter isn’t supported for gpt-image-1 which will always return base64-encoded images.The size of the generated images. Must be one of the specified sizes for each model.
The style of the generated images. This parameter is only supported for
openai/dall-e-3. Must be one of vivid or natural.Optional metadata for the request. This metadata will be stored in the trace and can be used for filtering.
The name to display on the trace. If not specified, the default system name will be used.
Array of fallback models to use if primary model fails
Retry configuration for the request
Show Properties of retry
Show Properties of retry
Number of retry attempts (1-5)
Cache configuration for the request.
Show Properties of cache
Show Properties of cache
Time to live for cached responses in seconds. Maximum 259200 seconds (3 days).
Load balancer configuration for the request.
Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured.
Show Response
Show Response
The Unix timestamp (in seconds) of when the image was created.