> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Create 3D Model

> Creates a 3D model generation task

<Note>
  For coding agents, discover the current recommended 3D shortlist first with `GET /v1/models?recommended_for=3d`, then send the selected `model` explicitly to this endpoint.
</Note>

Generate 3D models from text or images using Tripo3D and other providers. This is an asynchronous API. Create responses return a task identity, and may also return a preferred `poll_url` for status checks.

Public 3D operations are inferred from the request shape: prompt-only requests resolve to `text-to-3d`, and requests with `image` or `image_url` resolve to `image-to-3d`. This endpoint does not expose an `operation` request field; do not send the legacy `3d-generation` value.

## Request Body

<ParamField body="model" type="string" default="tripo-h3.1">
  Model to use, for example `tripo-h3.1` or `tripo-p1.0`. Query `GET /v1/models?recommended_for=3d` before relying on a specific input type or output format.
</ParamField>

<ParamField body="prompt" type="string" required>
  Text description of the 3D model to generate.
</ParamField>

<ParamField body="image" type="string">
  Base64-encoded image for image-to-3D generation.
</ParamField>

<ParamField body="image_url" type="string">
  URL of image for image-to-3D generation.
</ParamField>

<ParamField body="format" type="string" default="glb">
  Output format: `glb`, `fbx`, `obj`, or `usdz`.
</ParamField>

<ParamField body="quality" type="string" default="standard">
  Quality level: `draft`, `standard`, or `high`.
</ParamField>

<ParamField body="style" type="string">
  Style preset for the model.
</ParamField>

<ParamField body="seed" type="integer">
  Seed for reproducible generation.
</ParamField>

<ParamField body="user" type="string">
  A unique identifier for the end-user.
</ParamField>

## Response

<ResponseField name="id" type="string">
  Task ID for polling status.
</ResponseField>

<ResponseField name="task_id" type="string">
  Async task identifier alias when returned by the adapter.
</ResponseField>

<ResponseField name="poll_url" type="string">
  Preferred polling URL for this task when provided.
</ResponseField>

<ResponseField name="status" type="string">
  Task status: `pending`, `processing`, `completed`, or `failed`.
</ResponseField>

<ResponseField name="created" type="integer">
  Unix timestamp of task creation.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.tokenlab.sh/v1/3d/generations" \
    -H "Authorization: Bearer sk-your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "tripo-h3.1",
      "prompt": "A detailed medieval castle with towers",
      "format": "glb",
      "quality": "high"
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.tokenlab.sh/v1/3d/generations",
      headers={"Authorization": "Bearer sk-your-api-key"},
      json={
          "model": "tripo-h3.1",
          "prompt": "A detailed medieval castle with towers",
          "format": "glb",
          "quality": "high"
      }
  )

  task_id = response.json()["id"]
  print(f"Task ID: {task_id}")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.tokenlab.sh/v1/3d/generations', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk-your-api-key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      model: 'tripo-h3.1',
      prompt: 'A detailed medieval castle with towers',
      format: 'glb',
      quality: 'high'
    })
  });

  const data = await response.json();
  console.log(`Task ID: ${data.id}`);
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "net/http"
  )

  func main() {
      payload := map[string]interface{}{
          "model":   "tripo-h3.1",
          "prompt":  "A detailed medieval castle with towers",
          "format":  "glb",
          "quality": "high",
      }
      body, _ := json.Marshal(payload)

      req, _ := http.NewRequest("POST", "https://api.tokenlab.sh/v1/3d/generations", bytes.NewBuffer(body))
      req.Header.Set("Authorization", "Bearer sk-your-api-key")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, _ := client.Do(req)
      defer resp.Body.Close()

      var result map[string]interface{}
      json.NewDecoder(resp.Body).Decode(&result)
      fmt.Printf("Task ID: %s\n", result["id"])
  }
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://api.tokenlab.sh/v1/3d/generations');

  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_POST => true,
      CURLOPT_HTTPHEADER => [
          'Content-Type: application/json',
          'Authorization: Bearer sk-your-api-key'
      ],
      CURLOPT_POSTFIELDS => json_encode([
          'model' => 'tripo-h3.1',
          'prompt' => 'A detailed medieval castle with towers',
          'format' => 'glb',
          'quality' => 'high'
      ])
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  $data = json_decode($response, true);
  echo "Task ID: " . $data['id'];
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "task_id": "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "poll_url": "/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "status": "pending",
    "created": 1706000000,
    "model": "tripo-h3.1"
  }
  ```
</ResponseExample>
