Agent

APIs for creating/editing media via agent orchestration and managing sessions with comprehensive control over user requests. The Agent Orchestration enables iterative creation and editing with context understanding. The agent translates plain conversational requests into actions and orchestrates calls to vimmerse tools and generate the required media accordingly.

Typical Agent Workflow (Async with Polling)

  1. Submit Request (POST /v2/agent) - Submit your generation or edit prompt with new_session: true or inside an existing session_id. Execution runs asynchronously by default, returning immediately with status: "PROCESSING" and a session_id.
  2. Poll Session Status (GET /v2/agent/{session_id}) - Poll the session periodically (every 3–5 seconds) until status transitions to "SUCCESS" (or "FAILED").
  3. Retrieve Generated Media - Access the latest turn (turns[-1]) for conversational response text and generated asset URLs (image_urls, video_urls, audio_urls).
  4. Continue Contextual Iteration - Send subsequent prompts to POST /v2/agent using the same session_id (new_session: false) to edit images, animate them into videos, or continue multi-turn generation.

Common Use Cases

  • Product Videos: Create marketing briefs and photoshot product images for marketing campaigns
  • Storytelling and Shorts: Create storyboard of multiple scenes, define element images of characters objects and settings, use elements in scene images, feed all to create shorts and story videos
  • Social Media Content: Perform retouches, reframing, and edits to ready content for social platforms
  • Ideation: Ask agent with propose prompts and make variants of images and videos
  • Tool testing: Compare generation results of different image and video models side by side
  • Automation: Let agent handle the orchestration on your behalf so it picks the right tools and methods and build up on your context iterations

Endpoint Overview

Method Endpoint Description Access
POST / Interact with an agent, process prompts, and manage session turns User
GET /catalog/profiles List available agent profiles the user can switch between User
GET /sessions/{agent_name} Retrieve a list of sessions for a given agent owned by the authenticated user User
GET /{session_id} Retrieve full conversation turn history for a session User
PUT /{session_id} Update the attributes (e.g. title, visibility_status, agent_name) of a specific session User
DELETE /{session_id} Delete a session and its associated data User
GET /{customer_id}/sessions List all sessions for all agents owned by a given customer account Admin

Authentication

All requests require your API key in the X-Api-Key header:

headers = {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
}

Quick Start Examples

The /v2/agent endpoint processes generative and multi-step tasks asynchronously by default. When you submit a request with POST /v2/agent, the server initiates or resumes a session and returns immediately with a session_id and initial status ("PROCESSING"). Clients poll GET /v2/agent/{session_id} until the session status transitions to "SUCCESS" (or "FAILED"). Once complete, the latest turn in turns contains the agent's response text and generated asset URLs (image_urls, video_urls).

Helper: Polling Function

Use a polling helper to query GET /v2/agent/{session_id} until the generation turn completes:

import time
import requests

def poll_session(session_id, base_url, headers, timeout=600, poll_interval=5):
    """Poll GET /v2/agent/{session_id} until status is success."""
    url = f"{base_url}/v2/agent/{session_id}"
    start_time = time.time()
    while time.time() - start_time < timeout:
        response = requests.get(url, headers=headers, timeout=30)
        response.raise_for_status()
        data = response.json()
        status = data.get("status", "").lower()
        if status in ["success", "completed"]:
            return data
        elif status in ["failed", "error"]:
            raise RuntimeError(f"Session failed: {data}")
        print(f"Status is '{status}', waiting {poll_interval}s...")
        time.sleep(poll_interval)
    raise TimeoutError(f"Session {session_id} timed out after {timeout}s")

Example 1: Make a product advertisement video

import time
import requests
import json

BASE_URL = "https://api.vimmerse.net"
API_KEY = "YOUR_API_KEY"

url = f"{BASE_URL}/v2/agent"
headers = {"X-Api-Key": API_KEY, "Content-Type": "application/json"}

def poll_session(session_id, timeout=600, poll_interval=5):
    """Poll GET /v2/agent/{session_id} until status is success."""
    poll_url = f"{BASE_URL}/v2/agent/{session_id}"
    start_time = time.time()
    while time.time() - start_time < timeout:
        res = requests.get(poll_url, headers=headers, timeout=30)
        res.raise_for_status()
        session_data = res.json()
        status = session_data.get("status", "").lower()
        if status in ["success", "completed"]:
            return session_data
        elif status in ["failed", "error"]:
            raise RuntimeError(f"Session failed: {session_data}")
        print(f"Status is '{status}', waiting {poll_interval}s...")
        time.sleep(poll_interval)
    raise TimeoutError(f"Session {session_id} timed out after {timeout}s")

