> This page is for version 1.0.0 (Latest) (default).
> For other versions, use one of these documentation indexes:
> - 1.0.0 (Latest) (default): https://docs.nvidia.com/nim/alpamayo/1.0.0/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nim/alpamayo/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nim/alpamayo/_mcp/server.

# Vqa

POST /v1/vqa
Content-Type: application/json

Reference: https://docs.nvidia.com/nim/alpamayo/api-reference/vqa-v-1-vqa-post

## Request

### Body (application/json)

This endpoint expects a ChatCompletionRequest.

- `messages` (list of ChatMessage, required)
- `model` (string, optional, default: nvidia/alpamayo1.5)
- `max_tokens` (integer, optional, default: 256)
- `temperature` (double, optional, default: 0.6)
- `top_p` (double, optional, default: 0.98)
- `top_k` (integer, optional, nullable)
- `seed` (integer, optional, nullable) — Optional per-request sampling seed. When omitted, the container default seed is used. For repeatable K=1 trajectory inference in the same deployment, use a fixed seed with top_k=1 and top_p=1.
- `stream` (boolean, optional, default: false)
- `nvext` (NvExt, optional, nullable)

## Response

### 200

Successful Response

- `id` (string, required)
- `created` (integer, required)
- `model` (string, required)
- `question` (string, required)
- `answer` (string, required)
- `object` ("vqa.response", optional, default: vqa.response)
- `inference_time` (double, optional, nullable)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ChatMessage

- `content` (ChatMessageContent, required)
- `role` (string, optional, default: user)

### NvExt

- `egomotion` (map from string to any, optional, nullable)
- `num_traj_samples` (integer, optional, default: 1)
- `nav_text` (string, optional, nullable)
- `question` (string, optional, nullable)
- `camera_order` (list of string, optional, nullable)
- `num_frames_per_camera` (integer, optional, default: 4)
- `seed` (integer, optional, nullable) — Optional per-request sampling seed. When omitted, the container default seed is used. For repeatable K=1 trajectory inference in the same deployment, use a fixed seed with top_k=1 and top_p=1.
- `top_k` (integer, optional, nullable)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ChatMessageContent

### ValidationErrorLocItems

## Examples

**Request**

```json
{
  "messages": [
    {
      "content": [
        {
          "text": "string"
        }
      ]
    }
  ]
}
```

**Response**

```json
{
  "id": "string",
  "created": 1,
  "model": "string",
  "question": "string",
  "answer": "string",
  "object": "vqa.response",
  "inference_time": 1.1
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/v1/vqa"

payload = { "messages": [{ "content": [{ "text": "string" }] }] }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/v1/vqa';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"messages":[{"content":[{"text":"string"}]}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/vqa"

	payload := strings.NewReader("{\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"text\": \"string\"\n        }\n      ]\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/vqa")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"text\": \"string\"\n        }\n      ]\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/vqa")
  .header("Content-Type", "application/json")
  .body("{\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"text\": \"string\"\n        }\n      ]\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/vqa', [
  'body' => '{
  "messages": [
    {
      "content": [
        {
          "text": "string"
        }
      ]
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/v1/vqa");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"messages\": [\n    {\n      \"content\": [\n        {\n          \"text\": \"string\"\n        }\n      ]\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["messages": [["content": [["text": "string"]]]]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/vqa")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```