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

# Image to Text

> Learn how to use multimodal input (Vision) with the Vercel AI SDK.

Multimodal language models can accept both text prompts and images as input.

***

## Vision (Image-to-Text)

Pass both text and image content to a multimodal model.

```typescript theme={null}
import { generateText } from 'ai';
import { openai, MODEL } from './client';

async function analyzeImage() {
  const base64Image =
    'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==';

  const response = await generateText({
    model: openai(MODEL),

    messages: [
      {
        role: 'user',
        content: [
          {
            type: 'text',
            text: 'Describe this image.',
          },
          {
            type: 'image',
            image: base64Image,
            mimeType: 'image/png',
          },
        ],
      },
    ],
  });

  console.log(response.text);
}
```

***

## Parameters

When using vision models with `generateText`, the following parameters are supported:

<ParamField path="model" type="LanguageModel" required>
  The model instance to use for generation.
</ParamField>

<ParamField path="messages" type="Message[]" required>
  Array of message objects representing the conversation history. For vision, pass `type: 'image'` along with the image data (URL or Base64) and `mimeType`.
</ParamField>

<ParamField path="temperature" type="number">
  Controls randomness (0.0 to 2.0).
</ParamField>

<ParamField path="maxTokens" type="number">
  The maximum number of tokens to generate.
</ParamField>

<ParamField path="topP" type="number">
  Nucleus sampling probability.
</ParamField>

<ParamField path="topK" type="number">
  Limits sampling to the top K probable tokens.
</ParamField>

<ParamField path="presencePenalty" type="number">
  Encourages the model to talk about new topics.
</ParamField>

<ParamField path="frequencyPenalty" type="number">
  Prevents the model from repeating words.
</ParamField>

<ParamField path="seed" type="number">
  Attempts deterministic generation.
</ParamField>

<ParamField path="stopSequences" type="string[]">
  Custom sequences that stop the model from generating further text.
</ParamField>
