from vlmrun.client import VLMRun# Initialize the VLMRun clientclient = VLMRun(api_key="<VLMRUN_API_KEY>")# Generate the videoresponse = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": "Generate a video of a serene mountain landscape with flowing clouds, cinematic wide shot, golden hour lighting, 4K, 20 seconds" } ])print(response.choices[0].message.content)# >>> {"url": "https://.../video.mp4"}
from vlmrun.client import VLMRunfrom pydantic import BaseModel, Field# Define the response schemaclass VideoGenerationResponse(BaseModel): url: str = Field(..., description="The URL of the generated video")# Initialize the VLMRun clientclient = VLMRun(api_key="<VLMRUN_API_KEY>")# Generate the video with structured outputresponse = client.agent.completions.create( model="vlmrun-orion-1:auto", messages=[ { "role": "user", "content": "Generate a video of a serene mountain landscape with flowing clouds, cinematic wide shot, golden hour lighting, 4K, 20 seconds" } ], response_format={"type": "json_schema", "schema": VideoGenerationResponse.model_json_schema()})# Validate the responseresult = VideoGenerationResponse.model_validate_json(response.choices[0].message.content)# >>> VideoGenerationResponse(url="https://.../video.mp4")
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 a video of a serene mountain landscape with flowing clouds, cinematic wide shot, golden hour lighting, 4K, 20 seconds" } ]});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 VideoGenerationResponseSchema = z.object({ url: z.string().describe("The URL of the generated video")});// Initialize the VLMRun clientconst client = new VlmRun({ apiKey: "<VLMRUN_API_KEY>", baseURL: "https://api.vlm.run/v1"});// Generate the video with structured outputconst response = await client.agent.completions.create({ model: "vlmrun-orion-1:auto", messages: [ { role: "user", content: "Generate a video of a serene mountain landscape with flowing clouds, cinematic wide shot, golden hour lighting, 4K, 20 seconds" } ], response_format: { type: "json_schema", schema: zodToJsonSchema(VideoGenerationResponseSchema) }});const result = VideoGenerationResponseSchema.parse(JSON.parse(response.choices[0].message.content));