API de Rigging

A API de Rigging permite adicionar programaticamente um esqueleto (armature) a modelos humanoides 3D, vinculando a malha a ele para que estejam prontos para animação. Para aplicar animações a um personagem com rig, consulte a API de Animação.

Observe que o rigging programático atualmente só funciona bem com assets humanoides (bípedes) padrão com membros e estrutura corporal claramente definidos neste momento.


POST/openapi/v1/rigging

Criar uma tarefa de rigging

Este endpoint permite criar uma nova tarefa de rigging para um determinado modelo 3D. Após a conclusão bem-sucedida, ele fornece um personagem com rig em formatos padrão e, opcionalmente, animações básicas de caminhada/corrida.

Atualmente, o auto-rigging não é adequado para os seguintes modelos:

  • Malhas sem textura
  • Assets não humanoides
  • Assets humanoides com estrutura de membros e corpo pouco clara

Parâmetros

  • Name
    input_task_id
    Type
    string
    Obrigatório
    Description

    A tarefa de entrada que precisa receber rigging. Atualmente, oferecemos suporte a modelos humanoides texturizados.

  • Name
    model_url
    Type
    string
    Obrigatório
    Description

    Forneça um modelo 3D para a Meshy aplicar rig por meio de uma URL acessível publicamente ou Data URI. Atualmente, oferecemos suporte a arquivos GLB humanoides texturizados (formato .glb).

  • Name
    height_meters
    Type
    number
    padrão 1.7
    Description

    A altura aproximada do modelo do personagem em metros. Isso ajuda na precisão de escala e rigging. Deve ser um número positivo.

  • Name
    texture_image_url
    Type
    string
    Description

    A imagem de textura de cor base com UV desembrulhado do modelo. URL acessível publicamente ou Data URI. Atualmente, oferecemos suporte a formatos .png.

Retornos

A propriedade result da resposta contém o id da tarefa de rigging recém-criada.

Modos de falha

  • Name
    400 - Bad Request
    Description

    A solicitação não foi aceitável. Causas comuns:

    • Parâmetro ausente: model_url ou input_task_id deve ser fornecido.
    • Formato de modelo inválido: O model_url aponta para um arquivo com uma extensão não compatível (somente .glb é compatível).
    • URL inacessível: Não foi possível baixar o model_url.
    • Tarefa de entrada inválida: O input_task_id não se refere a uma tarefa de API válida.
    • Contagem de faces excedida: O modelo de entrada tem mais de 300.000 faces. Use a API Remesh para reduzir a contagem de faces antes do rigging.
  • Name
    401 - Unauthorized
    Description

    Falha na autenticação. Verifique sua chave de API.

  • Name
    402 - Payment Required
    Description

    Créditos insuficientes para executar esta tarefa.

  • Name
    422 - Unprocessable Entity
    Description

    Falha na estimativa de pose. O modelo fornecido pode não ser um personagem humanoide válido.

  • Name
    429 - Too Many Requests
    Description

    Você excedeu seu limite de taxa.

Request

POST
/openapi/v1/rigging
# Rig a model from a URL
curl https://api.meshy.ai/openapi/v1/rigging \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "model_url": "YOUR_MODEL_URL_OR_DATA_URI",
    "height_meters": 1.8
  }'

Response

{
  "result": "018b314a-a1b5-716d-c222-2f1776f7f579"
}

GET/openapi/v1/rigging/:id

Recuperar uma tarefa de rigging

Este endpoint permite recuperar uma tarefa de rigging dado um id de tarefa válido. Consulte O objeto da tarefa de rigging para ver quais propriedades estão incluídas.

Parâmetros

  • Name
    id
    Type
    path
    Description

    Identificador único da tarefa de rigging a ser recuperada.

Retornos

A resposta contém o objeto Rigging Task. Consulte a seção O objeto da tarefa de rigging para obter detalhes.

Request

GET
/openapi/v1/rigging/018b314a-a1b5-716d-c222-2f1776f7f579
curl https://api.meshy.ai/openapi/v1/rigging/018b314a-a1b5-716d-c222-2f1776f7f579 
  -H "Authorization: Bearer ${YOUR_API_KEY}"

Response

