# FAQ Source: https://docs.vlm.run/FAQ Frequently Asked Questions. We are working on a fine-tuning feature that will be available soon. [Reach out](mailto:support@vlm.run) to us if you have a specific use-case in mind. While our API is currently hosted in the cloud, we do offer private deployment options (on-premises or in-VPC deployments). Reach out to us at [support](mailto:support@vlm.run) to discuss your requirements. Yes, you can use the API for commercial purposes. We will soon offer a free tier for testing and development, and currently offer paid plans for production use. We currently do not support research use-cases just yet. That said, if you are interested in partnering with us to learn more about VLM-1 and improve our models, we would love to hear from you. # Multi-modal Artifacts Source: https://docs.vlm.run/agents/artifacts Retrieve generated images, videos, audio, and documents from agent responses Artifacts are binary objects generated during agent interactions, such as images, videos, audio files, and documents. When agents perform operations like image generation, face blurring, video trimming, or document processing, the results are stored as artifacts that can be retrieved using object references. ## Object References Agent responses return object references (refs) instead of raw binary data. Each reference is a string identifier that follows a specific format: a 3-5 letter type prefix followed by an underscore and a 6-digit hexadecimal string (e.g., `img_a1b2c3`). | Artifact Type | Prefix | Reference Type | Python Return Type | | -------------- | -------- | -------------- | ------------------------- | | Image | `img_` | `ImageRef` | `PIL.Image.Image` | | Video | `vid_` | `VideoRef` | `Path` (mp4) | | Audio | `aud_` | `AudioRef` | `Path` (mp3) | | Document | `doc_` | `DocumentRef` | `Path` (pdf) | | Reconstruction | `recon_` | `ReconRef` | `Path` (spz) | | URL | `url_` | `UrlRef` | `Path` (any of the above) | | Array | `arr_` | `ArrayRef` | `np.ndarray` | Import reference types from the SDK: ```python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.types import ImageRef, VideoRef, AudioRef, DocumentRef, ReconRef, UrlRef ``` ## Retrieving an Artifact ### In a Chat Completion To retrieve a chat completion artifact, use the `session_id` from the chat response and the `object_id` (returned as a Ref type) from the JSON result. ```python Python [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} from pathlib import Path from pydantic import BaseModel, Field from PIL import Image from vlmrun.client import VLMRun from vlmrun.types import ImageRef client = VLMRun(api_key="") # Define a response model with an ImageRef field class BlurredImageResponse(BaseModel): image: ImageRef = Field(..., description="The blurred image") # Make a chat completion request response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Blur all the faces in this image"}, {"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}} ] } ], response_format={ "type": "json_schema", "schema": BlurredImageResponse.model_json_schema() } ) # Parse the response result = BlurredImageResponse.model_validate_json(response.choices[0].message.content) # Retrieve the artifact using session_id and object_id blurred_image: Image.Image = client.artifacts.get( session_id=response.session_id, object_id=result.image.id ) # Display or save the image blurred_image.save("blurred_output.jpg") ``` ```typescript TypeScript [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} Coming soon... ``` ## Common Use Cases Generate multi-modal artifacts such as images and videos. Generate multiple images of a scene (e.g. virtual try-on, video thumbnails, etc.). Redact sensitive information from documents, and return the processed document as a PDF. Generate 3D models from images or videos, and return ply/spz files. ## Best Practices When working with artifacts, keep these guidelines in mind: * For large artifacts like videos, the Python and Node SDKs download files to disk rather than loading them into memory. This prevents memory issues when working with large files. Always check the file size before loading video content into memory. * Use structured response models with appropriate `Ref` types (`ImageRef`, `VideoRef`, etc.) to ensure type safety and enable IDE autocompletion. The Python and Node SDKs will automatically handle the conversion to the appropriate Python type when retrieving artifacts. View the complete API reference for artifact retrieval # Layout Detection Source: https://docs.vlm.run/agents/capabilities/document/layout-understanding Identify and analyze document structure with visual result previews showing highlighted extractions and field overlays
## Usage Example For best results, we recommend using the [Structured Outputs API](/agents/structured-responses) to get responses in a structured and validated data format. The following examples can detect headers, paragraphs, tables, lists, figures, and other document elements. The response schema includes bounding boxes, reading order and more. ```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Analyze document layout response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Analyze the document layout and identify all elements with bounding boxes"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/document.layout/qwen-25-vl-tech-report.jpg", "detail": "auto"}} ] } ] ) print(response.choices[0].message.content) ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class LayoutElement(BaseModel): type: str = Field(..., description="Type of layout element") xywh: tuple[float, float, float, float] = Field(..., description="Bounding box (x, y, w, h)") class LayoutResponse(BaseModel): elements: list[LayoutElement] = Field(..., description="List of layout elements") # Initialize the VLMRun client client = VLMRun(api_key="") # Analyze document layout with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Analyze the document layout and identify all elements with bounding boxes"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/document.layout/qwen-25-vl-tech-report.jpg", "detail": "auto"}} ] } ], response_format={"type": "json_schema", "schema": LayoutResponse.model_json_schema()}, ) # Validate the response result = LayoutResponse.model_validate_json(response.choices[0].message.content) # >>> LayoutResponse(elements=[LayoutElement(type="caption", xywh=(...)), ...]) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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: "Analyze the document layout and identify all elements with bounding boxes" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/document.layout/qwen-25-vl-tech-report.jpg", detail: "auto" } } ] } ] }); console.log(response.choices[0].message.content); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const LayoutResponseSchema = z.object({ elements: z.array(z.object({ type: z.string().describe("Type of layout element"), xywh: z.array(z.number()).describe("Bounding box (x, y, w, h)") })).describe("List of layout elements") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Analyze document layout with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Analyze the document layout and identify all elements with bounding boxes" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/document.layout/qwen-25-vl-tech-report.jpg", detail: "auto" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(LayoutResponseSchema) } }); const result = LayoutResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ## FAQ * **Headers**: H1-H6 level headers with hierarchical structure * **Paragraphs**: Body text blocks with proper text flow * **Titles**: Main title of the document * **Tables**: Structured data with row/column detection * **Figures**: Images, charts, diagrams, and visual elements * **Lists**: Bulleted and numbered list structures * **Captions**: Figure and table captions with associations * **Footnotes**: Footnotes with references and content * **Formulas**: Mathematical formulas and equations * **Pictures**: Images and visual elements * **Section Headers**: Section headers and titles The bounding boxes come in the format of `xywh`, where `x` and `y` are the top-left corner coordinates, and `w` and `h` are the width and height of the bounding box. All values are in pixels relative to the document image. The reading order indicates the sequence in which elements should be read, following the natural document flow from top to bottom and left to right. This is useful for accessibility and content extraction. Yes, the layout detection can process multi-page documents. Each page is analyzed separately, and the results include page-specific bounding boxes and reading orders. # Multi-Page Analysis Source: https://docs.vlm.run/agents/capabilities/document/multi-page-analysis Process and analyze documents across multiple pages with context preservation and cross-document correlation Process and analyze documents across multiple pages with context preservation and cross-document correlation. Perfect for medical record processing, legal document review, multi-document workflows, and comprehensive document analysis that requires understanding relationships between different document types. ## Usage Example For best results, we recommend using the [Structured Outputs API](/agents/structured-responses) to get responses in a structured and validated data format. The following examples can analyze and triage multiple pages or documents, identify cross-document relationships, extract consistent information across pages, and provide comprehensive analysis with context preservation. The response schema includes page summaries, cross-document connections, and thematic analysis. ```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Analyze multi-page medical documents response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Analyze this multi-page medical document set. Extract patient referral page, medical insurance card and identification form in 3 separate fields in JSON format."}, {"type": "file_url", "file_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/document.agent/multi-document-input-example.pdf", "detail": "auto"}} ] } ] ) print(response.choices[0].message.content) ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field from typing import Literal # Define the response schema class DocumentPage(BaseModel): page_id: int = Field(..., description="Page number (0-indexed)") document_type: Literal["referral", "insurance-card", "identification"] class MultiPageResponse(BaseModel): pages: list[DocumentPage] = Field(..., description="List of document pages") # Initialize the VLMRun client client = VLMRun(api_key="") # Analyze multi-page document with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Analyze this multi-page medical document set. Extract patient referral page, medical insurance card and identification form in 3 separate fields in JSON format."}, {"type": "file_url", "file_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/document.agent/multi-document-input-example.pdf", "detail": "auto"}} ] } ], response_format={"type": "json_schema", "schema": MultiPageResponse.model_json_schema()}, ) # Validate the response result = MultiPageResponse.model_validate_json(response.choices[0].message.content) # >>> MultiPageResponse(pages=[DocumentPage(page_id=0, document_type="referral"), ...]) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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: "Analyze this multi-page medical document set. Extract patient referral page, medical insurance card and identification form in 3 separate fields in JSON format." }, { type: "file_url", file_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/document.agent/multi-document-input-example.pdf", detail: "auto" } } ] } ] }); console.log(response.choices[0].message.content); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const MultiPageResponseSchema = z.object({ pages: z.array(z.object({ page_id: z.number().int().describe("Page number (0-indexed)"), document_type: z.enum(["referral", "insurance-card", "identification"]) })).describe("List of document pages") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Analyze multi-page document with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Analyze this multi-page medical document set. Extract patient referral page, medical insurance card and identification form in 3 separate fields in JSON format." }, { type: "file_url", file_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/document.agent/multi-document-input-example.pdf", detail: "auto" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(MultiPageResponseSchema) } }); const result = MultiPageResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ## FAQ * **Cross-Document Correlation**: Identify relationships between different document types * **Data Consistency Checking**: Verify data matches across pages and documents * **Theme Analysis**: Track recurring themes and topics across pages * **Reference Tracking**: Follow references and citations across pages * **Content Flow Analysis**: Understand how content flows between pages * **Medical Records**: Referral forms, insurance cards, ID forms, lab reports * **Legal Documents**: Contracts, amendments, exhibits, supporting documents * **Financial Documents**: Invoices, receipts, statements, tax forms * **Academic Papers**: Research papers, appendices, references, figures * **Business Reports**: Executive summaries, detailed sections, appendices The system identifies connections between different pages/documents by: * **Data Matching**: Finding identical or similar values across documents * **Reference Tracking**: Following explicit references between pages * **Contextual Analysis**: Understanding semantic relationships * **Confidence Scoring**: Providing reliability scores for each connection The confidence score is a value between 0 and 1 that indicates the reliability of cross-document connections. Higher scores indicate more reliable matches and relationships between pages. Yes, multi-page analysis can process different document types within a single PDF or across multiple uploaded documents, identifying relationships and correlations between them. # Visual Grounding Source: https://docs.vlm.run/agents/capabilities/document/visual-grounding Connect text elements with their visual locations in documents for precise content understanding Connect text elements with their visual locations in documents for precise content understanding. Perfect for interactive document analysis, content verification, automated form filling, and document comparison workflows.
Document Form
Document form grounding example
Driver's License
Example of a driver's license document with visual grounding
TV News Broadcast Text
TV news broadcast grounding example
## Usage Example For best results, we recommend using the [Structured Outputs API](/agents/structured-responses) to get responses in a structured and validated data format. The following examples can map text elements to their visual locations, detect spatial relationships, and identify cross-references in documents. The response schema includes bounding boxes, confidence scores, and relationship types. ```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Perform visual grounding response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Localize all the speaker names in the TV news broadcast text and visualize them on the image. Only provide one bounding box for each speaker name."}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/media.tv-news/finance_bb_3_speakers.jpg", "detail": "auto"}} ] } ] ) print(response.choices[0].message.content) # >>> {"elements": [{"content": "HAIDI STROUD-WATTS", "xywh": [0.428, 0.217, 0.128, 0.286]}, ...]} ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class GroundingWithText(BaseModel): content: str = Field(..., description="The text content") xywh: tuple[float, float, float, float] = Field(..., description="Bounding box (x, y, w, h)") class GroundingResponse(BaseModel): elements: list[GroundingWithText] = Field(..., description="Text to visual mappings") # Initialize the VLMRun client client = VLMRun(api_key="") # Perform visual grounding with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Localize all the speaker names in the TV news broadcast text and visualize them on the image. Only provide one bounding box for each speaker name."}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/media.tv-news/finance_bb_3_speakers.jpg", "detail": "auto"}} ] } ], response_format={"type": "json_schema", "schema": GroundingResponse.model_json_schema()}, ) # Validate the response result = GroundingResponse.model_validate_json(response.choices[0].message.content) # >>> GroundingResponse(elements=[GroundingWithText(content="...", xywh=(...)), ...]) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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: "Localize all the speaker names in the TV news broadcast text and visualize them on the image. Only provide one bounding box for each speaker name." }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/media.tv-news/finance_bb_3_speakers.jpg", detail: "auto" } } ] } ] }); console.log(response.choices[0].message.content); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const GroundingResponseSchema = z.object({ elements: z.array(z.object({ content: z.string().describe("The text content"), xywh: z.array(z.number()).describe("Bounding box (x, y, w, h)") })).describe("Text to visual mappings") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Perform visual grounding with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Localize all the speaker names in the TV news broadcast text and visualize them on the image. Only provide one bounding box for each speaker name." }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/media.tv-news/finance_bb_3_speakers.jpg", detail: "auto" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(GroundingResponseSchema) } }); const result = GroundingResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ## FAQ * **Form Fields**: Connect labels with input fields, checkboxes, and buttons * **Data Fields**: Map data labels with their corresponding values * **Interactive Elements**: Link text instructions with clickable elements * **Validation Rules**: Connect validation text with form fields * **Cross-References**: Map text mentions with figures, tables, and sections The bounding boxes come in the format of `xywh`, where `x` and `y` are the top-left corner coordinates, and `w` and `h` are the width and height of the bounding box. All values are in pixels relative to the document image. * **Label-Field Pairs**: Identify which labels belong to which fields * **Hierarchical Structure**: Understand parent-child relationships * **Proximity Analysis**: Determine related elements based on spatial proximity * **Alignment Patterns**: Detect aligned elements and groups The confidence score is a value between 0 and 1 that indicates the confidence of the text-visual mapping. Higher scores indicate more reliable connections. Yes, visual grounding can process multi-page documents. Each page is analyzed separately, and the results include page-specific mappings and relationships. # Caption & Tag Source: https://docs.vlm.run/agents/capabilities/image/captioning Generate detailed captions and tags for images using advanced vision models. Generate comprehensive, contextual captions for images using state-of-the-art vision-language models. Perfect for accessibility, content management, and automated image analysis workflows. Image captioning example showing detailed scene description ## Example Response This is an example of the response from the `Chat Completions API` example (using the image shown above): ```mdx Chat Completions wrap theme={"theme":{"light":"github-light","dark":"dark-plus"}} A classic, light turquoise Volkswagen Beetle with chrome accents is parked on a cobblestone street, set against a warm yellow stucco wall with rustic brown wooden doors and windows. Tags: car, volkswagen, beetle, street, cobblestone, wooden, doors, windows ``` ```json Structured Outputs wrap theme={"theme":{"light":"github-light","dark":"dark-plus"}} { "caption": "A classic, light turquoise Volkswagen Beetle with chrome accents is parked on a cobblestone street, set against a warm yellow stucco wall with rustic brown wooden doors and windows.", "tags": ["car", "volkswagen", "beetle", "street", "cobblestone", "wooden", "doors", "windows"] } ``` ## Usage Example For best results, we recommend using the [Structured Outputs API](/agents/structured-responses) to get responses in a structured and validated data format. ```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Caption the image response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ {"role": "user", "content": [ {"type": "text", "text": "Generate a detailed caption for this image"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg", "detail": "auto"}} ] } ], ) # Print the response print(response.choices[0].message.content) # >> "A classic, light turquoise Volkswagen Beetle..." ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class ImageCaption(BaseModel): caption: str = Field(..., description="Detailed caption of the scene") tags: list[str] = Field(..., description="Tags that describe the image") # Initialize the VLMRun client client = VLMRun(api_key="") # Caption the image with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ {"role": "user", "content": [ {"type": "text", "text": "Generate a detailed caption for this image"}, {"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": ImageCaption.model_json_schema()} ) # Validate the response result = ImageCaption.model_validate_json(response.choices[0].message.content) # >>> ImageCaption(caption="...", tags=[...]) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Caption the image const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Generate a detailed caption for this image" }, { 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); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const ImageCaptionSchema = z.object({ caption: z.string().describe("Detailed caption of the scene"), tags: z.array(z.string()).describe("Tags that describe the image") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Caption the image with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Generate a detailed caption for this image" }, { 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(ImageCaptionSchema) } }); const result = ImageCaptionSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ## FAQ You can ask simply ask for a more detailed caption by providing a more detailed prompt. In most cases, you can provide the number of words you want the caption to be, and the model will generate a more detailed caption. * **Common Objects**: person, car, truck, bus, bicycle, motorcycle * **Scenes**: street, building, park, forest, beach, etc. * **Time-of-Day**: morning, afternoon, evening, night * **Weather**: sunny, cloudy, rainy, snowing, etc. The tags come in the format of a list of strings. # Detection Source: https://docs.vlm.run/agents/capabilities/image/detection Detect and locate objects, faces or people in images with bounding boxes and confidence scores Detect objects, people, or other entities in images with precise bounding boxes and confidence scores. Ideal for inventory management, quality control, security applications, and automated visual inspection. Object detection example showing detected objects with bounding boxes

