Router.Images.Variations
Create a Variation
Create an Image Variationfrom orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.router.images.variations.create(model="Altima", n=1, response_format="url", size="1024x1024", 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",
},
],
"prompt": {
"id": "prompt_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"version": "latest",
},
"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
{
"model": str, # required
"image": Optional[Any],
"n": OptionalNullable[float],
"response_format": Optional[Literal["url", "b64_json"]],
"size": Optional[Literal["256x256", "512x512", "1024x1024"]],
"user": Optional[str],
"name": Optional[str],
"fallbacks": { # optional
"model": str, # required
},
"retry": { # optional
"count": Optional[float],
"on_codes": List[float],
},
"cache": { # optional
"ttl": Optional[float],
"type": Literal["exact_match"], # required
},
"load_balancer": Union[CreateImageVariationLoadBalancer1],
"timeout": { # optional
"call_timeout": float, # required
},
"orq": { # optional
"name": Optional[str],
"retry": { # optional
"count": Optional[float],
"on_codes": List[float],
},
"fallbacks": { # optional
"model": str, # required
},
"prompt": { # optional
"id": str, # required
"version": Literal["latest"], # required
},
"identity": { # optional
"id": str, # required
"display_name": Optional[str],
"email": Optional[str],
"metadata": List[Dict[str, Any]],
"logo_url": Optional[str],
"tags": List[str],
},
"~~`contact`~~": { # optional
"id": str, # required
"display_name": Optional[str],
"email": Optional[str],
"metadata": List[Dict[str, Any]],
"logo_url": Optional[str],
"tags": List[str],
},
"cache": { # optional
"ttl": Optional[float],
"type": Literal["exact_match"], # required
},
"load_balancer": Union[CreateImageVariationLoadBalancerRouterImagesVariations1],
"timeout": { # optional
"call_timeout": float, # required
},
},
}
Show Response
Show Response
{
"created": float,
"output_format": Optional[str],
"size": Optional[str],
"quality": Optional[str],
"data": {
"b64_json": Optional[str],
"url": Optional[str],
},
"usage": { # optional
"total_tokens": float,
"input_tokens": float,
"output_tokens": float,
"input_tokens_details": {
"text_tokens": float,
"image_tokens": float,
},
},
}