{
  "id": "018b314a-a1b5-716d-c222-2f1776f7f579",
  "type": "rig",
  "status": "SUCCEEDED",
  "created_at": 1747032400453,
  "progress": 100,
  "started_at": 1747032401314,
  "finished_at": 1747032418417,
  "expires_at": 1747291618417,
  "task_error": {

    "message": ""

  },

  "consumed_credits": 5,
  "result": {
    "rigged_character_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Character_output.fbx?Expires=...",
    "rigged_character_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Character_output.glb?Expires=...",
    "basic_animations": {
      "walking_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin.glb?Expires=...",
      "walking_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin.fbx?Expires=...",
      "walking_armature_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin_armature.glb?Expires=...",
      "running_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin.glb?Expires=...",
      "running_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin.fbx?Expires=...",
      "running_armature_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin_armature.glb?Expires=..."
    }
  },
  "preceding_tasks": 0
}

DELETE/openapi/v1/rigging/:id

Excluir uma tarefa de rigging

Este endpoint exclui permanentemente uma tarefa de rigging, incluindo todos os modelos e dados associados. Esta ação é irreversível.

Parâmetros de caminho

  • Name
    id
    Type
    path
    Description

    O ID da tarefa de rigging a ser excluída.

Retornos

Retorna 200 OK em caso de sucesso.

Request

DELETE
/openapi/v1/rigging/018b314a-a1b5-716d-c222-2f1776f7f579
curl --request DELETE \
  --url https://api.meshy.ai/openapi/v1/rigging/018b314a-a1b5-716d-c222-2f1776f7f579 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

Response

// Returns 200 Ok on success.

GET/openapi/v1/rigging/:id/stream

Transmitir uma tarefa de rigging

Este endpoint transmite atualizações em tempo real para uma tarefa de rigging usando Server-Sent Events (SSE).

Parâmetros

  • Name
    id
    Type
    path
    Description

    Identificador único da tarefa de rigging a ser transmitida.

Retornos

Retorna um stream de objetos de tarefa de rigging como Server-Sent Events.

Para tarefas PENDING ou IN_PROGRESS, o stream da resposta incluirá apenas os campos necessários progress e status.

Request

GET
/openapi/v1/rigging/018b314a-a1b5-716d-c222-2f1776f7f579/stream
curl -N https://api.meshy.ai/openapi/v1/rigging/018b314a-a1b5-716d-c222-2f1776f7f579/stream 
-H "Authorization: Bearer ${YOUR_API_KEY}"

Response Stream

// Error event example
event: error
data: {
  "status_code": 404,
  "message": "Task not found"
}

// Message event examples illustrate task progress.
// For PENDING or IN_PROGRESS tasks, the response stream will not include all fields.
event: message
data: {
  "id": "018b314a-a1b5-716d-c222-2f1776f7f579",
  "progress": 0,
  "status": "PENDING"
}

event: message
data: {
  "id": "018b314a-a1b5-716d-c222-2f1776f7f579",
  "progress": 50,
  "status": "IN_PROGRESS"
}

event: message
data: { // Example of a SUCCEEDED task stream item, mirroring The Rigging Task Object structure
  "id": "018b314a-a1b5-716d-c222-2f1776f7f579",
  "type": "rig",
  "status": "SUCCEEDED",
  "created_at": 1747032400453,
  "progress": 100,
  "started_at": 1747032401314,
  "finished_at": 1747032418417,
  "expires_at": 1747291618417,
  "task_error": {

    "message": ""

  },

  "consumed_credits": 5,
  "result": {
    "rigged_character_fbx_url": "https://assets.meshy.ai/.../Character_output.fbx?...",
    "rigged_character_glb_url": "https://assets.meshy.ai/.../Character_output.glb?...",
    "basic_animations": {
      "walking_glb_url": "https://assets.meshy.ai/.../Animation_Walking_withSkin.glb?...",
      "walking_fbx_url": "https://assets.meshy.ai/.../Animation_Walking_withSkin.fbx?...",
      "walking_armature_glb_url": "https://assets.meshy.ai/.../Animation_Walking_withSkin_armature.glb?...",
      "running_glb_url": "https://assets.meshy.ai/.../Animation_Running_withSkin.glb?...",
      "running_fbx_url": "https://assets.meshy.ai/.../Animation_Running_withSkin.fbx?...",
      "running_armature_glb_url": "https://assets.meshy.ai/.../Animation_Running_withSkin_armature.glb?..."
    }
  },
  "preceding_tasks": 0
}

