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

# Visual question answering through an OpenAI-style request

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

Compatibility adapter for task='vqa'. Put the question and the images in one user message; camera_order and num_frames_per_camera go in nvext. Prefer POST /v1/infer for new integrations.

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

## Request

### Body (application/json)

This endpoint expects a ChatCompletionRequest.

- `messages` (list of ChatMessage, required)
- `model` (string, optional, nullable, default: nvidia/alpamayo-2-super) — Served model ID from /v1/models. Omitted, null, or an empty string selects the served model, as over gRPC; other model names are rejected.
- `max_tokens` (integer, optional, nullable) — Maximum VLM generation tokens for /v1/vqa. Omit this field from trajectory requests to /v1/chat/completions.
- `temperature` (double, optional, nullable, default: 0.6) — VLM sampling temperature. Null selects the default.
- `top_p` (double, optional, nullable, default: 0.98) — VLM nucleus sampling top-p. Null selects the default.
- `top_k` (integer, optional, nullable)
- `seed` (integer, optional, nullable) — Optional per-request sampling seed. When omitted, the container default seed is used. For deterministic greedy language decoding on the same deployment, use temperature=0.
- `stream` (false, optional, nullable, default: false) — Streaming is not supported; omit this field or set it to false or null.
- `n` (integer, optional, nullable) — Accepted for OpenAI client compatibility; only 1 is supported. Use nvext.num_traj_samples for multiple trajectories.
- `presence_penalty` (double, optional, nullable) — Accepted for OpenAI client compatibility; only 0 is supported.
- `frequency_penalty` (double, optional, nullable) — Accepted for OpenAI client compatibility; only 0 is supported.
- `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)
- `answer_reason` (string, optional, nullable)
- `finish_reason` (enum, optional, nullable) — 'stop' when the model ended its answer, 'length' when it reached max_tokens and the answer may be truncated.
  - Allowed values: `stop`, `length`
- `usage` (UsageInfo, optional, nullable) — VLM prompt/completion token counts. Populated only when the backend reports them; otherwise null rather than an estimate.
- `inference_time` (double, optional, nullable)

## Errors

### 400 Bad Request Error

Invalid request semantics.

- `error` (AlpamayoError, required) — Stable error details returned by Alpamayo HTTP inference endpoints.

### 413 Content Too Large Error

Request body exceeds the configured limit.

- `error` (AlpamayoError, required) — Stable error details returned by Alpamayo HTTP inference endpoints.

### 415 Unsupported Media Type Error

Unsupported media type.

- `error` (AlpamayoError, required) — Stable error details returned by Alpamayo HTTP inference endpoints.

### 422 Unprocessable Entity Error

Request validation failed.

- `error` (AlpamayoError, required) — Stable error details returned by Alpamayo HTTP inference endpoints.

### 429 Too Many Requests Error

Inference admission limit reached.

- `error` (AlpamayoError, required) — Stable error details returned by Alpamayo HTTP inference endpoints.

### 500 Internal Server Error

Internal inference error.

- `error` (AlpamayoError, required) — Stable error details returned by Alpamayo HTTP inference endpoints.

### 503 Service Unavailable Error

Model startup is not complete, or the NIM is shutting down.

- `error` (AlpamayoError, required) — Stable error details returned by Alpamayo HTTP inference endpoints.

## Types

### ChatMessage

- `content` (ChatMessageContent, required)
- `role` ("user", optional, default: user) — Only user messages are supported by this compatibility API.

### NvExt

- `egomotion` (NvExtEgomotion, optional, nullable)
- `num_traj_samples` (integer, optional, default: 1)
- `nav_text` (string, optional, nullable) — Optional navigation instruction rendered into the trajectory prompt and applied through classifier-free guidance. Empty or whitespace-only text is treated as absent.
- `nav_guidance_weight` (double, optional, nullable, default: 3) — Classifier-free guidance weight applied to nav_text during trajectory generation. Ignored when nav_text is absent. 1.0 renders the navigation text into the prompt without guidance; the default 3.0 matches the released checkpoint and runs an additional unguided prefill per trajectory sample. Valid only for trajectory-producing requests (task='trajectory' or legacy mode='both'). Null selects the default.
- `question` (string, optional, nullable)
- `camera_order` (list of enum, optional, nullable) — Optional camera names matching the image order. Default order when omitted: cross_left, front_wide, cross_right, rear_left, rear_right, front_tele (camera-major, oldest frame first within each camera); declare camera_order whenever the images are not in that layout.
  - Allowed values: `cross_left`, `front_wide`, `cross_right`, `rear_left`, `rear_right`, `front_tele`, `rear_tele`, `camera_cross_left_120fov`, `camera_front_wide_120fov`, `camera_cross_right_120fov`, `camera_rear_left_70fov`, `camera_rear_tele_30fov`, `camera_rear_right_70fov`, `camera_front_tele_30fov`
- `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 deterministic greedy language decoding on the same deployment, use temperature=0.
- `top_k` (integer, optional, nullable)

