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

# TanStack AI

> Generate images through TanStack AI's image abstraction with @mynthio/tanstack-ai-adapter.

The `@mynthio/tanstack-ai-adapter` package lets you use Mynth as an image provider through TanStack AI's `generateImage` API.

## Usage

```ts theme={"theme":"kanagawa-dragon"}
import { generateImage } from "@tanstack/ai";
import { mynthImage } from "@mynthio/tanstack-ai-adapter";

const result = await generateImage({
  adapter: mynthImage("krea/krea-2-large"),
  prompt: "Editorial product photo of a ceramic cup",
  numberOfImages: 1,
  size: "landscape",
});
```

## Image inputs (image-to-image)

Models that support image inputs accept TanStack AI's content-part prompts, so you can interleave instruction text with reference images. The adapter maps the image parts onto Mynth's `inputs`:

```ts theme={"theme":"kanagawa-dragon"}
const result = await generateImage({
  adapter: mynthImage("black-forest-labs/flux-virtual-try-on"),
  prompt: [
    { type: "text", content: "Dress the person in this garment" },
    {
      type: "image",
      source: { type: "url", value: "https://example.com/person.jpg" },
      metadata: { role: "character" },
    },
    {
      type: "image",
      source: { type: "url", value: "https://example.com/garment.jpg" },
    },
  ],
});
```

Only models in `MYNTH_IMAGE_INPUT_MODELS` accept image parts; passing them to a text-only model is a compile-time error. For finer-grained input intents (`person`, `garment`, `pose`, `style`, …), pass `modelOptions.inputs` with an explicit `as`.

## When to use this adapter

Use it when your app already standardizes on TanStack AI's image abstraction and you want to add Mynth as a provider without changing your application code.

If Mynth is your primary integration surface, use the [main SDK](/sdk/js-ts/overview) directly for full control over async flows, polling, webhooks, and metadata.
