# 3D jobs

Generate 3D models from text or images as a job, and download GLB, OBJ or FBX files.

A 3D model takes a few minutes, so it runs as a job, exactly like [video](https://ewest.ai/docs/video). `POST /v1/3d/generations` returns `202` with a job; follow it with `GET /v1/jobs/{id}/events`, poll `GET /v1/jobs/{id}`, or pass a `webhook_url`.

## The request

| Field | What it does |
| --- | --- |
| ``model`` | The model id, for example `ewest/hunyuan-3d-3.1-pro`. |
| ``prompt`` | Text to 3D. Send `prompt` or `image_url`, never both. |
| ``image_url`` | Image to 3D: a public `https://` address of the front view (JPEG, PNG or WebP). Hunyuan 3D: 128 to 5,000 px, up to 8 MB. Tripo H3.1: up to 20 MB. |
| ``view_images`` | Hunyuan 3D only. Extra views as an object: `back`, `left`, `right`, `top`, `bottom`, `left_front`, `right_front`, each a public https address (JPEG or PNG). Needs `image_url`. |
| ``generate_type`` | `normal` (textured, default) or `geometry` (untextured). |
| ``enable_pbr`` | Add PBR material textures. Not with `geometry`. Default: off for Hunyuan 3D (a fixed extra charge), on for Tripo H3.1 (no extra charge). |
| ``face_count`` | Target polygon count. Hunyuan 3D: 40,000 to 1,500,000 (default 500,000). Tripo H3.1: 1,000 to 2,000,000, chosen by the model when left out; above 1,500,000 needs `geometry_quality: detailed`, and a quad mesh has at most 150,000. |
| ``texture_quality`` | Tripo H3.1 only. `standard` (default) or `detailed` (HD, higher-resolution textures, costs more). Not with `geometry`. |
| ``geometry_quality`` | Tripo H3.1 only. `standard` (default) or `detailed` (finer geometry, costs more). |
| ``quad`` | Tripo H3.1 only. A quad (four-sided) mesh instead of triangles, costs more. The mesh comes as an FBX file and there is no GLB; without `face_count` it has 10,000 faces. |
| ``negative_prompt`` | Tripo H3.1 only, with `prompt`. What to avoid, up to 255 characters. |
| ``seed`` | Tripo H3.1 only. An integer from 0 to 2,147,483,647 that makes the result repeatable. |
| ``auto_size`` | Tripo H3.1 only. Scale the model to real-world size in meters. |
| ``orientation`` | Tripo H3.1 only, with `image_url`. `default` or `align_image` (turn the model to match the image). |
| ``texture_alignment`` | Tripo H3.1 only, with `image_url`. `original_image` (default) or `geometry`. |

A `geometry` model is cheaper than a textured one. On Hunyuan 3D, `view_images`, `enable_pbr` and a `face_count` other than the default each add a fixed amount to the price of a generation, however many views you send. On Tripo H3.1 the price depends on text or image input, the texture level, `geometry_quality: detailed` and `quad`; PBR, face count and the other options are free. An option a model does not take is a `400`. The model page lists the exact prices.

## The result

When the job has `succeeded`, `output.url` is the GLB file (the FBX file for a quad mesh) and `output.files` lists every file by format (`glb`, `pbr_glb` for Tripo H3.1, `fbx`, and as the model returns them `obj` with its `mtl` and `texture`, and others), each with its `url`, `content_type` and `size`. `output.thumbnail_url` is a preview image. All files are on `cdn.ewest.ai` for 7 days. Files are tens of megabytes: download them, do not hotlink them. If any file cannot be stored, the job ends as `failed` with `storage_error` and is not billed.

cURL:

```bash
# 1. Create the job (text to 3D; send "image_url" instead of "prompt" to build from an image)
curl https://api.ewest.ai/v1/3d/generations \
  -H "Authorization: Bearer $EWEST_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "ewest/hunyuan-3d-3.1-pro", "prompt": "a ceramic teapot with a bamboo handle", "enable_pbr": true}'
# → 202 {"id": "job_…", "type": "3d", "status": "queued", "progress": 0, …}

# 2. Follow it (Server-Sent Events), or poll GET /v1/jobs/job_…
curl -N https://api.ewest.ai/v1/jobs/job_…/events -H "Authorization: Bearer $EWEST_KEY"
# → … "output": {"url": "https://cdn.ewest.ai/3d/….glb", "files": {"glb": {…}, "obj": {…}}}
```

Python:

```python
import os, time, requests

H = {"Authorization": f"Bearer {os.environ['EWEST_KEY']}"}
job = requests.post("https://api.ewest.ai/v1/3d/generations", headers=H, json={"model": "ewest/hunyuan-3d-3.1-pro", "prompt": "a ceramic teapot with a bamboo handle", "enable_pbr": True}).json()
while job["status"] not in ("succeeded", "failed"):
    time.sleep(5)
    job = requests.get(f"https://api.ewest.ai/v1/jobs/{job['id']}", headers=H).json()
    print(job["status"], job["progress"])
print(job["output"]["files"] if job["output"] else job["error"])  # the files by format (glb, ...)
```

JavaScript:

```javascript
const H = { Authorization: `Bearer ${process.env.EWEST_KEY}`, "Content-Type": "application/json" };
let job = await (await fetch("https://api.ewest.ai/v1/3d/generations", {
  method: "POST", headers: H, body: JSON.stringify({ "model": "ewest/hunyuan-3d-3.1-pro", "prompt": "a ceramic teapot with a bamboo handle", enable_pbr: true }),
})).json();
while (!["succeeded", "failed"].includes(job.status)) {
  await new Promise((r) => setTimeout(r, 5000));
  job = await (await fetch(`https://api.ewest.ai/v1/jobs/${job.id}`, { headers: H })).json();
}
console.log(job.output?.files ?? job.error);
```

Source: https://ewest.ai/docs/3d