O objeto de tarefa de rigging

O objeto Rigging Task representa a unidade de trabalho para fazer o rigging de um personagem.

Propriedades

  • Name
    id
    Type
    string
    Description

    Identificador exclusivo da tarefa.

  • Name
    type
    Type
    string
    Description

    Tipo da tarefa de Rigging. O valor é rig.

  • Name
    status
    Type
    string
    Description

    Status da tarefa. Valores possíveis: PENDING, IN_PROGRESS, SUCCEEDED, FAILED, CANCELED.

  • Name
    progress
    Type
    integer
    Description

    progress da tarefa (0-100). 0 se não iniciada, 100 se bem-sucedida.

  • Name
    created_at
    Type
    timestamp
    Description

    Carimbo de data/hora (milissegundos desde a época Unix) de quando a tarefa foi criada.

  • Name
    started_at
    Type
    timestamp
    Description

    Carimbo de data/hora (milissegundos desde a época Unix) de quando a tarefa começou a ser processada. 0 se não iniciada.

  • Name
    finished_at
    Type
    timestamp
    Description

    Carimbo de data/hora (milissegundos desde a época Unix) de quando a tarefa foi concluída. 0 se não concluída.

  • Name
    expires_at
    Type
    timestamp
    Description

    Carimbo de data/hora (milissegundos desde a época Unix) de quando os assets de resultado da tarefa expiram e podem ser excluídos.

  • Name
    task_error
    Type
    object
    Description

    Detalhes do erro para tarefas com falha. Consulte Erros para a referência completa do objeto task_error.

  • Name
    consumed_credits
    Type
    integer
    Description

    O número de créditos consumidos por esta tarefa. Presente quando o status da tarefa é PENDING, IN_PROGRESS ou SUCCEEDED. Retorna 0 para tarefas FAILED (os créditos são reembolsados em caso de falha).

  • Name
    result
    Type
    object
    Description

    Contém as URLs dos assets de saída se a tarefa tiver SUCCEEDED; caso contrário, null.

    • Name
      rigged_character_fbx_url
      Type
      string
      Description

      URL baixável para o personagem com rigging no formato FBX.

    • Name
      rigged_character_glb_url
      Type
      string
      Description

      URL baixável para o personagem com rigging no formato GLB.

    • Name
      basic_animations
      Type
      object (optional)
      Description

      Contém URLs para animações padrão. (por exemplo, se generate_basic_animations estava implicitamente true ou habilitado por padrão).

      • Name
        walking_glb_url
        Type
        string
        Description
        URL baixável para a animação de caminhada no formato GLB (com skin).
      • Name
        walking_fbx_url
        Type
        string
        Description
        URL baixável para a animação de caminhada no formato FBX (com skin).
      • Name
        walking_armature_glb_url
        Type
        string
        Description
        URL baixável para a armature da animação de caminhada no formato GLB.
      • Name
        running_glb_url
        Type
        string
        Description
        URL baixável para a animação de corrida no formato GLB (com skin).
      • Name
        running_fbx_url
        Type
        string
        Description
        URL baixável para a animação de corrida no formato FBX (com skin).
      • Name
        running_armature_glb_url
        Type
        string
        Description
        URL baixável para a armature da animação de corrida no formato GLB.
  • Name
    preceding_tasks
    Type
    integer
    Description

    A contagem de tarefas anteriores na fila. Significativo apenas se o status for PENDING.

Example Rigging Task Object

{
  "id": "018b314a-a1b5-716d-c222-2f1776f7f579",
  "type": "rig",
  "status": "SUCCEEDED",
  "created_at": 1747032400453,
  "progress": 100,
  "started_at": 1747032401314,
  "finished_at": 1747032418417,
  "expires_at": 1747291618417,
  "task_error": {

    "message": ""

  },

  "consumed_credits": 5,
  "result": {
    "rigged_character_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Character_output.fbx?Expires=...",
    "rigged_character_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Character_output.glb?Expires=...",
    "basic_animations": {
      "walking_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin.glb?Expires=...",
      "walking_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin.fbx?Expires=...",
      "walking_armature_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin_armature.glb?Expires=...",
      "running_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin.glb?Expires=...",
      "running_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin.fbx?Expires=...",
      "running_armature_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin_armature.glb?Expires=..."
    }
  },
  "preceding_tasks": 0
}