### UsageInfo

- `prompt_tokens` (integer, required)
- `completion_tokens` (integer, required)
- `total_tokens` (integer, required)

### AlpamayoError

Stable error details returned by Alpamayo HTTP inference endpoints.

- `message` (string, required)
- `type` (string, required)
- `code` (integer, required)

### ChatMessageContent

- list of ChatMessageContentOneOf0Items
- string

### NvExtEgomotion

- `ego_history_xyz` (list of list of double, required)
- `ego_history_rot` (NvExtEgomotionEgoHistoryRot, required)

### ChatMessageContentOneOf0Items

- ContentPartText: ContentPartText
- ContentPartImage: ContentPartImage

### NvExtEgomotionEgoHistoryRot

- list of list of double
- list of list of list of double

### ContentPartText

- `text` (string, required)
- `type` ("text", optional, default: text)

### ContentPartImage

- `image_url` (ImageURL, required)
- `type` ("image_url", optional, default: image_url)

### ImageURL

- `url` (string, required) — Inline image as a base64 data URL (data:image/jpeg;base64,...). Remote http(s) URLs are not fetched.
- `detail` (enum, optional, nullable) — Accepted for OpenAI client compatibility and ignored; images are always processed at the model's input resolution.
  - Allowed values: `auto`, `low`, `high`

## Examples

**Request**

```json
{
  "messages": [
    {
      "content": [
        {
          "text": "What is in front of the ego vehicle?",
          "type": "text"
        },
        {
          "image_url": {
            "url": "data:image/jpeg;base64,<base64-image>"
          },
          "type": "image_url"
        }
      ],
      "role": "user"
    }
  ],
  "model": "nvidia/alpamayo-2-super",
  "stream": false,
  "nvext": {
    "camera_order": [
      "front_wide"
    ],
    "num_frames_per_camera": 1
  }
}
```

**Response**

```json
{
  "id": "string",
  "created": 1,
  "model": "string",
  "question": "string",
  "answer": "string",
  "object": "vqa.response",
  "answer_reason": "string",
  "finish_reason": "stop",
  "usage": {
    "prompt_tokens": 1,
    "completion_tokens": 1,
    "total_tokens": 1
  },
  "inference_time": 1.1
}
```

**SDK Code**

