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

# Vision example

> Analyze an image with text using an OpenAI-compatible multimodal Chat Completions request.

Set `IMAGE_URL` to an HTTPS image that the model provider can fetch, then send text and image content in the same user message.

<CodeGroup>
  ```bash Curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl https://api.yelu.ai/v1/chat/completions \
    -H "Authorization: Bearer $YELU_API_KEY" \
    -H "Content-Type: application/json" \
    -d "{\"model\":\"gpt-4o-mini\",\"messages\":[{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"Return a concise alt-text description.\"},{\"type\":\"image_url\",\"image_url\":{\"url\":\"$IMAGE_URL\",\"detail\":\"auto\"}}]}],\"max_completion_tokens\":120}"
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await fetch('https://api.yelu.ai/v1/chat/completions', {
    method: 'POST',
    headers: { Authorization: `Bearer ${process.env.YELU_API_KEY}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({
      model: 'gpt-4o-mini',
      messages: [{
        role: 'user',
        content: [
          { type: 'text', text: 'Return a concise alt-text description.' },
          { type: 'image_url', image_url: { url: process.env.IMAGE_URL, detail: 'auto' } },
        ],
      }],
      max_completion_tokens: 120,
    }),
  });
  if (!response.ok) throw new Error(await response.text());
  console.log((await response.json()).choices[0].message.content);
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os
  import requests

  response = requests.post(
      "https://api.yelu.ai/v1/chat/completions",
      headers={"Authorization": f"Bearer {os.environ['YELU_API_KEY']}"},
      json={
          "model": "gpt-4o-mini",
          "messages": [{
              "role": "user",
              "content": [
                  {"type": "text", "text": "Return a concise alt-text description."},
                  {"type": "image_url", "image_url": {"url": os.environ["IMAGE_URL"], "detail": "auto"}},
              ],
          }],
          "max_completion_tokens": 120,
      },
      timeout=120,
  )
  response.raise_for_status()
  print(response.json()["choices"][0]["message"]["content"])
  ```
</CodeGroup>

<Warning>
  Validate user-supplied URLs against SSRF, size, and media-type rules before forwarding them. Use signed URLs with short expiry for private images.
</Warning>