Persons

Persons detection example showing detected people with bounding boxes

Faces

Faces detection example showing detected faces with bounding boxes
## Usage Example For best results, we recommend using the [Structured Outputs API](/agents/structured-responses) to get responses in a structured and validated data format. The following examples can also be used for face or person detection. The response schema is identical to the object detection example. ```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Execute object detection response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ {"role": "user", "content": [ {"type": "text", "text": "Detect all objects in this image"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/donuts.png", "detail": "auto"}} ]}, ], ) print(response.choices[0].message.content) ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class Detection(BaseModel): label: str = Field(..., description="Name of the detected object") xywh: tuple[float, float, float, float] = Field(..., description="Bounding box (x, y, width, height)") class Detections(BaseModel): detections: list[Detection] = Field(..., description="List of detections") # Initialize the VLMRun client client = VLMRun(api_key="") # Execute object detection with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ {"role": "user", "content": [ {"type": "text", "text": "Detect all objects in this image"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/donuts.png", "detail": "auto"}} ]}, ], response_format={"type": "json_schema", "schema": Detections.model_json_schema()}, ) # Validate the response result = Detections.model_validate_json(response.choices[0].message.content) # >>> Detections(detections=[Detection(label="donut", xywh=(...)), ...]) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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: "Detect all objects in this image" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/donuts.png", detail: "auto" } } ] } ] }); console.log(response.choices[0].message.content); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const DetectionsSchema = z.object({ detections: z.array(z.object({ label: z.string().describe("Name of the detected object"), xywh: z.array(z.number()).describe("Bounding box (x, y, width, height)") })).describe("List of detections") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Execute object detection with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Detect all objects in this image" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/donuts.png", detail: "auto" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(DetectionsSchema) } }); const result = DetectionsSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ## FAQ Orion supports open-world (aka open-set) detection. This means it is not limited to a predefined list of categories; it can detect, locate, and ground virtually any object described in natural language, including rare items, specific parts of objects, and complex visual relations. The bounding boxes come in the format of normalized `xywh`, where `x` and `y` are the top-left corner of the bounding box, and `w` and `h` are the width and height of the bounding box. All values are between 0 and 1, and normalized by the image size. `x` and `w` are normalized by the image width, and `y` and `h` are normalized by the image height. The confidence score is a value between 0 and 1 that indicates the confidence of the detection. # Generate & Edit Source: https://docs.vlm.run/agents/capabilities/image/generation Generate and edit images from text prompts, sketches, or existing images with creative control Generate and edit images from text prompts, sketches, or existing images with creative control. Perfect for creative content generation, marketing and advertising, product visualization, and artistic expression. Image generation example showing AI-generated images from text prompts with creative control
Image-to-Image
Text-to-Image
Image-Inpainting
Image-Inpainting
Style Transfer
Style Transfer
## Example Usage For best results, we recommend using the [Structured Outputs API](/agents/structured-responses) to get responses in a structured and validated data format. ### Text-to-Image Generate images from text descriptions with creative control over style, composition, and details. Generate an image of a cat flying through the sky and clouds, with the background of a green city with river ```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Generate the image response = 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"} ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class ImageGenerationResponse(BaseModel): url: str = Field(..., description="The URL of the generated image") # Initialize the VLMRun client client = VLMRun(api_key="") # Generate the image with structured output response = 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 response result = ImageGenerationResponse.model_validate_json(response.choices[0].message.content) # >>> ImageGenerationResponse(url="https://.../image.jpg") ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const ImageGenerationResponseSchema = z.object({ url: z.string().describe("The URL of the generated image") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Generate the image with structured output 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" } ], response_format: { type: "json_schema", schema: zodToJsonSchema(ImageGenerationResponseSchema) } }); const result = ImageGenerationResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ### Image-to-Image Transform existing images by applying new styles, enhancing details, or changing specific elements while preserving the original structure.
Image-to-Image example showing AI-generated images combining objects from two separate images
Reference Dog Image
Reference Dog Image
Dog flying through space
More examples of image-to-image
```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Generate the image response = 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"} ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class ImageGenerationResponse(BaseModel): url: str = Field(..., description="The URL of the generated image") # Initialize the VLMRun client client = VLMRun(api_key="") # Transform the image with structured output response = 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 response result = ImageGenerationResponse.model_validate_json(response.choices[0].message.content) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const ImageGenerationResponseSchema = z.object({ url: z.string().describe("The URL of the generated image") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Transform the image with structured output 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" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(ImageGenerationResponseSchema) } }); const result = ImageGenerationResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ### Image Inpainting Fill in missing areas, remove unwanted objects, or add new elements to existing images seamlessly.
Image inpainting example showing AI-generated images combining objects from two separate images
Reference Dog Image
Reference Dog Image
Reference Car Image
Reference Car Image
```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Generate the image response = 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"} ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class ImageGenerationResponse(BaseModel): url: str = Field(..., description="The URL of the generated image") # Initialize the VLMRun client client = VLMRun(api_key="") # Inpaint the image with structured output response = 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 response result = ImageGenerationResponse.model_validate_json(response.choices[0].message.content) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const ImageGenerationResponseSchema = z.object({ url: z.string().describe("The URL of the generated image") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Inpaint the image with structured output 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" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(ImageGenerationResponseSchema) } }); const result = ImageGenerationResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ### Style Transfer Apply artistic styles from reference images to transform the visual appearance while preserving content. In the example below, we apply the Van Gogh's "Starry Night" painting style to a photo of a city skyline at night.
Example of image style transfer
Reference Van Gogh Image
Reference Van Gogh Image
Reference City Image
Reference City Image
```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Generate the image response = 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"} ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class ImageGenerationResponse(BaseModel): url: str = Field(..., description="The URL of the generated image") # Initialize the VLMRun client client = VLMRun(api_key="") # Apply style transfer with structured output response = 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 response result = ImageGenerationResponse.model_validate_json(response.choices[0].message.content) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const ImageGenerationResponseSchema = z.object({ url: z.string().describe("The URL of the generated image") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Apply style transfer with structured output 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" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(ImageGenerationResponseSchema) } }); const result = ImageGenerationResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ## FAQ * **Photorealistic**: Ultra-realistic images with fine details * **High Detail**: Ultra-realistic images with fine details * **Natural Lighting**: Realistic lighting and shadows * **Professional Quality**: Suitable for commercial and professional use * **Multiple Subjects**: People, objects, landscapes, architecture * **Be Specific**: Include details about style, composition, lighting, and mood * **Use Keywords**: Include relevant art terms, techniques, and descriptors * **Reference Styles**: Mention specific artists, art movements, or visual styles * **Technical Details**: Specify resolution, quality, and output format needs # Pointing Source: https://docs.vlm.run/agents/capabilities/image/pointing Detect and predict key anatomical points and structural features in images with sub-pixel accuracy Detect and localize keypoints of objects, people or faces in images with precise coordinate mapping. Ideal for counting, localization and salience detection. Keypoint prediction example showing object keypoints
Object Localization
Object keypoint detection
Person Localization
Person keypoint detection
Face Localization
Face keypoint detection
## Usage Example For best results, we recommend using the [Structured Outputs API](/agents/structured-responses) to get responses in a structured and validated data format. ```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Predict the keypoints in the image response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Point to all the cars and doors in this image"}, {"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) ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class KeyPoint(BaseModel): xy: tuple[float, float] = Field(..., description="Normalized keypoint coordinates [x, y]") label: str = Field(..., description="Label of the keypoint") class Keypoints(BaseModel): keypoints: list[KeyPoint] = Field(..., description="List of keypoints") # Initialize the VLMRun client client = VLMRun(api_key="") # Predict the keypoints with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Point to all the cars and doors in this image"}, {"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": Keypoints.model_json_schema()}, ) # Validate the response result = Keypoints.model_validate_json(response.choices[0].message.content) # >>> Keypoints(keypoints=[KeyPoint(xy=(0.5, 0.5), label='car'), ...]) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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: "Point to all the cars and doors in this image" }, { 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); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const KeypointsSchema = z.object({ keypoints: z.array(z.object({ xy: z.array(z.number()).describe("Normalized keypoint coordinates [x, y]"), label: z.string().describe("Label of the keypoint") })).describe("List of keypoints") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Predict the keypoints with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Point to all the cars and doors in this image" }, { 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(KeypointsSchema) } }); const result = KeypointsSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ## FAQ The keypoints come in the format of a list of objects with their keypoints. The keypoints are in the format of normalized `xy`, where `x` and `y` are the top-left corner of the keypoint. All values are between 0 and 1, and normalized by the image size. `x` and `y` are normalized by the image width and height respectively. You can extract the following tags for each keypoint: * **Object Name**: The name of the object that the keypoint belongs to. For example, "car", "door", "person", "face", etc. * **Confidence Score**: The confidence score of the keypoint detection. # Segmentation Source: https://docs.vlm.run/agents/capabilities/image/segmentation Create precise pixel-level segmentation masks for objects, regions, and features in images Create precise pixel-level segmentation masks for objects, regions, and features in images. Perfect for medical imaging, autonomous driving, photo editing, and augmented reality applications.

