> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.nvidia.com/nim/alpamayo/2.0.0/api-reference/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nim/alpamayo/_mcp/server. # API Reference **Alpamayo 2 Super.** For the previous generation, see [Alpamayo 1.5 API Reference](/nim/alpamayo/1.0.0/api-reference). Alpamayo 2 Super exposes HTTP on port 8000 and trajectory gRPC on port 50051. The default model ID is `nvidia/alpamayo-2-super`; discover a renamed deployment's ID through `GET /v1/models`. Host-side commands on this page require the builder, clients and `sample_data` from [Set up a client outside the NIM](/nim/alpamayo/quickstart-guide#set-up-a-client-outside-the-nim). Complete that copy step before running any Python or shell example below; [Inference Tasks](/nim/alpamayo/tasks) also shows builders run directly inside the ready container. ## Example Target Set these for your deployment before running the shell examples. Bash is assumed; `pipefail` prevents a failed builder or HTTP request being hidden by the last command in a pipeline. Use the container name you own. ```bash export NIM_URL="${NIM_URL:-http://localhost:8000}" export NIM_CONTAINER="${NIM_CONTAINER:-alpamayo2-super}" export GRPC_TARGET="${GRPC_TARGET:-localhost:50051}" export ALPAMAYO_OUT="${ALPAMAYO_OUT:-$(mktemp -d "${TMPDIR:-/tmp}/alpamayo.XXXXXX")}" set -o pipefail ``` `NIM_URL` is the HTTP base URL and `GRPC_TARGET` the gRPC `host:port` as published on the host; use your remapped host ports if you changed them. The packaged host clients read both variables. `ALPAMAYO_OUT` is a private directory for the request and response files written below. ## HTTP Endpoints | Endpoint | Purpose | | --- | --- | | `POST /v1/infer` | Canonical trajectory, VQA, meta-action, auto-labeling, and grounding API. | | `POST /v1/chat/completions` | OpenAI-compatible trajectory adapter for existing clients. | | `POST /v1/vqa` | OpenAI-style VQA compatibility adapter. | | `GET /v1/models` | Served model, backend, active profile/precision, checkpoint quantization and fingerprint, speculative-decoding method, the configured `k_values` list, and the effective admission, request-size and context limits. `HEAD` is also accepted. | | `GET /v1/models/{model_id}` | The served model entry, as OpenAI clients' `models.retrieve` expects. Other IDs return 404. | | `GET /v1/version` | NIM release version information. | | `GET /v1/metadata` | Product and runtime metadata. | | `GET /v1/manifest` | Whole packaged manifest, including all profiles. Use `GET /v1/models` to identify the active profile; the manifest is not a loaded-profile view. | | `GET /v1/license` | Contents of the packaged `/opt/nim/LICENSE` file plus the governing license `url`; refer to [End User License Agreement](/nim/alpamayo/eula). A mounted BYOC checkpoint remains governed by the terms under which you obtained it. | | `GET /v1/health/live` | Process liveness. `HEAD` is also accepted. | | `GET /v1/health/ready` | Model readiness. `HEAD` is also accepted. | | `GET /v1/metrics` | Prometheus-format runtime metrics. | | `GET /openapi.json` | Downloadable HTTP request and response schema. | | `GET /docs` | Interactive HTTP API reference (Swagger UI). Its JavaScript and CSS load from a public CDN, so it does not render on an air-gapped host; use `/openapi.json` or the downloadable schema there. | ## Schema Access Use `GET /openapi.json` for the HTTP schema or `GET /docs` for interactive API documentation. Without a running container, [download the OpenAPI YAML](./examples/alpamayo2-super.openapi.yaml "download"). The schema includes one `POST /v1/infer` example per task and declares the `Retry-After` header on 429 and 503 responses. The OpenAPI document lists the accepted camera names and the default order; always send `camera_order` when your images are not in that order. Images in a non-default order sent without `camera_order` return HTTP 200 and a wrong plan, with no warning. Some per-task rules are described only on this page and in [Camera order and sample files](#camera-order-and-sample-files); the payload builder output is a reliable starting point. The `POST /v1/infer` operation ID is `infer`. ## Service Discovery `GET /v1/models` describes the running configuration. Every field is fixed for the lifetime of the container, so read it once after readiness instead of discovering settings from rejected requests: ```bash curl --fail-with-body -sS "${NIM_URL}/v1/models" | python3 -m json.tool ``` ```json { "object": "list", "data": [ { "id": "nvidia/alpamayo-2-super", "object": "model", "created": 0, "owned_by": "nvidia", "backend": "vllm-omni", "checkpoint": "default", "checkpoint_hash": "", "root": "/opt/nim", "profile": "bf16", "profile_id": "66ebea01402637abccfe4e26d8be3e555f6d47f5e9fcdcc0a503a6a0ef7f71cd", "precision": "bf16", "checkpoint_quantization": "bf16", "speculative_decoding": "none", "max_inflight": 8, "max_request_bytes": 134217728, "k_values": [1], "default_seed": 42, "max_model_len": 6144, "speculative_model": null, "action_expert_max_batch_size": 1, "spec_metrics": "none" } ] } ``` `max_model_len` is the context limit in tokens (`NIM_ALPAMAYO_MAX_MODEL_LEN`). `speculative_model` is the container path of the active DFlash2 draft head: the packaged head (`/opt/nim/workspace/dflash2`), or a custom head mounted with `NIM_ALPAMAYO_SPECULATIVE_MODEL`. It is `null` when speculative decoding is off, as in the `bf16` example above. `checkpoint_quantization` is the checkpoint format vLLM serves: `bf16` or `modelopt-fp8` (also after a BYOC FP8 conversion). `action_expert_max_batch_size` is the effective `NIM_ALPAMAYO_ACTION_EXPERT_MAX_BATCH_SIZE`: the largest number of trajectory samples the action expert evaluates in one call, `1` on every packaged profile. `spec_metrics` is the speculative metrics mode (`none`, `summary` or `detailed`). All JSON response bodies end with a newline. `k_values` lists accepted `num_traj_samples` values, configured by `NIM_ALPAMAYO_TRAJ_SAMPLES` (default `1`). An integer from 1 through 32 that is not in the list returns HTTP 400, for example: `Profile bf16 supports num_traj_samples values [1]; got 4.` A value outside 1 through 32, or one that is not an integer (such as `1.0`, `"1"` or `true`), fails schema validation with HTTP 422. To change this list, the profile, or checkpoint, follow [Configuring a NIM](/nim/alpamayo/configuration). `GET /v1/health/ready` returns HTTP 200 only when the serving backend and the Alpamayo model are both ready. Once the HTTP listener is running, an unavailable backend returns HTTP 503. During model loading and warmup, inference endpoints also return 503 with a readiness-polling instruction. Initial setup and model downloads can precede the HTTP listener, so connection failures are still possible in that phase; use the quickstart's bounded readiness loop. A ready response is one line of compact JSON: ```json {"object":"Alpamayo model readiness check","message":"ready","status":"ready"} ``` Automation should key on the HTTP status code and `status` rather than on `object` or `message`. The liveness body uses the label `Alpamayo service liveness check`; the model execution backend is vLLM-Omni. `GET /v1/version` returns `{"release":"1.0.0","api":"3.1.0"}`: `release` is the container release, while `api` identifies the OpenAPI specification version. The documentation version and model-artifact tag are separate identifiers: **Version identifiers** | Surface | Meaning | | --- | --- | | Container tag and `/v1/version.release` | NIM software release. Candidate image tags can contain an `rc` suffix while `/v1/version.release` still reports `1.0.0`. Record the immutable image digest to identify the tested build. | | `/v1/version.api` | OpenAPI specification version, not the model or container release. | | Documentation version selector | Documentation release covering the product versions shown on its product pages. | | `/v1/metadata.modelInfo` | Exact NGC model artifact selected by the packaged profile. BF16 and FP8 can reference different artifact tags, such as `0.0.1` and `0.0.2-fp8-rc1`. These identify weight artifacts and need not equal the NIM software release. Preserve the complete `modelUrl` and `selectedModelProfileId` when reporting a problem. Under BYOC, `modelInfo` describes the mounted checkpoint instead; refer to [Bring Your Own Checkpoint](/nim/alpamayo/bring-your-own-checkpoint). | `GET /v1/metadata` includes `selectedModelProfileId` and repeats the `GET /v1/license` document as `licenseInfo`. ## Super Request Fields These fields belong to `POST /v1/infer` for **Alpamayo 2 Super**. See [Sampling Control](/nim/alpamayo/sampling-params) for sampling bounds. Do not copy the 16-image Alpamayo 1.5 examples from the Alpamayo 1.5 page. **Request contract** | Field | Required input or default | | --- | --- | | `task` | Set to `trajectory`, `vqa`, `meta_action`, `auto_labeling` or `grounding`. Defaults to trajectory when both task and mode are omitted. New callers should set it explicitly. | | `images` | Required list of base64 image strings or data URLs, in camera-major chronological order. All decoded images must have the same dimensions. | | `camera_order` | Camera names corresponding to the image groups. Trajectory accepts any non-empty subset of the six driving cameras below; declare it explicitly when using fewer cameras. The default is all six. Meta-action and auto-labeling retain the complete profile. VQA accepts a supported camera subset; grounding requires exactly one. Without this field, every task, including VQA, reads 24 images in the six-camera driving order below. | | `num_frames_per_camera` | Defaults to 4. Image count must equal the camera count multiplied by this value. For four-camera trajectory evaluation, supply four frames per camera and 16 images. Trajectory also accepts 1, 2 or 3 frames per camera for six or fewer cameras (see [Preparing Inputs](/nim/alpamayo/preparing-inputs)). More than four frames per camera is accepted with a warning but is not evaluated. For single-image VQA or grounding, use 1; single images are reliable for `front_wide` 16:9 frames (see the caveat under the VQA request example below). | | `egomotion` | Required for trajectory, meta-action and auto-labeling. Object containing exactly 16 translations and 16 rotations, as below. VQA and grounding do not require it. | | `question` | Required non-empty text for VQA. Optional localization question for grounding, which uses its packaged default when omitted. | | `num_traj_samples` | Defaults to 1. Requested trajectory count must occur in the live `GET /v1/models` list `k_values`. | | `future_source` | Required for auto-labeling: `predicted` or `provided`. The API has no default; the payload builder defaults to predicted. | | `future_trajectory` | Required only with `future_source="provided"`: an object with `xyz [64,3]` and `rotations [64,3,3]`. Omit for predicted future. | | `nav_text` / `nav_guidance_weight` | Optional trajectory navigation input. Weight defaults to 3.0 and is ignored without navigation text. See [Inference Tasks](/nim/alpamayo/tasks). | | `temperature` / `top_p` / `top_k` / `seed` | Sampling controls; defaults are 0.6, 0.98, unset, and the container seed respectively. Keep inputs and controls fixed for repeatability. | | `max_tokens` | Omit for trajectory and legacy `mode="both"`. Text tasks accept 1 through 1024; the default is 256, and auto-labeling applies a minimum generation budget of 1024. | | `mode` | Compatibility alias only. Use `task` for new integrations. | | `model` / `stream` | Optional. `model` must be the served ID from `GET /v1/models`; omitted, `null` or an empty string selects the served model. `stream` may only be `false` or `null`. | `seed` must be a JSON integer from 0 through 2147483647; booleans, floats and quoted numbers return HTTP 422. Omitted or `null` values use the container default. The same type/range validation applies to top-level `seed` and `nvext.seed` on both compatibility routes. `temperature`, `top_p` and `nav_guidance_weight` must be JSON numbers or `null`; `null` selects the default, and strings and booleans return HTTP 422. `egomotion` accepts only `ego_history_xyz` and `ego_history_rot`; other keys return HTTP 422. **Which fields each task accepts on `POST /v1/infer`** | Field | `trajectory` | `vqa` | `meta_action` | `auto_labeling` | `grounding` | | --- | --- | --- | --- | --- | --- | | `egomotion` | required | rejected | required | required | rejected | | `question` | rejected | required | rejected | rejected | optional, not blank | | `nav_text`, non-default `nav_guidance_weight` | optional | rejected | rejected | rejected | rejected | | `num_traj_samples` above 1 | optional | rejected | rejected | rejected | rejected | | `future_source` / `future_trajectory` | rejected | rejected | rejected | required / with `provided` | rejected | | `max_tokens` | rejected | optional | optional | optional | optional | Legacy `mode="both"` accepts `egomotion`, a required `question`, `nav_text` and K above 1, and rejects `max_tokens`. Rejected means HTTP 422. On the compatibility routes, `/v1/chat/completions` rejects `nvext.question` and ignores text content parts, because it always returns a trajectory; `/v1/vqa` takes the question from a text part or `nvext.question`. When both `task` and legacy `mode` are supplied, they must describe the same task. Conflicting values return HTTP 422; neither field silently overrides the other. ## Camera Order and Sample Files Requests accept either the short name or the full camera name below. Response camera fields use the full names; for example, a grounding request using `front_wide` returns `camera_front_wide_120fov`. These identify the same camera. Names are case-insensitive and surrounding whitespace is trimmed. Driving inputs default to four frames for each camera in this order: **Six-camera driving layout** | Short name | Full camera name | | --- | --- | | `cross_left` | `camera_cross_left_120fov` | | `front_wide` | `camera_front_wide_120fov` | | `cross_right` | `camera_cross_right_120fov` | | `rear_left` | `camera_rear_left_70fov` | | `rear_right` | `camera_rear_right_70fov` | | `front_tele` | `camera_front_tele_30fov` | For VQA or single-camera grounding, `rear_tele` is also an accepted alias for `camera_rear_tele_30fov` (rear-facing telephoto camera). It is not part of the supported trajectory camera set. For a four-camera trajectory request, set `camera_order=["cross_left", "front_wide", "cross_right", "front_tele"]` and `num_frames_per_camera=4`, and supply 16 images. Camera names must be unique and correspond to the supplied image groups. Missing cameras are not padded or synthesized; their model camera IDs remain `[0,1,2,6]`. Changing the camera set changes model input and can change accuracy. For HTTP, place these fields at the top level on `/v1/infer` and inside `nvext` on `/v1/chat/completions`. For gRPC, set `camera_order` or provide complete camera/timestep metadata on every frame; the server can infer the subset from that metadata. Image count alone never identifies missing cameras. Within each camera group, supply frames oldest first. The bundled sample uses `images/_t0` through `_t3` with a supported image extension; `t0` is the oldest frame and `t3` is the latest. Do not interleave different cameras at each timestep. The root sample directory also contains `egomotion.json` and `gt_trajectory.json`. Its `auto_labeling/` subdirectory contains another scene with its own `images/`, `egomotion.json` and `gt_trajectory.json`. The top-level `gt_trajectory.json` contains future positions only; it is not a complete provided-future request. Use the `auto_labeling/` scene for the documented provided-future example because its file includes positions and rotations. The `navigation/` subdirectory contains a junction scene, its six-camera image history, ego-motion and source provenance for the navigation example in [Inference Tasks](/nim/alpamayo/tasks). ## Ego-Motion and Trajectory Coordinates `egomotion.ego_history_xyz` is a list with shape `[16,3]` in meters. `egomotion.ego_history_rot` is either 16 scalar-first quaternions `[w,x,y,z]` or 16 rotation matrices with shape `[3,3]`. The API accepts mixed representations row by row, but use one consistently for easier validation and debugging. All entries must be finite; matrices must represent proper rotations and quaternions must have nonzero norm. Supply history in chronological order ending at the latest image time, sampled at 0.1-second intervals. Express positions and orientations in the ego vehicle's local frame at that latest time, as the bundled sample does. The final history translation must be the origin and its rotation the identity; otherwise the request is rejected with HTTP 422. This check catches global coordinates and many ordering errors, but other convention errors, such as scalar-last quaternions or centimeter units, still produce confident wrong plans; follow the conversion recipe in [Preparing Inputs](/nim/alpamayo/preparing-inputs). To convert global poses, subtract the latest position and rotate by the inverse of the latest orientation; apply that inverse orientation to each global rotation as well. The API does not perform this global-to-local conversion for you. Predicted trajectories and caller-provided futures use the same local frame. Their 64 points follow the latest history pose at 0.1-second intervals. Never substitute image count for history length: the history always has 16 poses, independently of the number of supplied cameras. ## Canonical Inference `POST /v1/infer` accepts one explicit `task` plus common image and sampling fields. Task-specific validation occurs before inference. Refer to [Inference Tasks](/nim/alpamayo/tasks) for input profiles, output fields, and runnable examples. Use Bash on the Docker host after [Quickstart Guide](/nim/alpamayo/quickstart-guide) has started the `alpamayo2-super` container. Copy the sample and request builder to the client directory used in the quickstart client setup ([Set up a client outside the NIM](/nim/alpamayo/quickstart-guide#set-up-a-client-outside-the-nim)); the copy is the same: ```bash export ALPAMAYO_CLIENT_DIR="${ALPAMAYO_CLIENT_DIR:-$PWD/alpamayo-client}" mkdir -p "$ALPAMAYO_CLIENT_DIR" && cd "$ALPAMAYO_CLIENT_DIR" mkdir -p ./sample_data docker cp "${NIM_CONTAINER}:/workspace/sample_data/." ./sample_data/ docker cp "${NIM_CONTAINER}:/opt/nim/build_http_payload.py" ./build_http_payload.py docker cp "${NIM_CONTAINER}:/opt/nim/http_client.py" ./http_client.py docker cp "${NIM_CONTAINER}:/opt/nim/trajectory_http.py" ./trajectory_http.py docker cp "${NIM_CONTAINER}:/opt/nim/trajectory_grpc.py" ./trajectory_grpc.py docker cp "${NIM_CONTAINER}:/opt/nim/test_grpc_api.py" ./test_grpc_api.py docker cp "${NIM_CONTAINER}:/opt/nim/alpamayo_grpc.proto" ./alpamayo_grpc.proto docker cp "${NIM_CONTAINER}:/opt/nim/alpamayo_grpc_pb2.py" ./alpamayo_grpc_pb2.py ``` Then create and send a task without manually writing 24 data URLs: ```bash python3 build_http_payload.py --endpoint infer --task trajectory \ --sample-dir sample_data > "$ALPAMAYO_OUT/alpamayo-request.json" curl --fail-with-body -sS "${NIM_URL}/v1/infer" \ -H 'Content-Type: application/json' \ --data-binary "@$ALPAMAYO_OUT/alpamayo-request.json" | python3 -m json.tool ``` Replace `trajectory` with `vqa`, `meta_action`, `auto_labeling`, or `grounding`. The builder selects the correct sample layout. Use `--question` for VQA or grounding; grounding defaults to an object-localization request rather than a general scene question. Auto-labeling defaults to a model-predicted future. To label a caller-provided future, use the packaged `/workspace/sample_data/auto_labeling` scene or pass `--future-source provided --future-trajectory future.json` with your own scene. The file must contain 64 XYZ points and 64 rotation matrices as documented in [Inference Tasks](/nim/alpamayo/tasks). This copyable suite exercises every canonical task and keeps each response for inspection: ```bash for task in trajectory meta_action auto_labeling; do python3 build_http_payload.py --endpoint infer --task "$task" \ --sample-dir sample_data > "$ALPAMAYO_OUT/$task-request.json" curl --fail-with-body -sS "${NIM_URL}/v1/infer" \ -H 'Content-Type: application/json' \ --data-binary "@$ALPAMAYO_OUT/$task-request.json" \ --output "$ALPAMAYO_OUT/$task-response.json" done for task in vqa grounding; do if [ "$task" = grounding ]; then question='Detect and return bounding boxes for all vehicles and pedestrians.' else question='Describe the traffic ahead in one short sentence.' fi python3 build_http_payload.py --endpoint infer --task "$task" \ --question "$question" --sample-dir sample_data \ > "$ALPAMAYO_OUT/$task-request.json" curl --fail-with-body -sS "${NIM_URL}/v1/infer" \ -H 'Content-Type: application/json' \ --data-binary "@$ALPAMAYO_OUT/$task-request.json" \ --output "$ALPAMAYO_OUT/$task-response.json" done ``` Successful responses use `task` as their discriminator. Trajectory returns `pred_trajectories` and `pred_rotations`; VQA returns `answer`; meta-action returns `meta_action`; auto-labeling returns `auto_labeling`; and grounding returns `grounding_boxes`. The complete normalized response shapes and example fragments are in [Inference Tasks](/nim/alpamayo/tasks). Every grounding response also carries `"bbox_space": "grid_0_1000"`, so a client can tell from the response alone that `bbox` is `[x_min, y_min, x_max, y_max]` on the model's 0–1000 grid, not pixels. Multiply x by `width/1000` and y by `height/1000` of the source image to get pixels. Other tasks do not set `bbox_space`. For VQA, `answer_reason` is set when VQA returns no answer text, the answer was cut off at `max_tokens`, or the answer is another task's structured output (grounding `bbox_2d` or auto-labeling JSON) rather than prose; ordinary answers omit it. For `task="vqa"`, `metrics` reports `vllm_prompt_tokens` and `vllm_generation_tokens` when the backend reports them. Trajectory `metrics.reasoning_texts` contains one text per returned sample when K is greater than one. Diagnostic `metrics.timings` appears only with `NIM_ALPAMAYO_PROFILE_TIMINGS=1`; its keys can change with the serving stack. Both optional metrics keys are described in the live and downloadable OpenAPI schemas. **Common response fields** | Field | Meaning | | --- | --- | | `task` / `mode` | The task that ran and its legacy mode (see the mapping below). Also present in the `/v1/chat/completions` assistant content and in the gRPC `raw_json` payload. | | `time_step` | Seconds between consecutive trajectory points (0.1); present with `pred_trajectories`, also in chat content and gRPC `raw_json`. `metrics.time_step_s` carries the same value as the step used to compute the kinematic metrics. | | `finish_reason` | For VQA, meta-action, auto-labeling and grounding: `stop` when the model ended its answer, `length` when it reached `max_tokens` and the text may be truncated. Absent for trajectory responses and when the backend does not report it. | | `warnings` | Non-fatal input caveats: the request was served, but the result may be unreliable. Current warnings flag an ego history implying an implausible speed (above 70 m/s, typically centimeters instead of meters or the wrong row spacing) or reversing at speed; a trajectory camera subset without a forward camera (`front_wide` or `front_tele`); a frame count the model was not evaluated with (more than 4 frames per camera for trajectory, or other than 4 for meta-action and auto-labeling); and a provided auto-labeling future that moves backward. Absent when there are none. | | `raw_text` | The model's text as generated, including its own wording (for example `Strong Deceleration`). Structured fields such as `meta_action` hold normalized values. | New clients should send `task` and omit `mode`; for questions, use `task="vqa"`. The legacy `mode` field remains accepted for Alpamayo 1.5 clients. The table shows how each value is interpreted when `task` is omitted, and the `mode` that every task echoes in its response: **Legacy `mode` mapping** | Request | Runs | Response `task` / `mode` | | --- | --- | --- | | `mode="trajectory"`, or neither field | `task="trajectory"` | `trajectory` / `trajectory` | | `mode="answer"` | `task="vqa"` | `vqa` / `answer` | | `mode="both"` | Legacy combined trajectory plus question | `trajectory` / `both`, with `answer` added | | `task="meta_action"` | Meta-action (no legacy `mode` selects it) | `meta_action` / `trajectory` | | `task="auto_labeling"` | Auto-labeling (no legacy `mode` selects it) | `auto_labeling` / `trajectory` | | `task="grounding"` | Grounding (no legacy `mode` selects it) | `grounding` / `answer` | The response `mode` only names the input family: `trajectory` for tasks that take ego-motion and `answer` for image-question tasks. It does not indicate that a trajectory or free-text answer was produced; use `task`. When a request sends both fields, `mode` must equal the value in the last column for that task; any other combination, including `mode="both"` with a `task`, returns HTTP 422. Legacy `mode="both"` uses the same declared driving-camera subset for both tasks. The default is the 24-image sample; `rear_tele` is not required. Its `answer` is generated in the same pass as the trajectory reasoning and can repeat that reasoning instead of answering the question; for example, a yes/no question can return trajectory or grounding-style text. Send a separate `task="vqa"` request when you need an answer to a question. ## Image Representation HTTP images are base64 strings or `data:image/...;base64,...` URLs. JPEG, PNG, WebP, and BMP are supported. Images are camera-major: all chronological frames for the first camera, followed by all frames for the next camera. `camera_order` accepts full camera names and short names such as `front_wide`. Every image in one request must have the same height and width; mixed resolutions are rejected before model execution. A payload error for one image names it by position, camera and frame, for example `images[13] (camera camera_rear_left_70fov, frame 2 of 4): Invalid image payload; JPEG end-of-image marker is missing.` Images are counted from 0 in the request's camera-major order. Camera identity and camera-major ordering are caller assertions: the service validates declared names and counts, but cannot inspect pixels to detect a mislabeled camera or timestep-major array. Misordered images silently change model output. Trajectory-producing tasks accept `temperature` from 0 through 1.5. VQA accepts values through 2.0. Values above 1.5 are rejected for trajectory generation because they can make the generated trajectory representation unparseable. `top_p` must be greater than 0 and at most 1. Do not send `max_tokens` with trajectory or legacy `mode="both"` requests. The NIM owns the generation budget required to reach the trajectory trigger token. An explicit `max_tokens` value on a trajectory request returns HTTP 422. VQA, grounding, meta-action and auto-labeling accept `max_tokens` from 1 through 1024. Auto-labeling enforces a minimum generation budget of 1024 to allow complete structured output, even when a smaller value is requested. `nav_text` is an optional navigation instruction for `task="trajectory"` and legacy `mode="both"`. When present it is rendered into the prompt and applied through classifier-free guidance with `nav_guidance_weight` (0 through 10, default `3.0`; `1.0` renders the text without guidance). The weight is ignored without `nav_text`; an explicit non-default weight, or any weight together with `nav_text`, on a task that does not produce trajectories returns HTTP 422. Refer to [Inference Tasks](/nim/alpamayo/tasks) for a navigation-conditioned example and the metrics it returns. ## Python HTTP Client First complete the sample-data copy step in [Set up a client outside the NIM](/nim/alpamayo/quickstart-guide#set-up-a-client-outside-the-nim). The Quickstart also copies these clients from the container. The two downloads below are files supplied by this documentation, not a PyPI package. Keep both files beside `sample_data`. Download [http_client.py](./examples/http_client.py "download") and [trajectory_http.py](./examples/trajectory_http.py "download") into the directory containing the copied `sample_data`. The HTTP example needs Python 3 and the `curl` executable on the client host; no Python packages are required. It constructs base64 data URLs from the six camera groups: ```python #!/usr/bin/env python3 """Construct a full six-camera trajectory request and submit it from Python. Run from the directory containing sample_data, or pass --sample-dir. The URL comes from --url, then ALPAMAYO_HTTP_URL, then NIM_URL + /v1/infer. """ import argparse import base64 import json import mimetypes from pathlib import Path from http_client import infer sample = Path("sample_data") cameras = [ "cross_left", "front_wide", "cross_right", "rear_left", "rear_right", "front_tele", ] def image_url(camera, timestep, sample_dir=sample): for extension in (".jpg", ".jpeg", ".png", ".webp", ".bmp"): path = sample_dir / "images" / f"{camera}_t{timestep}{extension}" if path.is_file(): media_type = mimetypes.guess_type(path.name)[0] encoded = base64.b64encode(path.read_bytes()).decode("ascii") return f"data:{media_type};base64,{encoded}" raise FileNotFoundError(f"Missing image for {camera} at timestep {timestep}") def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--sample-dir", type=Path, default=sample, help="Directory containing images/ and egomotion.json") parser.add_argument( "--url", default=None, help="Inference URL. Defaults to ALPAMAYO_HTTP_URL, then NIM_URL + /v1/infer, " "then http://localhost:8000/v1/infer", ) args = parser.parse_args() try: images = [image_url(camera, t, args.sample_dir) for camera in cameras for t in range(4)] egomotion = json.loads((args.sample_dir / "egomotion.json").read_text()) except (OSError, ValueError) as exc: parser.error(f"Cannot read sample data: {exc}. Set --sample-dir to the extracted sample_data directory.") request = { "task": "trajectory", "images": images, "camera_order": cameras, "num_frames_per_camera": 4, "egomotion": egomotion, "num_traj_samples": 1, "temperature": 0, "top_p": 1, "top_k": 1, "seed": 42, } response = infer(request, args.url) print(json.dumps(response, indent=2)) if __name__ == "__main__": main() ``` Run it from that directory, or pass `--sample-dir`. `--help` lists its options: ```bash python3 trajectory_http.py --help ``` All packaged host clients use one endpoint convention. HTTP clients send to `--url` when given, otherwise to `ALPAMAYO_HTTP_URL` (a complete inference URL), otherwise to `$NIM_URL/v1/infer`, otherwise to `http://localhost:8000/v1/infer`. gRPC clients use `--target`, then `ALPAMAYO_GRPC_TARGET`, then `GRPC_TARGET`. `ALPAMAYO_MODEL` supplies the served model ID where a client or payload needs one; set it from `GET /v1/models` for a renamed deployment: ```bash export ALPAMAYO_MODEL="$(curl --fail --silent "${NIM_URL}/v1/models" \ | python3 -c 'import json, sys; print(json.load(sys.stdin)["data"][0]["id"])')" ``` The reusable helper also sends JSON files made by the payload builder, including any of the five tasks: ```bash python3 http_client.py "$ALPAMAYO_OUT/alpamayo-request.json" ``` This helper uses curl's `Expect: 100-continue` handshake so the server can reject a request before uploading the large image payload. It retries only HTTP 429, honors `Retry-After` with bounded backoff and jitter, and applies a total deadline. It exposes other HTTP errors and does not replay connection failures whose execution outcome is unknown. It follows the endpoint convention above; `--timeout` controls the total deadline and `--retries` limits overload retries. Merely adding an `Expect` header to an arbitrary Python HTTP library is not a tested substitute for this transport: the client must implement the handshake. For clients without it, the server consumes and discards a bounded rejected upload so the client can finish sending and read the error. If the upload exceeds the drain size or time limit, the connection closes; prefer the helper above for early rejection of large bodies. ## Errors Inference endpoints use one JSON error envelope for HTTP 400, 413, 415, 422, 429, 500, and 503 responses: ```json { "error": { "message": "Actionable description", "type": "invalid_request_error", "code": 400 } } ``` **HTTP status codes returned by the inference endpoints** | Status | `error.type` | Condition | Example `error.message` | | --- | --- | --- | --- | | 400 | `invalid_request_error` | The body is valid JSON that passed model validation but cannot be executed: an image `data:` URL whose media type is not JPEG, PNG, WebP, or BMP (for example `image/tiff`; `image/jpg` is accepted as JPEG), an empty image (`images[i] is empty`), a remote `http(s)` image URL (remote image URLs are not fetched; inline the image as a base64 data URL), a data URL without the `;base64` marker such as `data:image/jpeg,`, an invalid base64 payload, mixed image resolutions, a `num_traj_samples` value that is not in `k_values`, an image smaller than 2 pixels on a side or with an aspect ratio above 200:1, or a prompt that exceeds the model's context limit. Also returned for a malformed `Content-Length` header (`Content-Length must be a non-negative integer.`, before admission) and for a body the JSON parser cannot process for a reason other than a syntax error, such as nesting that is too deep (`Request body could not be parsed as JSON; ...`). For a context-limit error, shorten the question or reduce the VQA image input as permitted by its camera layout; image tokens also count toward the limit. | `Unsupported image media type; expected JPEG, PNG, WebP, or BMP.` or `Profile bf16 supports num_traj_samples values [1]; got 4.` | | 413 | `invalid_request_error` | The request body exceeds `NIM_ALPAMAYO_HTTP_MAX_REQUEST_BYTES` (default 134217728 bytes). The size check uses `Content-Length` before reading the body when the header is present. Rejected uploads may be drained as described below. | `Request body is too large; the maximum is 134217728 bytes.` | | 415 | `invalid_request_error` | The HTTP `Content-Type` header is not `application/json` (or a `+json` type). This checks the transport envelope, not the image encoding inside the body. Rejected uploads may be drained. | `Content-Type must be application/json.` | | 422 | `invalid_request_error` | Request-model validation failed: an empty or `null` body (`Request body is empty; send a JSON object.`); a body that is not valid JSON, including truncated JSON and bytes that are not UTF-8 (`Request body is not valid JSON: Expecting value at character 9.`, with the character position); a JSON value that is not an object, such as an array or a string (`request: Input should be a valid dictionary or object to extract fields from`); schema, type, range, required fields, a field not accepted by the task, camera layout, incompatible `task`/`mode`, a `model` other than the served ID, `stream=true`, a non-`user` message role, an ego history whose last pose is not the origin with the identity rotation, a `num_traj_samples` outside 1 through 32 or not an integer, or `max_tokens` on a trajectory-producing request. Messages name the field and do not carry a `Value error,` prefix. | `request: max_tokens is not supported for trajectory-producing requests; omit it. The NIM uses an internal generation budget so the model can reach the trajectory trigger token.` | | 429 | `rate_limit_error` | `NIM_ALPAMAYO_VLLM_MAX_INFLIGHT` requests are already admitted. The response carries `Retry-After: 1`. The 415 check and the 400 and 413 checks on a declared `Content-Length` run before admission, but JSON parsing and schema validation (422) run after it, so while the queue is full a malformed HTTP body can receive 429 first. gRPC validates requests before admission. | `Inference admission limit reached; retry after 1 second.` | | 500 | `internal_server_error` | Backend inference failed or an unhandled server error occurred. | `Internal server error.` (HTTP wrapper) or `Internal model inference error.` (backend adapter). | | 503 | `service_unavailable_error` | The HTTP listener is running, but model loading or startup warmup is not complete, or the instance is draining, including admitted requests interrupted at the shutdown drain deadline. The response carries `Retry-After: 1`. | `Alpamayo model is not ready. Wait for /v1/health/ready to return HTTP 200 with status ready before sending inference.`, or `NIM is shutting down; retry on a ready instance.` for a request interrupted by shutdown. | Health endpoints use a separate status body rather than the inference error envelope. `GET /v1/health/ready` returns `message="ready"` with HTTP 200, `message="not ready"` with HTTP 503 during loading, `message="shutting down"` with HTTP 503 during draining, `message="backend unavailable"` with HTTP 503 after an unrecoverable backend failure, or `message="error"` with HTTP 503 when the backend health check raises an exception after the model was ready. The `object` field in the last case names the exception class. For 413, 415, 429 and 503, clients using `Expect: 100-continue` receive the error without uploading the body. For clients that upload immediately, the server discards up to 128 MiB for at most 10 seconds before closing an unfinished upload. Draining does not admit the request to the model or retain its body in memory. Clients must still handle transport failures and should not assume a failed connection means inference never ran. Media-type problems therefore surface as two different codes: HTTP 415 identifies the HTTP envelope, HTTP 400 identifies an image inside an otherwise valid body. Clients that branch on media type must handle both. An unknown route returns HTTP 404 and a wrong method, such as `GET /v1/infer`, returns HTTP 405 whose message lists the allowed methods. Both use the same `{"error": {...}}` envelope, as do HTTP 422 for a body that is not valid JSON and HTTP 400 for a body the parser cannot process. A connection failure such as curl status `000` is not an HTTP response: it generally means the service is not listening yet. Check readiness and container logs before retrying. An unrecoverable CUDA failure stops model readiness (`GET /v1/health/ready` returns HTTP 503) so an orchestrator can restart the container. `GET /v1/models` reports the shared inference admission limit as `max_inflight` (default `8`), including running and waiting requests. Requests execute serially; excess HTTP calls return 429 and gRPC calls return `RESOURCE_EXHAUSTED`. Use finite timeouts and honor `Retry-After` with bounded exponential backoff and jitter. See [Configuring a NIM](/nim/alpamayo/configuration) for queue sizing. ## Compatibility Endpoints `POST /v1/chat/completions` receives images through `messages[].content[].image_url` and Alpamayo trajectory fields through `nvext`. Only `role="user"` messages are supported; other roles return HTTP 422 instead of being interpreted as user input. Its assistant content is a JSON string containing trajectory data. `nvext` accepts `egomotion`, `num_traj_samples`, `nav_text`, `nav_guidance_weight`, `question` (`/v1/vqa` only; chat rejects it), `camera_order`, `num_frames_per_camera`, `seed`, and `top_k`. Common `temperature` and `top_p` controls stay at the top level of the compatibility request. `max_tokens` is accepted by `/v1/vqa` but must be omitted from trajectory requests to `/v1/chat/completions`. Accepted for OpenAI client compatibility: `image_url.detail` (ignored; images are processed at the model input resolution), `n` (only 1), and `presence_penalty` and `frequency_penalty` (only 0). Other OpenAI fields such as `tools`, `response_format` and `logprobs` return 422. `GET /v1/models/{model_id}` returns the served model; other IDs return 404. `POST /v1/vqa` receives text and images through the same message structure. Put the question in one user message. Several text parts in that message are joined with a newline; question text in more than one message returns 422. Images may be in any user message. It returns a `vqa.response` object with the original question, answer, model, and inference time. Both routes call the canonical inference implementation; they do not own separate model-serving paths. Both routes return top-level `inference_time` in seconds; chat also includes it in the assistant content JSON. `usage` reports VLM prompt and completion tokens, excluding diffusion sampling. It is independent of profiling and is omitted from the response when backend counts are unavailable; the schema declares it nullable, so clients should accept either a missing key or `null`. Canonical trajectory and VQA responses expose available counts as `metrics.vllm_prompt_tokens` and `metrics.vllm_generation_tokens`. When supplied, `model` must match `GET /v1/models` (default `nvidia/alpamayo-2-super`). With the default ID, requests may also name the earlier ID `nvidia/Alpamayo2-Super`; responses report the current ID. `NIM_SERVED_MODEL_NAME` changes the ID for discovery, HTTP, and gRPC and disables the earlier ID. Unknown IDs and `stream=true` fail validation. The downloadable static OpenAPI gives the default ID but does not constrain `model` to that ID, so an offline-generated client can also send the ID advertised by a renamed deployment. Runtime validation remains strict. Omit `stream` or set it to `false`; all endpoints return a complete response after inference, with no partial output or time-to-first-token. The following request bodies are generated from the runtime schema. Replace image placeholders with real data URLs. The chat example includes all 24 image slots and the 16-row ego history of the bundled sample scene (`sample_data/egomotion.json`). That history belongs to the sample images: when you send your own images, replace it with the measurements that belong to them, following [Preparing Inputs](/nim/alpamayo/preparing-inputs). A history that does not match the images, such as an all-zero (stationary) history for a moving scene, can produce a path that reverses while every comfort metric passes. The builder commands below produce a fully populated request from the bundled scene. ## Single-Image VQA Request — POST /v1/vqa ```json { "model": "nvidia/alpamayo-2-super", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What is in front of the ego vehicle?" }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } } ] } ], "stream": false, "nvext": { "camera_order": [ "front_wide" ], "num_frames_per_camera": 1 } } ``` For single-image VQA and grounding, start with `front_wide` frames with a 16:9 aspect ratio and evaluate the predictions on your data. With side, rear, or telephoto camera labels, or other aspect ratios, VQA answers can be wrong and grounding boxes can miss their targets; the reference model behaves the same. For VQA about other views, include those views in the six-camera layout. Grounding still requires exactly one camera; evaluate that camera's results separately. Refer to [Known Issues and Limitations](/nim/alpamayo/known-issues). ## Trajectory Chat Request — POST /v1/chat/completions The full request is also available as [chat.json](./examples/chat.json "download"). ```json { "model": "nvidia/alpamayo-2-super", "messages": [ { "role": "user", "content": [ { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } }, { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64," } } ] } ], "stream": false, "nvext": { "camera_order": [ "cross_left", "front_wide", "cross_right", "rear_left", "rear_right", "front_tele" ], "num_frames_per_camera": 4, "egomotion": { "ego_history_xyz": [ [ -18.089746475219727, -0.4672301113605499, -0.021044252440333366 ], [ -16.82553482055664, -0.39502185583114624, -0.022715702652931213 ], [ -15.568655967712402, -0.3283347189426422, -0.019421637058258057 ], [ -14.318451881408691, -0.26841649413108826, -0.017297325655817986 ], [ -13.072900772094727, -0.21442973613739014, -0.020710119977593422 ], [ -11.83272647857666, -0.16793948411941528, -0.026466522365808487 ], [ -10.600030899047852, -0.1273275911808014, -0.02839669957756996 ], [ -9.37673568725586, -0.09492343664169312, -0.024682441726326942 ], [ -8.163609504699707, -0.06837170571088791, -0.020592257380485535 ], [ -6.960309982299805, -0.04803149774670601, -0.017554620280861855 ], [ -5.766788482666016, -0.03123560920357704, -0.018503233790397644 ], [ -4.585227966308594, -0.018424803391098976, -0.017718859016895294 ], [ -3.417593002319336, -0.011007721535861492, -0.012691252864897251 ], [ -2.2651236057281494, -0.00536962877959013, -0.004786153789609671 ], [ -1.1257692575454712, -0.0016306949546560645, -0.0012290481245145202 ], [ 0.0, 0.0, 0.0 ] ], "ego_history_rot": [ [ [ 0.9982312917709351, -0.05939418077468872, 0.002572530647739768 ], [ 0.05943434312939644, 0.9980246424674988, -0.0203551035374403 ], [ -0.0013584742555394769, 0.020471999421715736, 0.9997894763946533 ] ], [ [ 0.9984926581382751, -0.054883264005184174, 0.0004582394321914762 ], [ 0.05488070845603943, 0.9982699751853943, -0.021097781136631966 ], [ 0.0007004683720879257, 0.021091127768158913, 0.9997773170471191 ] ], [ [ 0.9987396001815796, -0.050178900361061096, 0.0011320248013362288 ], [ 0.05019158497452736, 0.9985255002975464, -0.020680584013462067 ], [ -9.262667299481109e-05, 0.02071133628487587, 0.9997854828834534 ] ], [ [ 0.9989762306213379, -0.04508401080965996, 0.0037296719383448362 ], [ 0.04514680057764053, 0.9988008141517639, -0.018938584253191948 ], [ -0.002871372038498521, 0.01908757910132408, 0.9998136758804321 ] ], [ [ 0.9992015361785889, -0.03964563086628914, 0.004949464928358793 ], [ 0.03972576931118965, 0.9990607500076294, -0.017306150868535042 ], [ -0.004258702974766493, 0.017488954588770866, 0.9998379945755005 ] ], [ [ 0.9994035363197327, -0.03439022973179817, 0.003138734493404627 ], [ 0.03443321958184242, 0.9992964863777161, -0.0148613341152668 ], [ -0.002625441877171397, 0.014960546977818012, 0.9998846650123596 ] ], [ [ 0.9995741844177246, -0.02916845493018627, 0.0008035874925553799 ], [ 0.029177146032452583, 0.9994652271270752, -0.01476514432579279 ], [ -0.00037248129956424236, 0.01478230394423008, 0.9998906850814819 ] ], [ [ 0.9997125864028931, -0.023972472175955772, 0.00018501252634450793 ], [ 0.023972826078534126, 0.9996256232261658, -0.01318961288779974 ], [ 0.00013124436372891068, 0.013190257363021374, 0.9999129772186279 ] ], [ [ 0.9998170137405396, -0.01908956840634346, 0.001258057658560574 ], [ 0.019101934507489204, 0.9997604489326477, -0.010684940032660961 ], [ -0.0010537853231653571, 0.010707015171647072, 0.9999421238899231 ] ], [ [ 0.9998823404312134, -0.01504113432019949, 0.0030121668241918087 ], [ 0.015064592473208904, 0.9998551607131958, -0.007922873832285404 ], [ -0.0028925614897161722, 0.007967319339513779, 0.9999640583992004 ] ], [ [ 0.9999373555183411, -0.011011898517608643, 0.0019913162104785442 ], [ 0.011022866703569889, 0.9999236464500427, -0.005583754740655422 ], [ -0.0019296763930469751, 0.005605354905128479, 0.9999824166297913 ] ], [ [ 0.9999675750732422, -0.00804403331130743, -0.00040787315811030567 ], [ 0.008041025139391422, 0.9999437928199768, -0.006907804403454065 ], [ 0.00046341685811057687, 0.006904300302267075, 0.9999760389328003 ] ], [ [ 0.9999804496765137, -0.006209190934896469, -0.000734884524717927 ], [ 0.0062048607505857944, 0.99996417760849, -0.005755043122917414 ], [ 0.000770592363551259, 0.005750371143221855, 0.9999831914901733 ] ], [ [ 0.9999901056289673, -0.004186068195849657, 0.0014983292203396559 ], [ 0.0041923485696315765, 0.9999823570251465, -0.004213275853544474 ], [ -0.0014806657563894987, 0.004219515714794397, 0.9999899864196777 ] ], [ [ 0.9999937415122986, -0.0020431242883205414, 0.002896794816479087 ], [ 0.0020488451700657606, 0.9999959468841553, -0.001973348669707775 ], [ -0.00289275124669075, 0.0019792711827903986, 0.9999938607215881 ] ], [ [ 1.0, 0.0, 0.0 ], [ 0.0, 1.0, 0.0 ], [ 0.0, 0.0, 1.0 ] ] ] } } } ``` The packaged builder can create runnable compatibility requests as well. On the host it reads `ALPAMAYO_MODEL` for the `model` field; inside the container, pass `--model "$ALPAMAYO_MODEL"` explicitly: ```bash python3 build_http_payload.py --endpoint chat --sample-dir sample_data \ > "$ALPAMAYO_OUT/alpamayo-chat.json" curl --fail-with-body -sS "${NIM_URL}/v1/chat/completions" \ -H 'Content-Type: application/json' \ --data-binary "@$ALPAMAYO_OUT/alpamayo-chat.json" python3 build_http_payload.py --endpoint vqa --sample-dir sample_data \ --question 'What is ahead?' > "$ALPAMAYO_OUT/alpamayo-vqa-compat.json" curl --fail-with-body -sS "${NIM_URL}/v1/vqa" \ -H 'Content-Type: application/json' \ --data-binary "@$ALPAMAYO_OUT/alpamayo-vqa-compat.json" ``` ## gRPC The binary `nvidia.alpamayo.v1.Alpamayo/Predict` method serves trajectory inference. The request contains encoded camera images, ego-history data, sampling fields, and optional navigation text. The response contains serialized trajectories, rotations, reasoning, and metrics. Use the client bundled at `/opt/nim/test_grpc_api.py` as the executable protocol example; run it with `--help` for every option. It reads `GRPC_TARGET` and `ALPAMAYO_MODEL` like the other host clients. It sends `temperature`, `top_p`, `top_k` and `seed` only when you pass the matching flag, so by default the NIM applies its own defaults (temperature 0.6, top_p 0.98, top-k disabled, the container seed). For a repeatable single trajectory, pass `--temperature 0`. Navigation uses the `string nav_text = 6` field together with `optional double nav_guidance_weight = 16`; leave the weight unset for the NIM default of `3.0`. Both follow the HTTP validation rules above. The bundled client exposes them as `--nav-text` and `--nav-guidance-weight`. A non-empty request `model` must match the ID from `GET /v1/models`; unknown model IDs return `NOT_FOUND` instead of being silently ignored. The legacy gRPC `max_tokens` field is deprecated and must remain unset; a nonzero value returns `INVALID_ARGUMENT`. The method returns standard status codes: `OK` for success, `INVALID_ARGUMENT` for invalid inputs or unsupported profile values, `NOT_FOUND` for an unknown model, `RESOURCE_EXHAUSTED` for backpressure, `UNAVAILABLE` before model readiness and during shutdown, and `INTERNAL` for an invalid backend result. During shutdown, calls that are admitted but still queued behind the running request end as soon as draining starts, and the call executing at the drain deadline also ends; both return `UNAVAILABLE` with the message `NIM is shutting down; retry on a ready instance.`. The standard `grpc.health.v1` health service reports `NOT_SERVING` once the NIM is stopping. `RESOURCE_EXHAUSTED` and the shutdown `UNAVAILABLE` carry `retry-after: 1` trailing metadata. Requests are validated before they take an admission slot, so an invalid request returns `INVALID_ARGUMENT` even when the queue is full; only valid requests receive `RESOURCE_EXHAUSTED`. A `num_traj_samples` value that is not in the profile's `k_values` returns `INVALID_ARGUMENT`, also while the queue is full. Over HTTP, a full queue returns 429 before the request body is read. The gRPC port, including the `grpc.health.v1` service, opens only after the model is loaded. Before that, gRPC clients get a connection failure, which gRPC reports as `UNAVAILABLE`, so a gRPC health probe cannot tell a starting NIM from a stopped one. Use HTTP `GET /v1/health/ready` for startup and readiness probes. Download the exact [Alpamayo 2 Super protocol](./examples/alpamayo_grpc.proto "download") used by this release. This protocol is separate from Alpamayo 1.5. To generate Python bindings yourself, install `grpcio-tools` in the client virtual environment and run: ```bash PROTO_DIR=$(mktemp -d "${TMPDIR:-/tmp}/alpamayo-proto.XXXXXX") docker cp "${NIM_CONTAINER}:/opt/nim/alpamayo_grpc.proto" "$PROTO_DIR/alpamayo_grpc.proto" python3 -m venv "$PROTO_DIR/.venv" "$PROTO_DIR/.venv/bin/python" -m pip install grpcio-tools "protobuf>=5.29" "$PROTO_DIR/.venv/bin/python" -m grpc_tools.protoc \ -I"$PROTO_DIR" --python_out="$PROTO_DIR" "$PROTO_DIR/alpamayo_grpc.proto" ``` This writes the regenerated module into a fresh directory, preserving the shipped client module. Without a running container, download the linked `alpamayo_grpc.proto` into `$PROTO_DIR` before running the compiler. The container does not need the development compiler. ```protobuf syntax = "proto3"; package nvidia.alpamayo.v1; service Alpamayo { rpc Predict(PredictRequest) returns (PredictResponse); } message ImageFrame { string camera = 1; int32 timestep = 2; string mime_type = 3; bytes data = 4; } message CompressedImageInput { repeated ImageFrame frames = 1; } message LocalPathInput { // Scene directory with images/_t. and egomotion.json. Without // image_paths, the newest num_frames_per_camera frames of each camera are // used (t2, t3 of a four-frame scene for 2 frames). string scene_dir = 1; repeated string image_paths = 2; } message PredictRequest { reserved 11, 12; reserved "raw_rgb", "preprocessed"; string model = 1; int32 num_traj_samples = 2; optional float temperature = 3; optional float top_p = 4; // Deprecated: trajectory generation uses a NIM-owned token budget. Omit it. int32 max_tokens = 5 [deprecated = true]; string nav_text = 6; // Ego-motion history as JSON. Takes precedence over a local_paths.scene_dir // egomotion.json when both are present. string egomotion_json = 7; optional int64 seed = 8; repeated string camera_order = 9; int32 num_frames_per_camera = 14; optional int32 top_k = 15; // Classifier-free guidance weight for nav_text (0.0 through 10.0). Leave it // unset for the NIM default of 3.0; 1.0 renders nav_text without guidance. // Ignored when nav_text is empty. optional double nav_guidance_weight = 16; oneof input { CompressedImageInput compressed_images = 10; LocalPathInput local_paths = 13; } } message PredictResponse { string model = 1; string backend = 2; int32 num_samples = 3; int32 num_points = 4; float duration = 5; string reasoning_text = 6; float inference_time = 7; repeated float pred_trajectories = 8; repeated int64 pred_trajectories_shape = 9; string raw_json = 10; repeated float pred_rotations = 11; repeated int64 pred_rotations_shape = 12; } ``` ## Python gRPC Client Copy the protobuf module from the running image, install the client dependencies in a virtual environment (`numpy` is for the ego-motion conversion helper in [Preparing Inputs](/nim/alpamayo/preparing-inputs)), and download [trajectory_grpc.py](./examples/trajectory_grpc.py "download") alongside `sample_data`: ```bash export ALPAMAYO_CLIENT_DIR="${ALPAMAYO_CLIENT_DIR:-$PWD/alpamayo-client}" mkdir -p "$ALPAMAYO_CLIENT_DIR" && cd "$ALPAMAYO_CLIENT_DIR" mkdir -p sample_data docker cp "${NIM_CONTAINER}:/workspace/sample_data/." ./sample_data/ docker cp "${NIM_CONTAINER}:/opt/nim/trajectory_grpc.py" ./trajectory_grpc.py docker cp "${NIM_CONTAINER}:/opt/nim/alpamayo_grpc_pb2.py" ./alpamayo_grpc_pb2.py python3 -m venv .venv . .venv/bin/activate python3 -m pip install grpcio "protobuf>=5.29" pillow numpy python3 trajectory_grpc.py ``` This example sends the encoded image bytes without converting them and prints the trajectory response. It reads `GRPC_TARGET` (or `--target`) and `ALPAMAYO_MODEL` (or `--model`); an empty model selects the served model. The generated module must come from the same image version as the server. ```python #!/usr/bin/env python3 """Submit a compressed-image trajectory request using the packaged protobuf. Run from the directory containing sample_data and alpamayo_grpc_pb2.py, or pass --sample-dir. The target comes from --target, then ALPAMAYO_GRPC_TARGET, then GRPC_TARGET. An empty model selects the server's configured model. """ import argparse import json import mimetypes import os from pathlib import Path sample = Path("sample_data") cameras = [ "cross_left", "front_wide", "cross_right", "rear_left", "rear_right", "front_tele", ] def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--sample-dir", type=Path, default=sample, help="Directory containing images/ and egomotion.json") parser.add_argument( "--target", default=os.environ.get("ALPAMAYO_GRPC_TARGET") or os.environ.get("GRPC_TARGET") or "localhost:50051", help="gRPC host:port. Defaults to ALPAMAYO_GRPC_TARGET, then GRPC_TARGET, then localhost:50051", ) parser.add_argument( "--model", default=os.environ.get("ALPAMAYO_MODEL", ""), help="Served model ID from GET /v1/models. Defaults to ALPAMAYO_MODEL; " "empty selects the server's configured model", ) args = parser.parse_args() import grpc import alpamayo_grpc_pb2 as pb try: egomotion = (args.sample_dir / "egomotion.json").read_text() except OSError as exc: parser.error(f"Cannot read sample data: {exc}. Set --sample-dir to the extracted sample_data directory.") request = pb.PredictRequest( model=args.model, egomotion_json=egomotion, num_traj_samples=1, temperature=0, top_p=1, top_k=1, seed=42, camera_order=cameras, num_frames_per_camera=4, ) for camera in cameras: for timestep in range(4): for extension in (".jpg", ".jpeg", ".png", ".webp", ".bmp"): path = args.sample_dir / "images" / f"{camera}_t{timestep}{extension}" if path.is_file(): break else: parser.error(f"Missing {camera} frame {timestep} under {args.sample_dir / 'images'}") frame = request.compressed_images.frames.add() frame.camera = camera frame.timestep = timestep frame.mime_type = mimetypes.guess_type(path.name)[0] frame.data = path.read_bytes() with grpc.insecure_channel( args.target, options=[ ("grpc.max_receive_message_length", 128 * 1024 * 1024), ("grpc.max_send_message_length", 128 * 1024 * 1024), ], ) as channel: predict = channel.unary_unary( "/nvidia.alpamayo.v1.Alpamayo/Predict", request_serializer=pb.PredictRequest.SerializeToString, response_deserializer=pb.PredictResponse.FromString, ) try: response = predict(request, timeout=900) except grpc.RpcError as exc: raise SystemExit(f"{exc.code().name}: {exc.details()}") from None print(json.dumps(json.loads(response.raw_json), indent=2)) if __name__ == "__main__": main() ``` ## OpenAPI Schema This schema is generated from the NIM's request and response models and is also packaged at `/opt/nim/api_spec.yaml`. The gRPC protocol is packaged at `/opt/nim/alpamayo_grpc.proto`. The HTTP OpenAPI specification is available in the [API Reference](https://docs.nvidia.com/nim/alpamayo/2.0.0/api-reference/inference/infer) tab. ## Input Budgets and Defaults VQA and grounding requests must fit the configured context limit after image placeholders have been expanded. The budget includes the question, image tokens, prompt formatting, and requested `max_tokens` for the answer. Requests exceeding this budget return HTTP 400 before model inference. There is no fixed character cutoff: token counts depend on the text and image layout. Request-body size limits still apply. Shorten the question, reduce the VQA image/frame input, or lower `max_tokens`. An operator can also increase `NIM_ALPAMAYO_MAX_MODEL_LEN` from its default of 6144 up to 8192 and restart the NIM. The runtime sizes its KV cache for the selected context; the allocation can increase unless the profile already reserves a larger minimum. Increasing the context limit and KV-cache size consumes more GPU memory and may cause out-of-memory (OOM) failures. If already at the supported maximum, reduce the request instead. A valid token budget does not guarantee a useful answer. Long repetitive prompts and high temperatures can yield empty, irrelevant, or multilingual output. HTTP 200 means inference completed. Prefer concise factual driving questions and evaluate the returned text before consuming it as a label. `nav_text` and non-default `nav_guidance_weight` are only valid for trajectory-producing requests; invalid task combinations return HTTP 422. Greedy decoding (`temperature=0`) requires `num_traj_samples=1`. `GET /v1/models` exposes `default_seed`, the effective seed used when a request omits `seed` or supplies null. An explicit request seed takes precedence, including seed 0. The gRPC `model` field may be empty to select the single served model; this is the documented protobuf default. A nonempty value must match `GET /v1/models`. HTTP requests behave the same way: an omitted, `null` or empty `model` selects the served model. ## Route-Specific Fields and Input Precedence `model` and `stream` are accepted on every HTTP route, with the rules in the request table above. On the canonical route, omit `max_tokens` to use a text-task default; `max_tokens: null` also selects the default. A non-null value is rejected for trajectory requests. `POST /v1/chat/completions` generates trajectories and requires ego-motion. Use `POST /v1/vqa` for image questions, or the corresponding task on `POST /v1/infer`. Grounding, meta-action and auto-labeling use `/v1/infer`. The OpenAI SDK's default chat URL does not turn this trajectory adapter into a general chat service. Use one question source on `/v1/vqa`: message text or `nvext.question`. If both are supplied, they must agree; conflicting questions return HTTP 422. Likewise, duplicate top-level and `nvext` values for `seed` or `top_k` must agree. Identical duplicates are accepted; conflicts return HTTP 422. Do not expect chat text parts or `nvext.question` to override the trajectory task. An empty or whitespace-only `nav_text` is treated as absent. `nav_text` is limited to 1000 characters; keep it to a short navigation instruction. VQA and grounding reject non-null ego-motion and trajectory sample counts above 1. The inert defaults `num_traj_samples=1` and `nav_guidance_weight=3` are accepted. Integer controls, including sample/frame counts, `top_k` and `max_tokens`, do not coerce booleans, strings or floating-point numbers. The gRPC message limit is 134217728 bytes for sending and receiving; configure client limits accordingly. HTTP's default body limit has the same byte value, but counts the JSON/base64 envelope as well. Twenty-four uncompressed 1920×1080 BMP frames exceed both limits (about 149 MB of raw images, about 199 MB as base64 JSON). Use JPEG or WebP, or BMP frames of about 1280×720 or smaller; see [Request size and uncompressed images](/nim/alpamayo/preparing-inputs#request-size-and-uncompressed-images). For the full input conventions, including axes, frame timing and gRPC frame labels, see [Preparing Inputs](/nim/alpamayo/preparing-inputs). `/docs` is the only interactive schema viewer; `/redoc` is not served. `/docs` loads its assets from a public CDN, so for offline use retain the downloaded schema and this documentation rather than relying on the viewer. ## gRPC Local Paths and Defaults Prefer `compressed_images` for remote clients. `local_paths` names files inside the server container, not on the client machine. Local-path input is disabled unless the operator sets `NIM_ALPAMAYO_GRPC_LOCAL_PATH_ROOT` to an approved directory. Resolved paths, including symlink targets, must stay under that root. `local_paths.scene_dir` can name a mounted sample-style scene containing `images/_t.jpg` and `egomotion.json`. Without `image_paths`, the NIM reads the newest `num_frames_per_camera` frames of each camera from `scene_dir/images` (for 2 frames of a four-frame scene: `t2` and `t3`), so the frames end at the same time as the ego-motion history. A camera that lacks the scene's newest frame returns `INVALID_ARGUMENT`. Alternatively, set `local_paths.image_paths` explicitly; relative paths are resolved beneath `scene_dir` when supplied. Declare the camera layout and provide `egomotion_json` when there is no scene directory. If a request sets both `local_paths.scene_dir` and `egomotion_json`, `egomotion_json` is used and the scene directory's `egomotion.json` is ignored. For compressed frames, camera and timestep labels determine ordering when complete; array order alone is not a substitute for correct labels. Proto3 absent scalar fields have wire defaults. The adapter treats zero/unset `num_traj_samples` as 1 and zero/unset `num_frames_per_camera` as 4. Optional sampling fields preserve presence, so an explicit temperature of zero requests greedy decoding while an absent temperature uses the NIM default. An unset seed uses the configured default; an explicitly present seed 0 is valid.