Skip to content

Text-To-Motion

The Generate Contents API lets you submit motion-generation prompts programmatically and retrieve results once they're ready — the same flow used by the MOASIS web chat, exposed for integration into your own application. New to the API? Start with the Quick Start for a minimal end-to-end example.

Authentication

Every request must include an API key with the CHAT scope in the Authorization header:

Authorization: Bearer sk-<your-api-key>

See API Key Management for how to create a key. All endpoints below are relative to your MOASIS instance's base URL, e.g. http://mohub-dev.vgentx.com/api/v1.

Overview

Generation is asynchronous:

  1. Submit a prompt with POST /chat/generate. This creates a new conversation and immediately returns a conversationId — it does not wait for generation to finish.
  2. The agent works in the background, creating one or more tasks as it processes your prompt, then closes out the turn once it's done responding.
  3. Retrieve results by polling either:
    • GET /chat/generate/tasks/:taskId if you already know the task ID, or
    • GET /chat/generate/conversation/:conversationId/tasks to discover which tasks were created and fetch their results in one call.

Submit a Prompt

POST /chat/generate

Body

FieldTypeRequiredDescription
messagestringYesYour generation prompt.
parametersobjectNoGeneration parameters (see below). Omit entirely to use the defaults.
parameters.modeMotion | RenderNoGeneration mode. Defaults to Motion.
parameters.modelGlide | RhythmNoGeneration model. Defaults to Glide.

Example

bash
curl -X POST http://mohub-dev.vgentx.com/api/v1/chat/generate \
  -H "Authorization: Bearer sk-<your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"message": "Generate a relaxing lo-fi track", "parameters": {"mode": "Motion", "model": "Glide"}}'

Response

json
{
  "data": {
    "conversationId": "5f0b1e2a-..."
  }
}

Save the conversationId — you'll need it to poll for results.

Poll a Single Task

GET /chat/generate/tasks/:taskId

Returns the current status of a task. While the task is running, contents is omitted. Once status is COMPLETED, contents is populated with presigned download URLs.

Example

bash
curl http://mohub-dev.vgentx.com/api/v1/chat/generate/tasks/<taskId> \
  -H "Authorization: Bearer sk-<your-api-key>"

Response while running

json
{
  "data": {
    "id": "f3a9...",
    "status": "PROCESSING"
  }
}

Response when completed

json
{
  "data": {
    "id": "f3a9...",
    "status": "COMPLETED",
    "contents": [
      {
        "id": "c1b2...",
        "title": "lo-fi-track-01",
        "fileSize": 2048391,
        "thumbnailUrl": "https://...",
        "metadata": { "duration": 32.5 },
        "presignedUrl": "https://..."
      }
    ]
  }
}

Possible status values: PENDING, PROCESSING, UPLOADING, POLISHING, COMPLETED, FAILED, CANCELLED. On FAILED, check errorMessage for details.

List Tasks from a Conversation

GET /chat/generate/conversation/:conversationId/tasks

Returns the tasks created during the most recently completed turn of a conversation — useful right after POST /chat/generate when you don't yet have a taskId to poll directly. Each entry has the same shape as the single-task response above.

Example

bash
curl http://mohub-dev.vgentx.com/api/v1/chat/generate/conversation/<conversationId>/tasks \
  -H "Authorization: Bearer sk-<your-api-key>"

While the agent is still working on your request:

json
{
  "data": {
    "message": "The agent is still processing your request.",
    "tasks": []
  }
}

Once the turn has completed:

json
{
  "data": {
    "tasks": [
      { "id": "f3a9...", "status": "COMPLETED", "contents": [ /* ... */ ] }
    ]
  }
}

Keep polling this endpoint (e.g. every few seconds) until message is absent and tasks is non-empty, then inspect each task's status as described above.