> 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.

#  Infer

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

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

## Request

### Body (application/json)

This endpoint expects an AlpamayoInferRequest.

- `images` (list of string, required) — Compressed camera images as base64 strings or data:image/...;base64 URIs, ordered by camera_order and timestep for trajectory modes. When camera_order is omitted for trajectory modes, the legacy 4 camera x 4 frame order is used. Answer-only VQA accepts variable image counts and preserves input order.
- `mode` (enum, optional, default: trajectory) — Inference mode: trajectory generation, visual question answering, or both.
  - Allowed values: `trajectory`, `answer`, `both`
- `camera_order` (list of string, optional, nullable) — Optional camera names matching the image camera-major order. Names may use Alpamayo full camera names or OSS short names such as cross_left and front_wide. Required for trajectory modes when image count is not 16.
- `num_frames_per_camera` (integer, optional, default: 4) — Number of temporal frames supplied for each camera.
- `egomotion` (map from string to any, optional, nullable) — Egomotion payload required for trajectory modes. ego_history_xyz must have shape [16, 3]. ego_history_rot must contain exactly 16 quaternion rows [w, x, y, z] or 16 3x3 rotation matrices. The 16-row history is required even for reduced image layouts.
- `num_traj_samples` (integer, optional, default: 1) — Number of trajectory samples to generate.
- `nav_text` (string, optional, nullable) — Optional navigation instruction for trajectory generation.
- `question` (string, optional, nullable) — Question for mode='answer' or mode='both'.
- `temperature` (double, optional, default: 0.6) — VLM sampling temperature.
- `top_p` (double, optional, default: 0.98) — VLM nucleus sampling top-p.
- `top_k` (integer, optional, nullable) — Optional VLM top-k sampling limit. Use 1 for greedy/top-1 decoding.
- `max_tokens` (integer, optional, default: 256) — Maximum VLM generation tokens.
- `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.

## Response

### 200

Successful Response

- `mode` (enum, required)
  - Allowed values: `trajectory`, `answer`, `both`
- `pred_trajectories` (list of any, optional, nullable)
- `pred_rotations` (list of any, optional, nullable)
- `answer` (string, optional, nullable)
- `reasoning_text` (string, optional, nullable)
- `num_samples` (integer, optional, nullable)
- `num_points` (integer, optional, nullable)
- `duration` (double, optional, nullable)
- `inference_time` (double, optional, nullable)
- `metrics` (map from string to any, optional, nullable)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ValidationError

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

### ValidationErrorLocItems

## Examples

**Request**

```json
{
  "images": [
    "string"
  ]
}
```

**Response**

```json
{
  "mode": "trajectory",
  "pred_trajectories": [
    null
  ],
  "pred_rotations": [
    null
  ],
  "answer": "string",
  "reasoning_text": "string",
  "num_samples": 1,
  "num_points": 1,
  "duration": 1.1,
  "inference_time": 1.1,
  "metrics": {}
}
```

**SDK Code**

```python
import requests

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

payload = { "images": ["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/infer';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"images":["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/infer"

	payload := strings.NewReader("{\n  \"images\": [\n    \"string\"\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/infer")

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  \"images\": [\n    \"string\"\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/infer")
  .header("Content-Type", "application/json")
  .body("{\n  \"images\": [\n    \"string\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp
using RestSharp;

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

```swift
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/infer")! 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()
```