1. Submit the JPEG URL
Submit one image task with a public JPEG URL. Keep the returned task ID and do not create another task while this one is processing.
export TO3D_KEY='YOUR_API_KEY'
export TO3D_IMAGE_URL='https://example.com/product.jpg'
TASK_JSON=$(curl --fail-with-body --silent --show-error \
https://api.to3d.app/api/trellis/tasks \
-H "x-api-key: $TO3D_KEY" \
-H 'Content-Type: application/json' \
-d "$(jq -cn --arg image "$TO3D_IMAGE_URL" \
'{task_type:"image-to-3d",input:{image:$image}}')")
TASK_ID=$(jq -er '.id' <<<"$TASK_JSON")
printf 'Task: %s\n' "$TASK_ID"Poll and download the GLB
Poll without creating another task. When the task succeeds, save the returned model URL and download the GLB.
while :; do
STATUS_JSON=$(curl --fail-with-body --silent --show-error \
"https://api.to3d.app/api/trellis/tasks/$TASK_ID" \
-H "x-api-key: $TO3D_KEY")
STATUS=$(jq -er '.status' <<<"$STATUS_JSON")
case "$STATUS" in
succeeded) jq -er '.output.model_file' <<<"$STATUS_JSON" > model-url.txt; break ;;
failed|canceled) jq '{id,status,error}' <<<"$STATUS_JSON" >&2; exit 1 ;;
pending|processing) sleep 5 ;;
*) printf 'Unexpected status: %s\n' "$STATUS" >&2; exit 1 ;;
esac
done
curl --fail --location --silent --show-error \
"$(cat model-url.txt)" --output product.glb
[ "$(head -c 4 product.glb)" = 'glTF' ]2. Inspect before putting it in an AR viewer
Open `product.glb` in a GLB-capable viewer first. Check that the product silhouette, visible materials, UVs, and texture are usable for your scene. Set a real-world scale in your own pipeline; a single JPEG does not establish dimensions.
- If your AR target requires another format or a platform-specific anchor, perform and test that conversion in the target toolchain.
3. Validate on the target device
Run the viewer on the phones, browsers, or headsets you support. Check download size, lighting, texture resolution, camera placement, occlusion, interaction, and frame rate.
- #56 did not verify USDZ output, physical scale, AR anchors, or any AR device. This article describes a repeatable starting workflow, not a claim that a JPEG becomes a calibrated AR product asset automatically.
Keep the sample evidence in scope
The four public sample GLBs provide structure examples with embedded PNG textures, UVs, joints, and skin weights. A product model may not need a rig; skip Skin Tokens unless your object needs a skeleton.
- Keep the original JPEG, API task ID, downloaded GLB, and any converted AR asset together so a later visual or scale issue can be traced to the right step.