from vlmrun.client import VLMRun# Initialize the VLMRun clientclient = VLMRun(api_key="<VLMRUN_API_KEY>")# Generate the imageresponse = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": "Generate an image of a modern building as a cyberpunk-style futuristic structure with neon lights and holographic elements" } ])print(response.choices[0].message.content)# >>> {"url": "https://.../image.jpg"}
from vlmrun.client import VLMRunfrom pydantic import BaseModel, Field# Define the response schemaclass ImageGenerationResponse(BaseModel): url: str = Field(..., description="The URL of the generated image")# Initialize the VLMRun clientclient = VLMRun(api_key="<VLMRUN_API_KEY>")# Generate the image with structured outputresponse = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": "Generate an image of a modern building as a cyberpunk-style futuristic structure with neon lights and holographic elements" } ], response_format={"type": "json_schema", "schema": ImageGenerationResponse.model_json_schema()})# Validate the responseresult = ImageGenerationResponse.model_validate_json(response.choices[0].message.content)# >>> ImageGenerationResponse(url="https://.../image.jpg")
import { VlmRun } from "vlmrun";const client = new VlmRun({ apiKey: "<VLMRUN_API_KEY>", baseURL: "https://api.vlm.run/v1"});const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: "Generate an image of a modern building as a cyberpunk-style futuristic structure with neon lights and holographic elements" } ]});console.log(response.choices[0].message.content);
import { VlmRun } from "vlmrun";import { z } from "zod";import { zodToJsonSchema } from "zod-to-json-schema";// Define the response schema with Zodconst ImageGenerationResponseSchema = z.object({ url: z.string().describe("The URL of the generated image")});// Initialize the VLMRun clientconst client = new VlmRun({ apiKey: "<VLMRUN_API_KEY>", baseURL: "https://api.vlm.run/v1"});// Generate the image with structured outputconst response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: "Generate an image of a modern building as a cyberpunk-style futuristic structure with neon lights and holographic elements" } ], response_format: { type: "json_schema", schema: zodToJsonSchema(ImageGenerationResponseSchema) }});const result = ImageGenerationResponseSchema.parse(JSON.parse(response.choices[0].message.content));
from vlmrun.client import VLMRun# Initialize the VLMRun clientclient = VLMRun(api_key="<VLMRUN_API_KEY>")# Generate the imageresponse = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Transform the image of my dog on the right into a flying dog with superman cape, with majestic background"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/dog-cat.jpg", "detail": "auto"}} ] } ])print(response.choices[0].message.content)# >>> {"url": "https://.../image.jpg"}
from vlmrun.client import VLMRunfrom pydantic import BaseModel, Field# Define the response schemaclass ImageGenerationResponse(BaseModel): url: str = Field(..., description="The URL of the generated image")# Initialize the VLMRun clientclient = VLMRun(api_key="<VLMRUN_API_KEY>")# Transform the image with structured outputresponse = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Transform the image of my dog on the right into a flying dog with superman cape, with majestic background"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/dog-cat.jpg", "detail": "auto"}} ] } ], response_format={"type": "json_schema", "schema": ImageGenerationResponse.model_json_schema()})# Validate the responseresult = ImageGenerationResponse.model_validate_json(response.choices[0].message.content)
import { VlmRun } from "vlmrun";const client = new VlmRun({ apiKey: "<VLMRUN_API_KEY>", baseURL: "https://api.vlm.run/v1"});const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Transform the image of my dog on the right into a flying dog with superman cape, with majestic background" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/dog-cat.jpg", detail: "auto" } } ] } ]});console.log(response.choices[0].message.content);
import { VlmRun } from "vlmrun";import { z } from "zod";import { zodToJsonSchema } from "zod-to-json-schema";// Define the response schema with Zodconst ImageGenerationResponseSchema = z.object({ url: z.string().describe("The URL of the generated image")});// Initialize the VLMRun clientconst client = new VlmRun({ apiKey: "<VLMRUN_API_KEY>", baseURL: "https://api.vlm.run/v1"});// Transform the image with structured outputconst response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Transform the image of my dog on the right into a flying dog with superman cape, with majestic background" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/dog-cat.jpg", detail: "auto" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(ImageGenerationResponseSchema) }});const result = ImageGenerationResponseSchema.parse(JSON.parse(response.choices[0].message.content));
Fill a missing area, remove an object, or add an element.
Inpainting result.
Reference Dog Image
Reference Car Image
Image inputs.
from vlmrun.client import VLMRun# Initialize the VLMRun clientclient = VLMRun(api_key="<VLMRUN_API_KEY>")# Generate the imageresponse = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Given two images: the first with a dog in front holding a yellow ball, inpaint her driving the car shown in the second image."}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/dogs.jpg", "detail": "auto"}}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg", "detail": "auto"}} ] } ])print(response.choices[0].message.content)# >>> {"url": "https://.../image.jpg"}
from vlmrun.client import VLMRunfrom pydantic import BaseModel, Field# Define the response schemaclass ImageGenerationResponse(BaseModel): url: str = Field(..., description="The URL of the generated image")# Initialize the VLMRun clientclient = VLMRun(api_key="<VLMRUN_API_KEY>")# Inpaint the image with structured outputresponse = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Given two images: the first with a dog in front holding a yellow ball, inpaint her driving the car shown in the second image."}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/dogs.jpg", "detail": "auto"}}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg", "detail": "auto"}} ] } ], response_format={"type": "json_schema", "schema": ImageGenerationResponse.model_json_schema()})# Validate the responseresult = ImageGenerationResponse.model_validate_json(response.choices[0].message.content)
import { VlmRun } from "vlmrun";const client = new VlmRun({ apiKey: "<VLMRUN_API_KEY>", baseURL: "https://api.vlm.run/v1"});const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Given two images: the first with a dog in front holding a yellow ball, inpaint her driving the car shown in the second image." }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/dogs.jpg", detail: "auto" } }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg", detail: "auto" } } ] } ]});console.log(response.choices[0].message.content);
import { VlmRun } from "vlmrun";import { z } from "zod";import { zodToJsonSchema } from "zod-to-json-schema";// Define the response schema with Zodconst ImageGenerationResponseSchema = z.object({ url: z.string().describe("The URL of the generated image")});// Initialize the VLMRun clientconst client = new VlmRun({ apiKey: "<VLMRUN_API_KEY>", baseURL: "https://api.vlm.run/v1"});// Inpaint the image with structured outputconst response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Given two images: the first with a dog in front holding a yellow ball, inpaint her driving the car shown in the second image." }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/dogs.jpg", detail: "auto" } }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg", detail: "auto" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(ImageGenerationResponseSchema) }});const result = ImageGenerationResponseSchema.parse(JSON.parse(response.choices[0].message.content));
Pass a style image and a content image. The content stays.
Style transfer result.
Reference Van Gogh Image
Reference City Image
Image inputs.
from vlmrun.client import VLMRun# Initialize the VLMRun clientclient = VLMRun(api_key="<VLMRUN_API_KEY>")# Generate the imageresponse = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Given two images: the first with a Van Gogh painting, and the second with a city skyline at night, apply the Van Gogh painting style to the city skyline."}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.generation/starry-night.jpg", "detail": "auto"}}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.generation/sf-golden-gate.jpg", "detail": "auto"}} ] } ])print(response.choices[0].message.content)# >>> {"url": "https://.../image.jpg"}
from vlmrun.client import VLMRunfrom pydantic import BaseModel, Field# Define the response schemaclass ImageGenerationResponse(BaseModel): url: str = Field(..., description="The URL of the generated image")# Initialize the VLMRun clientclient = VLMRun(api_key="<VLMRUN_API_KEY>")# Apply style transfer with structured outputresponse = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Given two images: the first with a Van Gogh painting, and the second with a city skyline at night, apply the Van Gogh painting style to the city skyline."}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.generation/starry-night.jpg", "detail": "auto"}}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.generation/sf-golden-gate.jpg", "detail": "auto"}} ] } ], response_format={"type": "json_schema", "schema": ImageGenerationResponse.model_json_schema()})# Validate the responseresult = ImageGenerationResponse.model_validate_json(response.choices[0].message.content)
import { VlmRun } from "vlmrun";const client = new VlmRun({ apiKey: "<VLMRUN_API_KEY>", baseURL: "https://api.vlm.run/v1"});const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Given two images: the first with a Van Gogh painting, and the second with a city skyline at night, apply the Van Gogh painting style to the city skyline." }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.generation/starry-night.jpg", detail: "auto" } }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.generation/sf-golden-gate.jpg", detail: "auto" } } ] } ]});console.log(response.choices[0].message.content);
import { VlmRun } from "vlmrun";import { z } from "zod";import { zodToJsonSchema } from "zod-to-json-schema";// Define the response schema with Zodconst ImageGenerationResponseSchema = z.object({ url: z.string().describe("The URL of the generated image")});// Initialize the VLMRun clientconst client = new VlmRun({ apiKey: "<VLMRUN_API_KEY>", baseURL: "https://api.vlm.run/v1"});// Apply style transfer with structured outputconst response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Given two images: the first with a Van Gogh painting, and the second with a city skyline at night, apply the Van Gogh painting style to the city skyline." }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.generation/starry-night.jpg", detail: "auto" } }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.generation/sf-golden-gate.jpg", detail: "auto" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(ImageGenerationResponseSchema) }});const result = ImageGenerationResponseSchema.parse(JSON.parse(response.choices[0].message.content));