> ## 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.

# 3D 모델 생성

> 3D 모델 생성 작업을 생성합니다

Tripo3D 및 기타 제공업체를 사용하여 텍스트 또는 이미지에서 3D 모델을 생성합니다. 이 API는 비동기 방식으로 동작합니다. 생성 응답은 작업 ID를 반환하며, 사용 가능할 때는 우선 사용해야 하는 `poll_url` 도 함께 반환할 수 있습니다.

공개 3D operation은 요청 형태에서 추론됩니다. `prompt`만 있는 요청은 `text-to-3d`, `image` 또는 `image_url`이 있는 요청은 `image-to-3d`로 처리됩니다. 이 endpoint는 `operation` 요청 필드를 노출하지 않으므로 legacy `3d-generation` 값을 보내지 마십시오.

## 요청 본문

<ParamField body="model" type="string" default="tripo-h3.1">
  사용할 모델입니다. 예: `tripo-h3.1` 또는 `tripo-p1.0`. 특정 입력 유형이나 출력 형식에 의존하기 전에 `GET /v1/models?recommended_for=3d`를 확인하세요.
</ParamField>

<ParamField body="prompt" type="string" required>
  생성할 3D 모델에 대한 텍스트 설명입니다.
</ParamField>

<ParamField body="image" type="string">
  image-to-3D 생성을 위한 Base64 인코딩된 이미지입니다.
</ParamField>

<ParamField body="image_url" type="string">
  image-to-3D 생성을 위한 이미지 URL입니다.
</ParamField>

<ParamField body="format" type="string" default="glb">
  출력 형식: `glb`, `fbx`, `obj` 또는 `usdz`.
</ParamField>

<ParamField body="quality" type="string" default="standard">
  품질 수준: `draft`, `standard` 또는 `high`.
</ParamField>

<ParamField body="style" type="string">
  모델의 스타일 프리셋입니다.
</ParamField>

<ParamField body="seed" type="integer">
  재현 가능한 생성을 위한 시드(Seed) 값입니다.
</ParamField>

<ParamField body="user" type="string">
  최종 사용자를 위한 고유 식별자입니다.
</ParamField>

## 응답

<ResponseField name="id" type="string">
  상태 폴링을 위한 작업 ID입니다.
</ResponseField>

<ResponseField name="task_id" type="string">
  어댑터가 반환하는 경우의 비동기 작업 ID 별칭입니다.
</ResponseField>

<ResponseField name="poll_url" type="string">
  사용 가능할 때 반환되는 우선 폴링 URL입니다.
</ResponseField>

<ResponseField name="status" type="string">
  작업 상태: `pending`, `processing`, `completed` 또는 `failed`.
</ResponseField>

<ResponseField name="created" type="integer">
  작업이 생성된 Unix 타임스탬프입니다.
</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>