Object Segmentation

Segmentation of cars with their masks overlaid

Face Segmentation

Segmentation of individual faces with their masks overlaid
## Usage Example For best results, we recommend using the [Structured Outputs API](/agents/structured-responses) to get responses in a structured and validated data format. ```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Segment objects in the image response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Segment all the cars in this image"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/nascar.jpg", "detail": "auto"}} ] } ], ) print(response.choices[0].message.content) ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class SegmentationMask(BaseModel): label: str = Field(..., description="Name of the segmented object") mask_url: str = Field(..., description="Pre-signed URL to the PNG mask") class Segmentations(BaseModel): segmentations: list[SegmentationMask] = Field(..., description="List of segmentations") # Initialize the VLMRun client client = VLMRun(api_key="") # Segment objects with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Segment all the cars in this image"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/nascar.jpg", "detail": "auto"}} ] } ], response_format={"type": "json_schema", "schema": Segmentations.model_json_schema()}, ) # Validate the response result = Segmentations.model_validate_json(response.choices[0].message.content) # >>> Segmentations(segmentations=[SegmentationMask(label="car", mask_url="https://..."), ...]) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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: "Segment all the cars in this image" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/nascar.jpg", detail: "auto" } } ] } ] }); console.log(response.choices[0].message.content); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const SegmentationsSchema = z.object({ segmentations: z.array(z.object({ label: z.string().describe("Name of the segmented object"), mask_url: z.string().describe("Pre-signed URL to the PNG mask") })).describe("List of segmentations") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Segment objects with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Segment all the cars in this image" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/nascar.jpg", detail: "auto" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(SegmentationsSchema) } }); const result = SegmentationsSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ## FAQ * **Instance Segmentation**: Segment individual objects with unique masks * **Semantic Segmentation**: Classify pixels by category or class * **Panoptic Segmentation**: Combine instance and semantic segmentation The segmentation masks come in the format of a list of objects with their masks. The masks are in PNG format that can be retrieved as a pre-signed URL, per object instance. Orion supports promptable segmentation, where you can describe in natural language the object(s) you want to segment (e.g., "segment the writing-related items in this image"). For best results, clearly describe the object(s) of interest. Below are some common examples of classes that can be segmented: Common Objects Specialized Categories PNG Masks Other Formats (Coming soon!): JSON Polygons and COCO Format # Image Tools Source: https://docs.vlm.run/agents/capabilities/image/tools Image tools for cropping, rotating, enhancing, and transforming images VLM Run's Orion agents can leverage various image-editing tools such as cropping, rotating, super-resolution, and de-oldify. These tools are designed to help you enhance image quality, extract specific regions, correct orientation, and restore historical photos with modern AI techniques. For best results, we recommend using the [Structured Outputs API](/agents/structured-responses) to get responses in a structured and validated data format. ### 1. Image Cropping Extract specific regions or focus on particular subjects within an image. ```mdx wrap theme={"theme":{"light":"github-light","dark":"dark-plus"}} Crop the clock to tell the time more clearly. ```
```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Crop image to focus on main subject response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Crop the clock to tell the time more clearly"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/clock.jpg", "detail": "auto"}} ] } ] ) print(response.choices[0].message.content) # >>> {"url": "https://.../cropped.jpg", "label": "clock", "xywh": [0.2, 0.2, 0.6, 0.6]} ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class ImageCropResponse(BaseModel): url: str = Field(..., description="URL of the cropped image") label: str = Field(..., description="Object label") xywh: tuple[float, float, float, float] = Field(..., description="Bounding box (x, y, w, h)") # Initialize the VLMRun client client = VLMRun(api_key="") # Crop image with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Crop the clock to tell the time more clearly"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/clock.jpg", "detail": "auto"}} ] } ], response_format={"type": "json_schema", "schema": ImageCropResponse.model_json_schema()} ) # Validate the response result = ImageCropResponse.model_validate_json(response.choices[0].message.content) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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: "Crop the clock to tell the time more clearly" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/clock.jpg", detail: "auto" } } ] } ] }); console.log(response.choices[0].message.content); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const ImageCropResponseSchema = z.object({ url: z.string().describe("URL of the cropped image"), label: z.string().describe("Object label"), xywh: z.array(z.number()).describe("Bounding box (x, y, w, h)") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Crop image with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Crop the clock to tell the time more clearly" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/clock.jpg", detail: "auto" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(ImageCropResponseSchema) } }); const result = ImageCropResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` While the demonstration uses a single crop, we also support cropping multiple regions at once. ### 2. Image Rotation Correct image orientation or apply creative rotations for better composition. ```mdx wrap theme={"theme":{"light":"github-light","dark":"dark-plus"}} Rotate the image 90 degrees clockwise to correct the orientation. ```
Original image before rotation
Image after 90-degree rotation in the clockwise direction
```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Rotate image to correct orientation response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Rotate this image 90 degrees clockwise"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/cats.jpg"}} ] } ] ) print(response.choices[0].message.content) # >>> {"url": "https://.../rotated.jpg", "angle": 90} ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class ImageRotationResponse(BaseModel): url: str = Field(..., description="URL of the rotated image") angle: int = Field(..., description="Rotation angle (0, 90, 180, 270) degrees clockwise") # Initialize the VLMRun client client = VLMRun(api_key="") # Rotate image with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Rotate this image 90 degrees clockwise"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/cats.jpg"}} ] } ], response_format={"type": "json_schema", "schema": ImageRotationResponse.model_json_schema()} ) # Validate the response result = ImageRotationResponse.model_validate_json(response.choices[0].message.content) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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: "Rotate this image 90 degrees clockwise" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/cats.jpg" } } ] } ] }); console.log(response.choices[0].message.content); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const ImageRotationResponseSchema = z.object({ url: z.string().describe("URL of the rotated image"), angle: z.number().int().describe("Rotation angle (0, 90, 180, 270) degrees clockwise") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Rotate image with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Rotate this image 90 degrees clockwise" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.object-detection/cats.jpg" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(ImageRotationResponseSchema) } }); const result = ImageRotationResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ### 3. Super-Resolution Enhancement Upscale images while maintaining quality and adding realistic details. ```mdx wrap theme={"theme":{"light":"github-light","dark":"dark-plus"}} Enhance this image using super-resolution to increase its resolution while preserving quality. ```
Original low-resolution image
Enhanced high-resolution image
```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Apply super-resolution enhancement response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Enhance this image using super-resolution to increase its resolution while preserving quality"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/vegetables-lo.jpg"}} ] } ] ) print(response.choices[0].message.content) # >>> {"url": "https://.../enhanced.jpg"} ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class SuperResolutionResponse(BaseModel): url: str = Field(..., description="URL of the enhanced image") # Initialize the VLMRun client client = VLMRun(api_key="") # Enhance image with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Enhance this image using super-resolution to increase its resolution while preserving quality"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/vegetables-lo.jpg"}} ] } ], response_format={"type": "json_schema", "schema": SuperResolutionResponse.model_json_schema()} ) # Validate the response result = SuperResolutionResponse.model_validate_json(response.choices[0].message.content) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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: "Enhance this image using super-resolution to increase its resolution while preserving quality" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/vegetables-lo.jpg" } } ] } ] }); console.log(response.choices[0].message.content); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const SuperResolutionResponseSchema = z.object({ url: z.string().describe("URL of the enhanced image") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Enhance image with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Enhance this image using super-resolution to increase its resolution while preserving quality" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/vegetables-lo.jpg" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(SuperResolutionResponseSchema) } }); const result = SuperResolutionResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ### 4. De-Oldify (Colorization) Transform black and white or sepia images into vibrant color photos using AI. ```mdx wrap theme={"theme":{"light":"github-light","dark":"dark-plus"}} De-oldify this image so that it's colorized and upsampled. ```
Original black and white image
Colorized image with realistic colors
```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Colorize black and white image response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "De-oldify this image so that it's colorized and upsampled"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/lunch-skyscraper.jpg"}} ] } ] ) print(response.choices[0].message.content) # >>> {"url": "https://.../colorized.jpg"} ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class DeOldifyResponse(BaseModel): url: str = Field(..., description="URL of the colorized image") # Initialize the VLMRun client client = VLMRun(api_key="") # Colorize image with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "De-oldify this image so that it's colorized and upsampled"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/lunch-skyscraper.jpg"}} ] } ], response_format={"type": "json_schema", "schema": DeOldifyResponse.model_json_schema()} ) # Validate the response result = DeOldifyResponse.model_validate_json(response.choices[0].message.content) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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: "De-oldify this image so that it's colorized and upsampled" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/lunch-skyscraper.jpg" } } ] } ] }); console.log(response.choices[0].message.content); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const DeOldifyResponseSchema = z.object({ url: z.string().describe("URL of the colorized image") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Colorize image with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "De-oldify this image so that it's colorized and upsampled" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.agent/lunch-skyscraper.jpg" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(DeOldifyResponseSchema) } }); const result = DeOldifyResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ## FAQ * **JPEG/JPG**: Most common format with excellent compatibility * **PNG**: Lossless format with transparency support * **TIFF**: High-quality format for professional editing * **WebP**: Modern format with superior compression * **BMP**: Uncompressed bitmap format * **Quality Preservation**: Maintains original image quality in all transformations * **Rule of Thirds**: Align subjects with intersection points for better composition * **Aspect Ratio**: Maintain consistent aspect ratios for professional results * **Subject Focus**: Keep the main subject centered or following composition rules * **Background Removal**: Remove distracting elements while preserving context * **AI-Powered**: Uses advanced neural networks for realistic detail generation * **Multiple Scales**: Supports 2x, 4x, and 8x upscaling with quality preservation * **Detail Enhancement**: Intelligently adds realistic textures and patterns * **Quality Metrics**: Provides confidence scores for enhancement quality * **Historical Accuracy**: Uses context-aware AI to suggest period-appropriate colors * **Natural Colors**: Generates realistic skin tones, clothing, and environmental colors * **Confidence Scoring**: Provides confidence levels for color accuracy * **Region Analysis**: Identifies and colors different regions with appropriate palettes # UI Parsing Source: https://docs.vlm.run/agents/capabilities/image/ui-parsing Analyze and understand user interface elements in screenshots and application images Analyze and understand user interface elements in screenshots and application images. Perfect for automated testing, design system validation, accessibility auditing, and mobile app analysis. UI parsing example showing UI element detection and classification with interactive elements
UI VQA & Grounding
UI VQA & Grounding
Web Interface
Web interface UI parsing
## Usage Example For best results, we recommend using the [Structured Outputs API](/agents/structured-responses) to get responses in a structured and validated data format. ```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun # Initialize the VLMRun client client = VLMRun(api_key="") # Parse UI elements in the image response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Analyze all UI elements in this mobile app screenshot"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/web.ui-automation/win11.jpeg", "detail": "auto"}} ] } ], ) print(response.choices[0].message.content) ``` ```python Python - Structured Outputs theme={"theme":{"light":"github-light","dark":"dark-plus"}} from vlmrun.client import VLMRun from pydantic import BaseModel, Field # Define the response schema class UIElement(BaseModel): type: str = Field(..., description="Type of UI element") text: str | None = Field(None, description="Text content of the element") interactive: bool = Field(..., description="Whether the element is interactive") xywh: tuple[float, float, float, float] = Field(..., description="Bounding box coordinates") class UIResponse(BaseModel): elements: list[UIElement] = Field(..., description="List of detected UI elements") # Initialize the VLMRun client client = VLMRun(api_key="") # Parse UI elements with structured output response = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Analyze all UI elements in this mobile app screenshot"}, {"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/web.ui-automation/win11.jpeg", "detail": "auto"}} ] } ], response_format={"type": "json_schema", "schema": UIResponse.model_json_schema()}, ) # Validate the response result = UIResponse.model_validate_json(response.choices[0].message.content) # >>> UIResponse(elements=[UIElement(type="button", text="Sign In", ...), ...]) ``` ```typescript Node.js theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; const client = new VlmRun({ apiKey: "", 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: "Analyze all UI elements in this mobile app screenshot" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/web.ui-automation/win11.jpeg", detail: "auto" } } ] } ] }); console.log(response.choices[0].message.content); ``` ```typescript Node.js - Structured Outputs [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}} import { VlmRun } from "vlmrun"; import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; // Define the response schema with Zod const UIResponseSchema = z.object({ elements: z.array(z.object({ type: z.string().describe("Type of UI element"), text: z.string().nullable().describe("Text content of the element"), interactive: z.boolean().describe("Whether the element is interactive"), xywh: z.array(z.number()).describe("Bounding box coordinates") })).describe("List of detected UI elements") }); // Initialize the VLMRun client const client = new VlmRun({ apiKey: "", baseURL: "https://api.vlm.run/v1" }); // Parse UI elements with structured output const response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: [ { type: "text", text: "Analyze all UI elements in this mobile app screenshot" }, { type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/web.ui-automation/win11.jpeg", detail: "auto" } } ] } ], response_format: { type: "json_schema", schema: zodToJsonSchema(UIResponseSchema) } }); const result = UIResponseSchema.parse(JSON.parse(response.choices[0].message.content)); ``` ## FAQ UI Parsing is the process of analyzing UI elements in screenshots and application images to identify UI elements, buttons, and interactive components for automated testing. UI VQA & Grounding is the process of asking specific questions about the UI elements in screenshots and application images to identify UI elements, buttons, and interactive components for automated testing. This is different from UI parsing, where all UI elements are returned. In most cases, you should use UI VQA & Grounding to get more accurate results. # Caption & Tag Source: https://docs.vlm.run/agents/capabilities/video/captioning Generate detailed captions and tags for videos using advanced vision models. Generate comprehensive, contextual captions for videos using state-of-the-art vision-language models. Perfect for accessibility, content management, and automated video analysis workflows.