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

# Image to text (OCR)

> Learn how to query images in WetroCloud to retrieve information, descriptions, or answers based on the image using the WetroCloud APIs image-to-text endpoint.

The `image-to-text` endpoint allows you to analyze an image and ask questions about its content via the WetroCloud API.

### Request Example

<CodeGroup>
  ```python Python theme={null}
  from wetro import Wetrocloud

  # Initialize the Wetrocloud client
  client = Wetrocloud(api_key="your_api_key")

  # Extract text from an image and answer questions about it
  ocr_response = client.image_to_text(
      image_url = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTQBQcwHfud1w3RN25Wgys6Btt_Y-4mPrD2kg&s",
      request_query="What animal is this?"
  )
  print(ocr_response)
  ```

  ```javascript JavaScript theme={null}
  import Wetrocloud from "wetro-sdk";

  // Initialize the Wetrocloud client
  const client = new Wetrocloud({
    apiKey: "your_api_key"
  });

  const imageUrl = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTQBQcwHfud1w3RN25Wgys6Btt_Y-4mPrD2kg&s';
  const query = 'What animal is this?';

  // Extract text from an image and answer questions about it
  const response = await client.imageToText({
    image_url: imageUrl,
    request_query: query
  });

  console.log("Image to text:", response);
  ```

  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.wetrocloud.com/v1/image-to-text/ \
    --header 'Authorization: Token <api-key>' \
    --header 'Content-Type: application/json' \
    --data '{
      "image_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTQBQcwHfud1w3RN25Wgys6Btt_Y-4mPrD2kg&s",
      "request_query": "What animal is this?"
    }'
  ```
</CodeGroup>

### Response Example

```json theme={null}
{
    "response": "This is a dog, specifically a Labrador Retriever.",
    "tokens": 1594,
    "success": true
}
```

| Field      | Description                                 |
| ---------- | ------------------------------------------- |
| `response` | Conversational response to the query.       |
| `tokens`   | Number of tokens used for processing.       |
| `success`  | Indicates whether the query was successful. |