```python OpenAI-compatible single-image request
import requests

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

payload = {
    "messages": [
        {
            "content": [
                {
                    "text": "What is in front of the ego vehicle?",
                    "type": "text"
                },
                {
                    "image_url": { "url": "data:image/jpeg;base64,<base64-image>" },
                    "type": "image_url"
                }
            ],
            "role": "user"
        }
    ],
    "model": "nvidia/alpamayo-2-super",
    "stream": False,
    "nvext": {
        "camera_order": ["front_wide"],
        "num_frames_per_camera": 1
    }
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript OpenAI-compatible single-image request
const url = 'https://api.example.com/v1/vqa';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"messages":[{"content":[{"text":"What is in front of the ego vehicle?","type":"text"},{"image_url":{"url":"data:image/jpeg;base64,<base64-image>"},"type":"image_url"}],"role":"user"}],"model":"nvidia/alpamayo-2-super","stream":false,"nvext":{"camera_order":["front_wide"],"num_frames_per_camera":1}}'
};

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

```go OpenAI-compatible single-image request
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\": \"What is in front of the ego vehicle?\",\n          \"type\": \"text\"\n        },\n        {\n          \"image_url\": {\n            \"url\": \"data:image/jpeg;base64,<base64-image>\"\n          },\n          \"type\": \"image_url\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"model\": \"nvidia/alpamayo-2-super\",\n  \"stream\": false,\n  \"nvext\": {\n    \"camera_order\": [\n      \"front_wide\"\n    ],\n    \"num_frames_per_camera\": 1\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 OpenAI-compatible single-image request
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\": \"What is in front of the ego vehicle?\",\n          \"type\": \"text\"\n        },\n        {\n          \"image_url\": {\n            \"url\": \"data:image/jpeg;base64,<base64-image>\"\n          },\n          \"type\": \"image_url\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"model\": \"nvidia/alpamayo-2-super\",\n  \"stream\": false,\n  \"nvext\": {\n    \"camera_order\": [\n      \"front_wide\"\n    ],\n    \"num_frames_per_camera\": 1\n  }\n}"

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

```java OpenAI-compatible single-image request
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\": \"What is in front of the ego vehicle?\",\n          \"type\": \"text\"\n        },\n        {\n          \"image_url\": {\n            \"url\": \"data:image/jpeg;base64,<base64-image>\"\n          },\n          \"type\": \"image_url\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"model\": \"nvidia/alpamayo-2-super\",\n  \"stream\": false,\n  \"nvext\": {\n    \"camera_order\": [\n      \"front_wide\"\n    ],\n    \"num_frames_per_camera\": 1\n  }\n}")
  .asString();
```

```php OpenAI-compatible single-image request
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/vqa', [
  'body' => '{
  "messages": [
    {
      "content": [
        {
          "text": "What is in front of the ego vehicle?",
          "type": "text"
        },
        {
          "image_url": {
            "url": "data:image/jpeg;base64,<base64-image>"
          },
          "type": "image_url"
        }
      ],
      "role": "user"
    }
  ],
  "model": "nvidia/alpamayo-2-super",
  "stream": false,
  "nvext": {
    "camera_order": [
      "front_wide"
    ],
    "num_frames_per_camera": 1
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp OpenAI-compatible single-image request
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\": \"What is in front of the ego vehicle?\",\n          \"type\": \"text\"\n        },\n        {\n          \"image_url\": {\n            \"url\": \"data:image/jpeg;base64,<base64-image>\"\n          },\n          \"type\": \"image_url\"\n        }\n      ],\n      \"role\": \"user\"\n    }\n  ],\n  \"model\": \"nvidia/alpamayo-2-super\",\n  \"stream\": false,\n  \"nvext\": {\n    \"camera_order\": [\n      \"front_wide\"\n    ],\n    \"num_frames_per_camera\": 1\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift OpenAI-compatible single-image request
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "messages": [
    [
      "content": [
        [
          "text": "What is in front of the ego vehicle?",
          "type": "text"
        ],
        [
          "image_url": ["url": "data:image/jpeg;base64,<base64-image>"],
          "type": "image_url"
        ]
      ],
      "role": "user"
    ]
  ],
  "model": "nvidia/alpamayo-2-super",
  "stream": false,
  "nvext": [
    "camera_order": ["front_wide"],
    "num_frames_per_camera": 1
  ]
] 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()
```