# generate3DModel

<!-- DO NOT EDIT: this page is autogenerated from the type comments -->

```ts
function generate3DModel<TAdapter, TStream, TWait>(options): Model3DActivityResult<TStream, TWait>;
```

Defined in: [packages/ai/src/activities/generate3DModel/index.ts:262](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/generate3DModel/index.ts#L262)

**`Experimental`**

Generate a 3D model from text, images, or an existing mesh.

Generation is a job. With no flag, the call submits the job and returns
`{ jobId, model }`; read it later with [get3DModelJobStatus](get3DModelJobStatus.md). With
`wait: true`, the call polls until the job is done and returns the model.
With `stream: true`, the call returns StreamChunks for the same lifecycle,
so you can send them to the client over SSE.

A job that fails rejects (or ends the stream with RUN_ERROR) with the
provider error message. On timeout or abort, the activity asks the adapter
to cancel the job.

## Type Parameters

### TAdapter

`TAdapter` *extends* [`Model3DAdapter`](../interfaces/Model3DAdapter.md)\<`string`, `any`, `any`, `any`\>

### TStream

`TStream` *extends* `boolean` = `false`

### TWait

`TWait` *extends* `boolean` = `false`

## Parameters

### options

[`Model3DActivityOptions`](../type-aliases/Model3DActivityOptions.md)\<`TAdapter`, `TStream`, `TWait`\>

## Returns

[`Model3DActivityResult`](../type-aliases/Model3DActivityResult.md)\<`TStream`, `TWait`\>

## Examples

**Wait for the model on the server**

```ts
import { generate3DModel } from '@tanstack/ai'
import { fal3DModel } from '@tanstack/ai-fal'

const model = await generate3DModel({
  adapter: fal3DModel('fal-ai/hunyuan3d-v3/image-to-3d'),
  prompt: [{ type: 'image', source: { type: 'url', value: conceptArtUrl } }],
  threadId,
  wait: true,
})

console.log(model.url, model.format) // e.g. 'https://…/model.glb', 'glb'
```

**Stream the job to the client**

```ts
import { generate3DModel, toServerSentEventsResponse } from '@tanstack/ai'
import { fal3DModel } from '@tanstack/ai-fal'

const stream = generate3DModel({
  adapter: fal3DModel('fal-ai/hunyuan3d-v3/image-to-3d'),
  prompt: [{ type: 'image', source: { type: 'url', value: conceptArtUrl } }],
  threadId,
  stream: true,
})

return toServerSentEventsResponse(stream)
```

 3D model generation is experimental and may change.