try:
    # 1. Create first images in a new session (POST returns immediately with status 'PROCESSING' by default)
    payload = {
        "agent_name": "vimi",
        "title": "Product ads",
        "prompt": "Create two vertical images using GPTImage of the person in the uploaded photo drinking from the strawberry can in the other photo. Make them appear as if taken in a photoshoot session for a marketing poster.",
        "image_urls": [
            "https://asset.vimmerse.net/vimmerse-product/ai_images/upload_ed66297ff41e467f.jpeg",
            "https://asset.vimmerse.net/vimmerse-product/ai_images/upload_88a364d0a8ca4d28.png"
        ],
        "new_session": True
    }
    response = requests.post(url, headers=headers, json=payload, timeout=30)
    response.raise_for_status()
    initial_result = response.json()
    session_id = initial_result["session_id"]
    print(f"Session initiated! ID: {session_id}, Status: {initial_result.get('status')}")
    # Example Immediate Response:
    # {
    #     "session_id": "b9ebe782-da5d-43ee-8297-1959965a2917",
    #     "agent_name": "vimi",
    #     "title": "Product ads",
    #     "visibility_status": "1",
    #     "status": "PROCESSING",
    #     "user_id": "usr_8832",
    #     "customer_id": "vimmerse-test-user",
    #     "response": "Agent execution task has been submitted and is processing.",
    #     "credits_consumed_this_turn": 0,
    #     "total_session_credits_consumed": 0
    # }

    # Poll session until image generation completes
    session_data = poll_session(session_id)
    latest_turn = session_data["turns"][-1]
    print(f"
Response: {latest_turn['text']}")
    print(f"Generated Images: {latest_turn.get('image_urls', [])}")
    # Example Polled Session Result:
    # {
    #     "session_id": "b9ebe782-da5d-43ee-8297-1959965a2917",
    #     "agent_name": "vimi",
    #     "title": "Product ads",
    #     "visibility_status": "1",
    #     "status": "success",
    #     "user_id": "usr_8832",
    #     "customer_id": "vimmerse-test-user",
    #     "total_credits": 32,
    #     "turns": [
    #         {
    #             "role": "user",
    #             "text": "Create two vertical images using GPTImage...",
    #             "credits": 0,
    #             "image_urls": ["..."],
    #             "timestamp": "2026-08-21T22:50:00Z"
    #         },
    #         {
    #             "role": "model",
    #             "text": "The two marketing poster images have been generated:

* [Image 1](https://asset.vimmerse.net/vimmerse-test-user/db8352a9-fb57-4a09-bc4c-443cf3d17cf7/create_image/3142b191-ffe6-4115-b660-9f1d52518320.png)
* [Image 2](https://asset.vimmerse.net/vimmerse-test-user/db8352a9-fb57-4a09-bc4c-443cf3d17cf7/create_image/e7445ad6-ab9c-4055-b05c-01d40e95db62.png)

**Credits Consumed:** 32",
    #             "credits": 32,
    #             "image_urls": [
    #                 "https://asset.vimmerse.net/vimmerse-test-user/db8352a9-fb57-4a09-bc4c-443cf3d17cf7/create_image/3142b191-ffe6-4115-b660-9f1d52518320.png",
    #                 "https://asset.vimmerse.net/vimmerse-test-user/db8352a9-fb57-4a09-bc4c-443cf3d17cf7/create_image/e7445ad6-ab9c-4055-b05c-01d40e95db62.png"
    #             ],
    #             "timestamp": "2026-08-21T22:51:30Z"
    #         }
    #     ]
    # }

    # 2. Edit one of the image generations further in same session
    payload = {
        "agent_name": "vimi",
        "session_id": session_id,
        "prompt": "take the second photo and add floating strawberries around the person as it was showing in the original strawberry can photo.",
        "new_session": False
    }
    response = requests.post(url, headers=headers, json=payload, timeout=30)
    response.raise_for_status()
    print(f"
Edit initiated! Status: {response.json().get('status')}")

    # Poll session until edit completes
    session_data = poll_session(session_id)
    latest_turn = session_data["turns"][-1]
    print(f"Response: {latest_turn['text']}")
    print(f"Generated Images: {latest_turn.get('image_urls', [])}")

    # 3. Animate the resulted image into a video in same session
    payload = {
        "agent_name": "vimi",
        "session_id": session_id,
        "prompt": "animate the image into 10 sec video using Google Omni search that it appears as a professional marketing video for the product have the person feeling refreshed and energetic as she is drinking the can.",
        "new_session": False
    }
    response = requests.post(url, headers=headers, json=payload, timeout=30)
    response.raise_for_status()
    print(f"
Animation initiated! Status: {response.json().get('status')}")

    # Poll session until video generation completes (longer timeout for video rendering)
    session_data = poll_session(session_id, timeout=600)
    latest_turn = session_data["turns"][-1]
    print(f"Response: {latest_turn['text']}")
    print(f"Generated Videos: {latest_turn.get('video_urls', [])}")
    # Example Polled Session Result:
    # {
    #     "session_id": "b9ebe782-da5d-43ee-8297-1959965a2917",
    #     "agent_name": "vimi",
    #     "title": "Product ads",
    #     "visibility_status": "1",
    #     "status": "success",
    #     "user_id": "usr_8832",
    #     "customer_id": "vimmerse-test-user",
    #     "total_credits": 208,
    #     "turns": [
    #         ...,
    #         {
    #             "role": "model",
    #             "text": "Your 10-second commercial marketing video has been generated:

* [Watch the Video](https://asset.vimmerse.net/vimmerse-test-user/b11a2dc6-ce1b-4bd2-9bc2-238aa1adb081/batch/1/GoogleOmni/b11a2dc6-ce1b-4bd2-9bc2-238aa1adb081.mp4)

**Credits Consumed:** 160",
    #             "credits": 160,
    #             "video_urls": ["https://asset.vimmerse.net/vimmerse-test-user/b11a2dc6-ce1b-4bd2-9bc2-238aa1adb081/batch/1/GoogleOmni/b11a2dc6-ce1b-4bd2-9bc2-238aa1adb081.mp4"],
    #             "timestamp": "2026-08-21T22:54:43Z"
    #         }
    #     ]
    # }

except requests.exceptions.HTTPError as e:
    print(f"HTTP Error: {e}")
    if e.response is not None:
        print(f"Response: {e.response.text}")
except requests.exceptions.RequestException as e:
    print(f"Request failed: {e}")

Example 2: Create a story video of a kid dreaming to become a professional soccer player

import time
import requests
import json

BASE_URL = "https://api.vimmerse.net"
API_KEY = "YOUR_API_KEY"

url = f"{BASE_URL}/v2/agent"
headers = {"X-Api-Key": API_KEY, "Content-Type": "application/json"}

def poll_session(session_id, timeout=600, poll_interval=5):
    """Poll GET /v2/agent/{session_id} until status is success."""
    poll_url = f"{BASE_URL}/v2/agent/{session_id}"
    start_time = time.time()
    while time.time() - start_time < timeout:
        res = requests.get(poll_url, headers=headers, timeout=30)
        res.raise_for_status()
        session_data = res.json()
        status = session_data.get("status", "").lower()
        if status in ["success", "completed"]:
            return session_data
        elif status in ["failed", "error"]:
            raise RuntimeError(f"Session failed: {session_data}")
        print(f"Status is '{status}', waiting {poll_interval}s...")
        time.sleep(poll_interval)
    raise TimeoutError(f"Session {session_id} timed out after {timeout}s")

try:
    # 1. Create storyboard, character image, and the 3 scene images in a new session
    payload = {
        "agent_name": "vimi",
        "title": "Kid Dream",
        "prompt": "create a storyboard of 3 scenes for a kid dreaming about becoming a professional soccer player in pixar style. Create the character image then use it along with the scene prompts to create the 3 scene images.",
        "new_session": True
    }
    response = requests.post(url, headers=headers, json=payload, timeout=30)
    response.raise_for_status()
    result = response.json()
    session_id = result["session_id"]
    print(f"Session initiated! ID: {session_id}, Status: {result.get('status')}")

    # Poll session until storyboard and images are generated
    session_data = poll_session(session_id, timeout=600)
    latest_turn = session_data["turns"][-1]
    print(f"
Response: {latest_turn['text']}")
    # Example Polled Response shows character image and 3 scene images:
    # - Character: https://asset.vimmerse.net/.../5f813dac-8244-4d0e-b38f-b19f88bcf711.png
    # - Scene 1: https://asset.vimmerse.net/.../047c6b27-5002-4680-8a74-0d3052bcd276.png
    # - Scene 2: https://asset.vimmerse.net/.../058373c9-729e-4d65-ac6f-c955d9477428.png
    # - Scene 3: https://asset.vimmerse.net/.../e65308d4-e8ee-4a4b-9127-b50137ac12bd.png

    # 2. Use all 3 scene images in reference-to-video call to make 10 sec video in the same session
    payload = {
        "agent_name": "vimi",
        "session_id": session_id,
        "prompt": "Use these 3 scene images in reference-2-video call to make 10sec video using GoogleOmni. The video starts by the dream scene and ends with the celebration on the playground after all the hard work.",
        "new_session": False
    }
    response = requests.post(url, headers=headers, json=payload, timeout=30)
    response.raise_for_status()
    print(f"
Animation initiated! Status: {response.json().get('status')}")

    # Poll session until video generation completes
    session_data = poll_session(session_id, timeout=600)
    latest_turn = session_data["turns"][-1]
    print(f"
Response: {latest_turn['text']}")
    print(f"Generated Videos: {latest_turn.get('video_urls', [])}")
    # Example Response shows generated video:
    # - Video Link: https://asset.vimmerse.net/vimmerse-test-user/ai_videos/9751b022-6f42-4a77-ae71-a9590a979264/k1vl4cn.mp4

except requests.exceptions.HTTPError as e:
    print(f"HTTP Error: {e}")
    if e.response is not None:
        print(f"Response: {e.response.text}")
except requests.exceptions.RequestException as e:
    print(f"Request failed: {e}")

Example 3: List all sessions of a particular user

import requests
import json
import time

BASE_URL = "https://api.vimmerse.net"
API_KEY = "YOUR_API_KEY"

url = f"{BASE_URL}/v2/agent/sessions/vimi"
headers = {"X-Api-Key": API_KEY, "Content-Type": "application/json"}

try:
    response = requests.get(url, headers=headers, timeout=60)
    response.raise_for_status()
    result = response.json()
    sessions = result["sessions"]
    print(f"sessions: {sessions}")
    # Example Response
    # {
    #     "user_id": "basel",
    #     "sessions": [
    #         {
    #             "session_id": "b9ebe782-da5d-43ee-8297-1959965a2917",
    #             "agent_name": "vimi",
    #             "title": "Product Ads",
    #             "visibility_status": "1",
    #             "status": "success",
    #             "updated_at": "2026-08-21T22:54:43.128823+00:00",
    #             "total_credits": 208
    #         },
    #         {
    #             "session_id": "ac585e41-0b81-4b87-9d92-ad10392b6e7e",
    #             "agent_name": "vimi",
    #             "title": "Kid Dream",
    #             "visibility_status": "1",
    #             "status": "success",
    #             "updated_at": "2026-08-21T05:52:12.026459+00:00",
    #             "total_credits": 192
    #         }
    #     ]
    # }

except requests.exceptions.HTTPError as e:
    print(f"✗ HTTP Error: {e}")
    if e.response is not None:
        print(f"  Response: {e.response.text}")
    exit(1)
except requests.exceptions.RequestException as e:
    print(f"✗ Request failed: {e}")
    exit(1)

Typical Agent Workflow (Async with Polling)

  1. Submit Request (POST /v2/agent) - Submit your generation or edit prompt with new_session: true or inside an existing session_id. Execution runs asynchronously by default, returning immediately with status: "PROCESSING" and a session_id.
  2. Poll Session Status (GET /v2/agent/{session_id}) - Poll the session periodically (every 3–5 seconds) until status transitions to "SUCCESS" (or "FAILED").
  3. Retrieve Generated Media - Access the latest turn (turns[-1]) for conversational response text and generated asset URLs (image_urls, video_urls, audio_urls).
  4. Continue Contextual Iteration - Send subsequent prompts to POST /v2/agent using the same session_id (new_session: false) to edit images, animate them into videos, or continue multi-turn generation.

Common Use Cases

  • Product Videos: Create marketing briefs and photoshot product images for marketing campaigns
  • Storytelling and Shorts: Create storyboard of multiple scenes, define element images of characters objects and settings, use elements in scene images, feed all to create shorts and story videos
  • Social Media Content: Perform retouches, reframing, and edits to ready content for social platforms
  • Ideation: Ask agent with propose prompts and make variants of images and videos
  • Tool testing: Compare generation results of different image and video models side by side
  • Automation: Let agent handle the orchestration on your behalf so it picks the right tools and methods and build up on your context iterations

Endpoint Overview

Method Endpoint Description Access
POST / Interact with an agent, process prompts, and manage session turns User
GET /catalog/profiles List available agent profiles the user can switch between User
GET /sessions/{agent_name} Retrieve a list of sessions for a given agent owned by the authenticated user User
GET /{session_id} Retrieve full conversation turn history for a session User
PUT /{session_id} Update the attributes (e.g. title, visibility_status, agent_name) of a specific session User
DELETE /{session_id} Delete a session and its associated data User
GET /{customer_id}/sessions List all sessions for all agents owned by a given customer account Admin

Authentication

All requests require your API key in the X-Api-Key header:

headers = {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
}

Quick Start Examples

The /v2/agent endpoint processes generative and multi-step tasks asynchronously by default. When you submit a request with POST /v2/agent, the server initiates or resumes a session and returns immediately with a session_id and initial status ("PROCESSING"). Clients poll GET /v2/agent/{session_id} until the session status transitions to "SUCCESS" (or "FAILED"). Once complete, the latest turn in turns contains the agent's response text and generated asset URLs (image_urls, video_urls).

Helper: Polling Function

Use a polling helper to query GET /v2/agent/{session_id} until the generation turn completes:

import time
import requests

def poll_session(session_id, base_url, headers, timeout=600, poll_interval=5):
    """Poll GET /v2/agent/{session_id} until status is success."""
    url = f"{base_url}/v2/agent/{session_id}"
    start_time = time.time()
    while time.time() - start_time < timeout:
        response = requests.get(url, headers=headers, timeout=30)
        response.raise_for_status()
        data = response.json()
        status = data.get("status", "").lower()
        if status in ["success", "completed"]:
            return data
        elif status in ["failed", "error"]:
            raise RuntimeError(f"Session failed: {data}")
        print(f"Status is '{status}', waiting {poll_interval}s...")
        time.sleep(poll_interval)
    raise TimeoutError(f"Session {session_id} timed out after {timeout}s")

Example 1: Make a product advertisement video

import time
import requests
import json

BASE_URL = "https://api.vimmerse.net"
API_KEY = "YOUR_API_KEY"

url = f"{BASE_URL}/v2/agent"
headers = {"X-Api-Key": API_KEY, "Content-Type": "application/json"}

def poll_session(session_id, timeout=600, poll_interval=5):
    """Poll GET /v2/agent/{session_id} until status is success."""
    poll_url = f"{BASE_URL}/v2/agent/{session_id}"
    start_time = time.time()
    while time.time() - start_time < timeout:
        res = requests.get(poll_url, headers=headers, timeout=30)
        res.raise_for_status()
        session_data = res.json()
        status = session_data.get("status", "").lower()
        if status in ["success", "completed"]:
            return session_data
        elif status in ["failed", "error"]:
            raise RuntimeError(f"Session failed: {session_data}")
        print(f"Status is '{status}', waiting {poll_interval}s...")
        time.sleep(poll_interval)
    raise TimeoutError(f"Session {session_id} timed out after {timeout}s")

try:
    # 1. Create first images in a new session (POST returns immediately with status 'PROCESSING' by default)
    payload = {
        "agent_name": "vimi",
        "title": "Product ads",
        "prompt": "Create two vertical images using GPTImage of the person in the uploaded photo drinking from the strawberry can in the other photo. Make them appear as if taken in a photoshoot session for a marketing poster.",
        "image_urls": [
            "https://asset.vimmerse.net/vimmerse-product/ai_images/upload_ed66297ff41e467f.jpeg",
            "https://asset.vimmerse.net/vimmerse-product/ai_images/upload_88a364d0a8ca4d28.png"
        ],
        "new_session": True
    }
    response = requests.post(url, headers=headers, json=payload, timeout=30)
    response.raise_for_status()
    initial_result = response.json()
    session_id = initial_result["session_id"]
    print(f"Session initiated! ID: {session_id}, Status: {initial_result.get('status')}")
    # Example Immediate Response:
    # {
    #     "session_id": "b9ebe782-da5d-43ee-8297-1959965a2917",
    #     "agent_name": "vimi",
    #     "title": "Product ads",
    #     "visibility_status": "1",
    #     "status": "PROCESSING",
    #     "user_id": "usr_8832",
    #     "customer_id": "vimmerse-test-user",
    #     "response": "Agent execution task has been submitted and is processing.",
    #     "credits_consumed_this_turn": 0,
    #     "total_session_credits_consumed": 0
    # }

    # Poll session until image generation completes
    session_data = poll_session(session_id)
    latest_turn = session_data["turns"][-1]
    print(f"
Response: {latest_turn['text']}")
    print(f"Generated Images: {latest_turn.get('image_urls', [])}")
    # Example Polled Session Result:
    # {
    #     "session_id": "b9ebe782-da5d-43ee-8297-1959965a2917",
    #     "agent_name": "vimi",
    #     "title": "Product ads",
    #     "visibility_status": "1",
    #     "status": "success",
    #     "user_id": "usr_8832",
    #     "customer_id": "vimmerse-test-user",
    #     "total_credits": 32,
    #     "turns": [
    #         {
    #             "role": "user",
    #             "text": "Create two vertical images using GPTImage...",
    #             "credits": 0,
    #             "image_urls": ["..."],
    #             "timestamp": "2026-08-21T22:50:00Z"
    #         },
    #         {
    #             "role": "model",
    #             "text": "The two marketing poster images have been generated:

* [Image 1](https://asset.vimmerse.net/vimmerse-test-user/db8352a9-fb57-4a09-bc4c-443cf3d17cf7/create_image/3142b191-ffe6-4115-b660-9f1d52518320.png)
* [Image 2](https://asset.vimmerse.net/vimmerse-test-user/db8352a9-fb57-4a09-bc4c-443cf3d17cf7/create_image/e7445ad6-ab9c-4055-b05c-01d40e95db62.png)

**Credits Consumed:** 32",
    #             "credits": 32,
    #             "image_urls": [
    #                 "https://asset.vimmerse.net/vimmerse-test-user/db8352a9-fb57-4a09-bc4c-443cf3d17cf7/create_image/3142b191-ffe6-4115-b660-9f1d52518320.png",
    #                 "https://asset.vimmerse.net/vimmerse-test-user/db8352a9-fb57-4a09-bc4c-443cf3d17cf7/create_image/e7445ad6-ab9c-4055-b05c-01d40e95db62.png"
    #             ],
    #             "timestamp": "2026-08-21T22:51:30Z"
    #         }
    #     ]
    # }

    # 2. Edit one of the image generations further in same session
    payload = {
        "agent_name": "vimi",
        "session_id": session_id,
        "prompt": "take the second photo and add floating strawberries around the person as it was showing in the original strawberry can photo.",
        "new_session": False
    }
    response = requests.post(url, headers=headers, json=payload, timeout=30)
    response.raise_for_status()
    print(f"
Edit initiated! Status: {response.json().get('status')}")

    # Poll session until edit completes
    session_data = poll_session(session_id)
    latest_turn = session_data["turns"][-1]
    print(f"Response: {latest_turn['text']}")
    print(f"Generated Images: {latest_turn.get('image_urls', [])}")

    # 3. Animate the resulted image into a video in same session
    payload = {
        "agent_name": "vimi",
        "session_id": session_id,
        "prompt": "animate the image into 10 sec video using Google Omni search that it appears as a professional marketing video for the product have the person feeling refreshed and energetic as she is drinking the can.",
        "new_session": False
    }
    response = requests.post(url, headers=headers, json=payload, timeout=30)
    response.raise_for_status()
    print(f"
Animation initiated! Status: {response.json().get('status')}")

    # Poll session until video generation completes (longer timeout for video rendering)
    session_data = poll_session(session_id, timeout=600)
    latest_turn = session_data["turns"][-1]
    print(f"Response: {latest_turn['text']}")
    print(f"Generated Videos: {latest_turn.get('video_urls', [])}")
    # Example Polled Session Result:
    # {
    #     "session_id": "b9ebe782-da5d-43ee-8297-1959965a2917",
    #     "agent_name": "vimi",
    #     "title": "Product ads",
    #     "visibility_status": "1",
    #     "status": "success",
    #     "user_id": "usr_8832",
    #     "customer_id": "vimmerse-test-user",
    #     "total_credits": 208,
    #     "turns": [
    #         ...,
    #         {
    #             "role": "model",
    #             "text": "Your 10-second commercial marketing video has been generated:

* [Watch the Video](https://asset.vimmerse.net/vimmerse-test-user/b11a2dc6-ce1b-4bd2-9bc2-238aa1adb081/batch/1/GoogleOmni/b11a2dc6-ce1b-4bd2-9bc2-238aa1adb081.mp4)

**Credits Consumed:** 160",
    #             "credits": 160,
    #             "video_urls": ["https://asset.vimmerse.net/vimmerse-test-user/b11a2dc6-ce1b-4bd2-9bc2-238aa1adb081/batch/1/GoogleOmni/b11a2dc6-ce1b-4bd2-9bc2-238aa1adb081.mp4"],
    #             "timestamp": "2026-08-21T22:54:43Z"
    #         }
    #     ]
    # }

except requests.exceptions.HTTPError as e:
    print(f"HTTP Error: {e}")
    if e.response is not None:
        print(f"Response: {e.response.text}")
except requests.exceptions.RequestException as e:
    print(f"Request failed: {e}")

Example 2: Create a story video of a kid dreaming to become a professional soccer player

import time
import requests
import json

BASE_URL = "https://api.vimmerse.net"
API_KEY = "YOUR_API_KEY"

url = f"{BASE_URL}/v2/agent"
headers = {"X-Api-Key": API_KEY, "Content-Type": "application/json"}

def poll_session(session_id, timeout=600, poll_interval=5):
    """Poll GET /v2/agent/{session_id} until status is success."""
    poll_url = f"{BASE_URL}/v2/agent/{session_id}"
    start_time = time.time()
    while time.time() - start_time < timeout:
        res = requests.get(poll_url, headers=headers, timeout=30)
        res.raise_for_status()
        session_data = res.json()
        status = session_data.get("status", "").lower()
        if status in ["success", "completed"]:
            return session_data
        elif status in ["failed", "error"]:
            raise RuntimeError(f"Session failed: {session_data}")
        print(f"Status is '{status}', waiting {poll_interval}s...")
        time.sleep(poll_interval)
    raise TimeoutError(f"Session {session_id} timed out after {timeout}s")

try:
    # 1. Create storyboard, character image, and the 3 scene images in a new session
    payload = {
        "agent_name": "vimi",
        "title": "Kid Dream",
        "prompt": "create a storyboard of 3 scenes for a kid dreaming about becoming a professional soccer player in pixar style. Create the character image then use it along with the scene prompts to create the 3 scene images.",
        "new_session": True
    }
    response = requests.post(url, headers=headers, json=payload, timeout=30)
    response.raise_for_status()
    result = response.json()
    session_id = result["session_id"]
    print(f"Session initiated! ID: {session_id}, Status: {result.get('status')}")

    # Poll session until storyboard and images are generated
    session_data = poll_session(session_id, timeout=600)
    latest_turn = session_data["turns"][-1]
    print(f"
Response: {latest_turn['text']}")
    # Example Polled Response shows character image and 3 scene images:
    # - Character: https://asset.vimmerse.net/.../5f813dac-8244-4d0e-b38f-b19f88bcf711.png
    # - Scene 1: https://asset.vimmerse.net/.../047c6b27-5002-4680-8a74-0d3052bcd276.png
    # - Scene 2: https://asset.vimmerse.net/.../058373c9-729e-4d65-ac6f-c955d9477428.png
    # - Scene 3: https://asset.vimmerse.net/.../e65308d4-e8ee-4a4b-9127-b50137ac12bd.png

    # 2. Use all 3 scene images in reference-to-video call to make 10 sec video in the same session
    payload = {
        "agent_name": "vimi",
        "session_id": session_id,
        "prompt": "Use these 3 scene images in reference-2-video call to make 10sec video using GoogleOmni. The video starts by the dream scene and ends with the celebration on the playground after all the hard work.",
        "new_session": False
    }
    response = requests.post(url, headers=headers, json=payload, timeout=30)
    response.raise_for_status()
    print(f"
Animation initiated! Status: {response.json().get('status')}")

    # Poll session until video generation completes
    session_data = poll_session(session_id, timeout=600)
    latest_turn = session_data["turns"][-1]
    print(f"
Response: {latest_turn['text']}")
    print(f"Generated Videos: {latest_turn.get('video_urls', [])}")
    # Example Response shows generated video:
    # - Video Link: https://asset.vimmerse.net/vimmerse-test-user/ai_videos/9751b022-6f42-4a77-ae71-a9590a979264/k1vl4cn.mp4

except requests.exceptions.HTTPError as e:
    print(f"HTTP Error: {e}")
    if e.response is not None:
        print(f"Response: {e.response.text}")
except requests.exceptions.RequestException as e:
    print(f"Request failed: {e}")

Example 3: List all sessions of a particular user

import requests
import json
import time

BASE_URL = "https://api.vimmerse.net"
API_KEY = "YOUR_API_KEY"

url = f"{BASE_URL}/v2/agent/sessions/vimi"
headers = {"X-Api-Key": API_KEY, "Content-Type": "application/json"}

try:
    response = requests.get(url, headers=headers, timeout=60)
    response.raise_for_status()
    result = response.json()
    sessions = result["sessions"]
    print(f"sessions: {sessions}")
    # Example Response
    # {
    #     "user_id": "basel",
    #     "sessions": [
    #         {
    #             "session_id": "b9ebe782-da5d-43ee-8297-1959965a2917",
    #             "agent_name": "vimi",
    #             "title": "Product Ads",
    #             "visibility_status": "1",
    #             "status": "success",
    #             "updated_at": "2026-08-21T22:54:43.128823+00:00",
    #             "total_credits": 208
    #         },
    #         {
    #             "session_id": "ac585e41-0b81-4b87-9d92-ad10392b6e7e",
    #             "agent_name": "vimi",
    #             "title": "Kid Dream",
    #             "visibility_status": "1",
    #             "status": "success",
    #             "updated_at": "2026-08-21T05:52:12.026459+00:00",
    #             "total_credits": 192
    #         }
    #     ]
    # }

except requests.exceptions.HTTPError as e:
    print(f"✗ HTTP Error: {e}")
    if e.response is not None:
        print(f"  Response: {e.response.text}")
    exit(1)
except requests.exceptions.RequestException as e:
    print(f"✗ Request failed: {e}")
    exit(1)

Engage Agent

POST /

Sends a prompt request to engage an agent, tracks credit usage, and updates or initializes a session context. Requests are processed asynchronously in the background by default.

Asynchronous Execution & Polling Flow

Media generation via agents is executed asynchronously:

  1. Initial Submission: A POST / request initializes or appends to a session. By default (or when async_mode: true), the API validates credit balance upfront and immediately returns HTTP 200 with status: "PROCESSING" and the assigned session_id.
  2. Polling: The client repeatedly queries GET /{session_id} every 3–5 seconds.
  3. Completion: When background execution completes, GET /{session_id} returns status: "SUCCESS". The final response and newly generated media URLs (image_urls, video_urls, audio_urls) will be available in the last element of turns (turns[-1]), as well as formatted within the agent's text response.
  4. Error Handling: If execution encounters an error, status changes to "FAILED".

Parameters

Field Location Type Required Default Description & Possible Values
prompt Body String Yes - Prompt text describing the video generation request. e.g., "Generate a 5-second futuristic city video."
agent_name Body String No "vimi" Target agent profile name. e.g., "vimi".
image_urls Body Array[String] No null Optional list of image reference URLs or Data URLs. e.g., ["https://example.com/ref.jpg"].
video_urls Body Array[String] No null Optional list of video reference URLs or Data URLs. e.g., ["https://example.com/ref.mp4"].
audio_urls Body Array[String] No null Optional list of audio reference URLs or Data URLs. e.g., ["https://example.com/ref.mp3"].
session_id Body String No null UUID of an existing session to maintain chat context. e.g., "123e4567-e89b-12d3-a456-426614174000".
title Body String No null Optional custom title for the session. e.g., "Futuristic City Project".
new_session Body Boolean No false Set to true to clear existing history and initiate a new session context. Possible values: true, false.
async_mode Body Boolean No true Optional (defaults to true). If true, returns immediately with status: "PROCESSING" and processes in the background while client polls GET /{session_id}. If false, blocks synchronously until complete.

Request Example

Post https://api.vimmerse.net/v2/agent

{
  "prompt": "Generate a 5-second futuristic city loop.",
  "agent_name": "vimi",
  "image_urls": ["https://example.com/concept.jpg"],
  "session_id": "123e4567-e89b-12d3-a456-426614174000",
  "title": "Futuristic City Project",
  "new_session": false,
  "async_mode": true
}

Response Example (200 OK)

{
  "session_id": "123e4567-e89b-12d3-a456-426614174000",
  "agent_name": "vimi",
  "title": "Futuristic City Project",
  "visibility_status": "1",
  "status": "PROCESSING",
  "user_id": "usr_8832",
  "customer_id": "cust_4410",
  "response": "Agent execution task has been submitted and is processing.",
  "credits_consumed_this_turn": 0,
  "total_session_credits_consumed": 20
}
SecurityAPIKeyHeader
Request
header Parameters
Authorization (string) or Authorization (null) (Authorization)
Username (string) or Username (null) (Username)
X-Client-Type (string) or X-Client-Type (null) (X-Client-Type)
Request Body schema: application/json
required
prompt
required
string (Prompt)

Prompt describing the generation request.

agent_name
string (Agent Name)
Default: "vimi"

Target agent profile name: 'vimi' or 'marco'

Array of Image Urls (strings) or Image Urls (null) (Image Urls)

Optional list of image reference URLs.

Array of Video Urls (strings) or Video Urls (null) (Video Urls)

Optional list of video reference URLs.

Array of Audio Urls (strings) or Audio Urls (null) (Audio Urls)

Optional list of audio reference URLs.

Session Id (string) or Session Id (null) (Session Id)

Existing session ID.

Title (string) or Title (null) (Title)

Optional custom session title.

Visibility Status (string) or Visibility Status (null) (Visibility Status)
Default: "1"

Session visibility: 0=private, 1=unlisted, 2=public

new_session
boolean (New Session)
Default: false

Set to true to clear context.

async_mode
boolean (Async Mode)
Default: true

Set to true (default) to process asynchronously in the background, or false to run synchronously.

Responses
200

Agent response

400

Bad Request

402

Insufficient Credit

422

Validation Error

post/v2/agent
Request samples
Response samples
application/json
{
  • "session_id": "123e4567-e89b-12d3-a456-426614174000",
  • "agent_name": "vimi",
  • "title": "Futuristic City Project",
  • "visibility_status": "1",
  • "status": "PROCESSING",
  • "user_id": "usr_8832",
  • "customer_id": "cust_4410",
  • "response": "Agent execution task has been submitted and is processing.",
  • "credits_consumed_this_turn": 0,
  • "total_session_credits_consumed": 20
}

List Agent Profiles

GET {BASE_URL}/v2/agent/catalog/profiles

Returns agent profiles the caller can switch between. Includes catalog agents (vimi, marco, stori) plus any extra agent_name values from the user's existing sessions.

Request Example

GET https://api.vimmerse.net/v2/agent/catalog/profiles

Response Example (200 OK)

{
  "agents": [
    {
      "name": "vimi",
      "display_name": "Vimi",
      "description": "Create and edit image and video content using Vimmerse tools.",
      "avatar_url": "https://distribution.vimmerse.net/presets/image/vimi.jpg"
    },
    {
      "name": "marco",
      "display_name": "Marco",
      "description": "Create viral social ads and UGC videos with Creatify.",
      "avatar_url": "https://distribution.vimmerse.net/presets/image/marco.jpg"
    },
    {
      "name": "stori",
      "display_name": "Stori",
      "description": "Create storyboards and vertical drama shorts.",
      "avatar_url": "https://distribution.vimmerse.net/presets/image/stori.jpg"
    }
  ]
}
SecurityAPIKeyHeader
Request
header Parameters
Authorization (string) or Authorization (null) (Authorization)
Username (string) or Username (null) (Username)
X-Client-Type (string) or X-Client-Type (null) (X-Client-Type)
Responses
200

Agent profiles

422

Validation Error

get/v2/agent/catalog/profiles
Request samples
Response samples
application/json
{}

Get Sessions of a User

GET {BASE_URL}/v2/agent/sessions/{agent_name}

Retrieves active sessions (up to 100) belonging to the calling user, filtered by agent profile and sorted by most recent.

Parameters

Field Location Type Required Default Description & Possible Values
agent_name Body String Yes "vimi" Target agent profile name to filter sessions by. e.g., "vimi".

Request Example

GET https://api.vimmerse.net/v2/agent/sessions/vimi

Response Example (200 OK)

{
  "user_id": "usr_8832",
  "sessions": [
    {
      "session_id": "123e4567-e89b-12d3-a456-426614174000",
      "agent_name": "vimi",
      "title": "Futuristic City Project",
      "visibility_status": "1",
      "status": "success",
      "updated_at": "2026-08-20T16:00:00Z",
      "total_credits": 20
    },
    {
        "session_id": "ac585e41-0b81-4b87-9d92-ad10392b6e7e",
        "agent_name": "vimi",
        "title": "Kid Dream",
        "visibility_status": "1",
        "status": "success",
        "updated_at": "2026-08-21T05:52:12.026459+00:00",
        "total_credits": 192
    }
  ]
}
SecurityAPIKeyHeader
Request
path Parameters
agent_name
required
string (Agent Name)
header Parameters
Authorization (string) or Authorization (null) (Authorization)
Username (string) or Username (null) (Username)
X-Client-Type (string) or X-Client-Type (null) (X-Client-Type)
Responses
200

Agent response

400

Bad Request

402

Insufficient Credit

422

Validation Error

get/v2/agent/sessions/{agent_name}
Request samples
Response samples
application/json
{
  • "user_id": "usr_8832",
  • "sessions": [
    ]
}

Get Session

GET /{session_id}

Retrieves complete context history and turns for a specific session owned by the authenticated user. When a request is running asynchronously, poll this endpoint until status becomes "success" (or "failed"). Once complete, generated media URLs appear in turns[-1].

Parameters

Field Location Type Required Default Description & Possible Values
session_id Path String Yes - Unique UUID of the target session. e.g., "123e4567-e89b-12d3-a456-426614174000".

Request Example

GET https://api.vimmerse.net/v2/agent/123e4567-e89b-12d3-a456-426614174000

Response Example (200 OK)

{
  "session_id": "123e4567-e89b-12d3-a456-426614174000",
  "agent_name": "vimi",
  "title": "Futuristic City Project",
  "visibility_status": "1",
  "status": "success",
  "user_id": "usr_8832",
  "customer_id": "cust_4410",
  "total_credits": 20,
  "updated_at": "2026-08-20T16:00:00Z",
  "turns": [
    {
      "role": "user",
      "text": "Generate a 5-second futuristic city loop.",
      "credits": 0,
      "image_urls": ["https://example.com/concept.jpg"],
      "video_urls": [],
      "audio_urls": [],
      "timestamp": "2026-08-20T15:58:00Z"
    },
    {
      "role": "agent",
      "text": "Rendering video based on provided prompt: [Watch Video](https://asset.vimmerse.net/vimmerse-test-user/ai_videos/123/city.mp4)",
      "credits": 20,
      "image_urls": [],
      "video_urls": ["https://asset.vimmerse.net/vimmerse-test-user/ai_videos/123/city.mp4"],
      "audio_urls": [],
      "timestamp": "2026-08-20T16:00:00Z"
    }
  ]
}
SecurityAPIKeyHeader
Request
path Parameters
session_id
required
string (Session Id)
header Parameters
Authorization (string) or Authorization (null) (Authorization)
Username (string) or Username (null) (Username)
X-Client-Type (string) or X-Client-Type (null) (X-Client-Type)
Responses
200

Agent response

400

Bad Request

402

Insufficient Credit

422

Validation Error

get/v2/agent/{session_id}
Request samples
Response samples
application/json
{
  • "session_id": "123e4567-e89b-12d3-a456-426614174000",
  • "agent_name": "vimi",
  • "title": "Futuristic City Project",
  • "visibility_status": "1",
  • "status": "success",
  • "user_id": "usr_8832",
  • "customer_id": "cust_4410",
  • "total_credits": 20,
  • "updated_at": "2026-08-20T16:00:00Z",
  • "turns": [
    ]
}

Update Session

PUT /{session_id}

Updates the attributes of a specific session owned by the authenticated user.

Parameters

Field Location Type Required Default Description & Possible Values
session_id Path String Yes - Unique UUID of the session to update. e.g., "123e4567-e89b-12d3-a456-426614174000".
title Body String No - Non-empty replacement title embedded in JSON body. e.g., "Updated Cyberpunk Scene".
visibility_status Body String No - Non-empty replacement visibility embedded in JSON body. e.g., 0 private, 1 unlisted, 2 public.
agent_name Body String No - Non-empty replacement agent_name embedded in JSON body. e.g., "vimi".

Request Example

PUT https://api.vimmerse.net/v2/agent/123e4567-e89b-12d3-a456-426614174000

{
  "title": "Updated Cyberpunk Scene",
  "visibility_status": "2"
}

Response Example (200 OK)

{
  "status": "success",
  "session_id": "123e4567-e89b-12d3-a456-426614174000",
  "title": "Updated Cyberpunk Scene",
  "visibility_status": "2",
  "agent_name": "vimi",
}
SecurityAPIKeyHeader
Request
path Parameters
session_id
required
string (Session Id)
header Parameters
Authorization (string) or Authorization (null) (Authorization)
Username (string) or Username (null) (Username)
X-Client-Type (string) or X-Client-Type (null) (X-Client-Type)
Request Body schema: application/json
required
Title (string) or Title (null) (Title)
Default: ""

Updated session title.

Visibility Status (string) or Visibility Status (null) (Visibility Status)
Default: "1"

Session visibility: 0=private, 1=unlisted, 2=public

Agent Name (string) or Agent Name (null) (Agent Name)
Default: "vimi"

Updated agent name.

Responses
200

Session info updated

400

Bad Request

403

Forbidden

404

Not Found

422

Validation Error

put/v2/agent/{session_id}
Request samples
Response samples
application/json
{
  • "status": "success",
  • "session_id": "123e4567-e89b-12d3-a456-426614174000",
  • "title": "Updated Cyberpunk Scene",
  • "visibility_status": "2",
  • "agent_name": "vimi"
}

Delete Session

DELETE /{session_id}

Permanently removes a session record and its turn history from the database.

Parameters

Field Location Type Required Default Description & Possible Values
session_id Path String Yes - Unique UUID of the target session to delete. e.g., "123e4567-e89b-12d3-a456-426614174000".

Request Example

DELETE https://api.vimmerse.net/v2/agent/123e4567-e89b-12d3-a456-426614174000

Response Example (200 OK)

{
  "status": "success",
  "session_id": "123e4567-e89b-12d3-a456-426614174000"
}
SecurityAPIKeyHeader
Request
path Parameters
session_id
required
string (Session Id)
header Parameters
Authorization (string) or Authorization (null) (Authorization)
Username (string) or Username (null) (Username)
X-Client-Type (string) or X-Client-Type (null) (X-Client-Type)
Responses
200

Agent response

400

Bad Request

402

Insufficient Credit

422

Validation Error

delete/v2/agent/{session_id}
Request samples
Response samples
application/json
{
  • "status": "success",
  • "session_id": "123e4567-e89b-12d3-a456-426614174000"
}

Get Sessions of a Customer

GET /{customer_id}/sessions Admin endpoint to list all user sessions registered under a specific customer account, ordered by most recently updated.

Parameters

Field Location Type Required Default Description & Possible Values
customer_id Path String Yes - Unique identifier of the target customer account. e.g., "cust_4410".

Request Example

GET https://api.vimmerse.net/v2/agent/cust_4410/sessions

Response Example (200 OK)

{
  "customer_id": "cust_4410",
  "sessions": [
    {
      "session_id": "123e4567-e89b-12d3-a456-426614174000",
      "agent_name": "vimi",
      "user_id": "usr_8832",
      "title": "Updated Cyberpunk Scene",
      "visibility_status": "1",
      "status": "success",
      "total_credits": 20,
      "updated_at": "2026-08-20T16:00:00Z"
    }
  ]
}
SecurityAPIKeyHeader
Request
path Parameters
customer_id
required
string (Customer Id)
header Parameters
Authorization (string) or Authorization (null) (Authorization)
Username (string) or Username (null) (Username)
X-Client-Type (string) or X-Client-Type (null) (X-Client-Type)
Responses
200

Agent response

400

Bad Request

402

Insufficient Credit

422

Validation Error

get/v2/agent/{customer_id}/sessions
Request samples
Response samples
application/json
{
  • "customer_id": "cust_4410",
  • "sessions": [
    ]
}