---
updatedAt: 2026-08-06T10:00:55.000Z
---

# Request response from the model

Invokes inference using the model chat parameters.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "NVIDIA NIM API for nvidia/neva-22b",
    "description": "The NVIDIA NIM REST API. Please see https://docs.api.nvidia.com/nim for more details.",
    "version": "1.0.0",
    "termsOfService": "https://nvidia.com/legal/terms-of-use",
    "contact": {
      "name": "NVIDIA Support",
      "url": "https://help.nvidia.com/"
    },
    "license": {
      "name": "NVIDIA AI Foundation Models Community License",
      "url": "https://docs.nvidia.com/ai-foundation-models-community-license.pdf"
    }
  },
  "servers": [
    {
      "url": "https://ai.api.nvidia.com/v1"
    }
  ],
  "tags": [
    {
      "name": "Multimodal API",
      "description": "This API performs inference using visual language understanding models"
    }
  ],
  "paths": {
    "/vlm/nvidia/neva-22b": {
      "post": {
        "tags": [
          "Multimodal API"
        ],
        "summary": "Request response from the model",
        "description": "Invokes inference using the model chat parameters.",
        "operationId": "invokeFunction",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Invocation is fulfilled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionChunk"
                }
              }
            }
          },
          "202": {
            "description": "Result is pending. Client should poll using the requestId.\n",
            "content": {
              "application/json": {
                "example": {},
                "schema": {}
              }
            },
            "headers": {
              "NVCF-REQID": {
                "description": "requestId required for pooling",
                "schema": {
                  "type": "string",
                  "format": "uuid",
                  "maxLength": 36
                }
              },
              "NVCF-STATUS": {
                "description": "Invocation status",
                "schema": {
                  "type": "string",
                  "format": "^[a-zA-Z-]{1,64}$",
                  "maxLength": 64
                }
              }
            }
          },
          "422": {
            "description": "Validation failed, provided entity could not be processed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                },
                "example": {
                  "type": "urn:nvcf-worker-service:problem-details:unprocessable-entity",
                  "title": "Unprocessable Entity",
                  "status": 422,
                  "detail": "string",
                  "instance": "/v2/nvcf/pexec/functions/bc205f8e-1740-40df-8d32-c4321763498a",
                  "requestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
                }
              }
            }
          },
          "500": {
            "description": "The invocation ended with an error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                },
                "example": {
                  "type": "urn:nvcf-worker-service:problem-details:internal-server-error",
                  "title": "Internal Server Error",
                  "status": 500,
                  "detail": "string",
                  "instance": "/v2/nvcf/pexec/functions/bc205f8e-1740-40df-8d32-c4321763498a",
                  "requestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
                }
              }
            }
          }
        },
        "x-nvai-meta": {
          "name": "Create chat completion",
          "returns": "Returns a [chat completion](/docs/api-reference/chat/object) object, or a streamed sequence of [chat completion chunk](/docs/api-reference/chat/streaming) objects if the request is streamed.\n",
          "path": "create",
          "examples": [
            {
              "name": "dog.jpg",
              "input": {
                "text": "Describe what you see in this image.",
                "image": "https://assets.ngc.nvidia.com/products/api-catalog/neva-22b/dog.jpg"
              },
              "output": {
                "text": "The image features a beautiful brown and white dog lying down on a lush green field. The dog appears to be enjoying the outdoors and is surrounded by a park-like setting. There are several people in the background, scattered throughout the scene, possibly enjoying the park as well. The dog's relaxed posture and the serene environment create a peaceful and inviting atmosphere."
              },
              "requestJson": "{ \"max_tokens\": 1024, \"temperature\": 0.2, \"top_p\": 0.2, \"messages\": [ { \"role\": \"user\", \"content\": [ { \"type\": \"text\", \"text\": \"<%- input.text %>\" }, { \"type\": \"image_url\", \"image_url\": { \"url\": \"<%- input.image %>\" } } ] } ], \"stream\": false }",
              "responseJson": "{ \"id\": \"d5b05074-e2e2-4b7f-a380-d27644a7ea11\", \"choices\": [ { \"index\": 0, \"message\": { \"role\": \"assistant\", \"content\": \"<%- output.text %>\" }, \"finish_reason\": \"stop\" } ], \"usage\": { \"completion_tokens\": 156, \"prompt_tokens\": 0, \"total_tokens\": 156 } }"
            },
            {
              "name": "cabin.jpg",
              "input": {
                "text": "What is wrong with the subject in the image? What can I do to fix it?",
                "image": "https://assets.ngc.nvidia.com/products/api-catalog/neva-22b/cabin.jpg"
              },
              "output": {
                "text": "The subject in the image is an old, abandoned wooden cabin or house that appears to be in a state of disrepair. It is surrounded by trees and bushes, and the wooden structure is covered in vines, indicating that it has been neglected for a long time. To fix the situation, the first step would be to clear the area around the cabin, removing the bushes and vines that have overgrown the structure. This will help expose the cabin and make it easier to assess the extent of the damage. Next, any necessary repairs or maintenance should be carried out to stabilize the structure and prevent further deterioration. Finally, the cabin could be restored or repurposed, depending on its condition and the goals of the person or organization involved."
              },
              "requestJson": "{ \"max_tokens\": 1024, \"temperature\": 0.2, \"top_p\": 0.2, \"messages\": [ { \"role\": \"user\", \"content\": [ { \"type\": \"text\", \"text\": \"<%- input.text %>\" }, { \"type\": \"image_url\", \"image_url\": { \"url\": \"<%- input.image %>\" } } ] } ], \"stream\": false }",
              "responseJson": "{ \"id\": \"d5b05074-e2e2-4b7f-a380-d27644a7ea11\", \"choices\": [ { \"index\": 0, \"message\": { \"role\": \"assistant\", \"content\": \"<%- output.text %>\" }, \"finish_reason\": \"stop\" } ], \"usage\": { \"completion_tokens\": 156, \"prompt_tokens\": 0, \"total_tokens\": 156 } }"
            }
          ],
          "templates": [
            {
              "title": "Default",
              "requestEjs": {
                "python": "<% let pyStream = request.stream.toString()[0].toUpperCase() + request.stream.toString().slice(1) %>\nimport requests, base64\n\ninvoke_url = \"https://ai.api.nvidia.com/v1/vlm/nvidia/neva-22b\"\nstream = <%- pyStream %>\n\nwith open(\"<%- request.image_name.replaceAll('\"', '\\\\\"') %>\", \"rb\") as f:\n    image_b64 = base64.b64encode(f.read()).decode()\n\nassert len(image_b64) < 180_000, \\\n  \"The encoded image is too large for this example.\"\n\nheaders = {\n  \"Authorization\": \"Bearer $NVIDIA_API_KEY\",\n  \"Accept\": \"text/event-stream\" if stream else \"application/json\"\n}\n\npayload = {\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": '<%- request.prompt.replaceAll(\"'\", \"\\\\'\") %>'\n        },\n        {\n          \"type\": \"image_url\",\n          \"image_url\": {\n            \"url\": f\"data:image/<%- request.image_name.split('.').pop() %>;base64,{image_b64}\"\n          }\n        }\n      ]\n    }\n  ],\n  \"max_tokens\": <%- request.max_tokens %>,\n  \"temperature\": <%- request.temperature.toFixed(2) %>,\n  \"top_p\": <%- request.top_p.toFixed(2) %>,\n  \"seed\": <%- request.seed %>,\n  \"stream\": stream\n}\n\nresponse = requests.post(invoke_url, headers=headers, json=payload)\n\nif stream:\n    for line in response.iter_lines():\n        if line:\n            print(line.decode(\"utf-8\"))\nelse:\n    print(response.json())\n",
                "node.js": "import axios from 'axios';\nimport { readFile } from 'node:fs/promises';\n\nconst invokeUrl = \"https://ai.api.nvidia.com/v1/vlm/nvidia/neva-22b\";\nconst stream = <%- request.stream %>;\n\nconst headers = {\n  \"Authorization\": \"Bearer $NVIDIA_API_KEY\",\n  \"Accept\": stream ? \"text/event-stream\" : \"application/json\"\n};\n\nreadFile(\"<%- request.image_name.replaceAll('\"', '\\\\\"') %>\")\n  .then(data => {\n    const imageB64 = Buffer.from(data).toString('base64');\n    if (imageB64.length > 180_000) {\n      throw new Error(\"The encoded image is too large for this example.\");\n    }\n\n    const payload = {\n      \"messages\": [\n        {\n          \"role\": \"user\",\n          \"content\": [\n            {\n              \"type\": \"text\",\n              \"text\": `<%- request.prompt %>`\n            },\n            {\n              \"type\": \"image_url\",\n              \"image_url\": {\n                \"url\": `data:image/<%- request.image_name.split('.').pop() %>;base64,${imageB64}`\n              }\n            }\n          ]\n        }\n      ],\n      \"max_tokens\": <%- request.max_tokens %>,\n      \"temperature\": <%- request.temperature.toFixed(2) %>,\n      \"top_p\": <%- request.top_p.toFixed(2) %>,\n      \"seed\": <%- request.seed %>,\n      \"stream\": stream\n    };\n\n    return axios.post(invokeUrl, payload, { headers: headers, responseType: stream ? 'stream' : 'json' });\n  })\n  .then(response => {\n    if (stream) {\n      response.data.on('data', (chunk) => {\n        console.log(chunk.toString());\n      });\n    } else {\n      console.log(JSON.stringify(response.data));\n    }\n  })\n  .catch(error => {\n    console.error(error);\n  });\n",
                "curl": "image_b64=$( base64 <%- request.image_name %> )\nstream=<%- request.stream %>\n\nif [ \"$stream\" = true ]; then\n    accept_header='Accept: text/event-stream'\nelse\n    accept_header='Accept: application/json'\nfi\n\necho '{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"<%- request.prompt.replaceAll('\"', '\\\\\"').replaceAll(\"'\", \"'\\\"'\\\"'\") %> \"\n        },\n        {\n          \"type\": \"image_url\",\n          \"image_url\": {\n            \"url\": \"data:image/<%- request.image_name.split('.').pop() %>;base64,'\"$image_b64\"'\"\n          }\n        }\n      ]\n    }\n  ],\n  \"max_tokens\": <%- request.max_tokens %>,\n  \"temperature\": <%- request.temperature.toFixed(2) %>,\n  \"top_p\": <%- request.top_p.toFixed(2) %>,\n  \"seed\": <%- request.seed %>,\n  \"stream\": <%- request.stream %>\n}' > payload.json\n\ncurl https://ai.api.nvidia.com/v1/vlm/nvidia/neva-22b \\\n  -H \"Authorization: Bearer $NVIDIA_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"$accept_header\" \\\n  -d @payload.json\n"
              },
              "response": "{\n  \"choices\": [{\n    \"index\": 0,\n    \"message\": {\n      \"role\": \"assistant\",\n      \"content\": \"...\",\n    },\n    \"finish_reason\": \"stop\"\n  }],\n  \"usage\": {\n    \"prompt_tokens\": 9,\n    \"completion_tokens\": 12,\n    \"total_tokens\": 21\n  }\n}\n"
            }
          ]
        }
      }
    }
  },
  "security": [
    {
      "Token": []
    }
  ],
  "components": {
    "securitySchemes": {
      "Token": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Errors": {
        "properties": {
          "type": {
            "type": "string",
            "format": "^.{1, 128}$",
            "maxLength": 128,
            "description": "Error type"
          },
          "title": {
            "type": "string",
            "format": "^.{1, 128}$",
            "maxLength": 128,
            "description": "Error title"
          },
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 999,
            "description": "Error status code"
          },
          "detail": {
            "type": "string",
            "format": "^.{1, 1024}$",
            "maxLength": 1024,
            "description": "Detailed information about the error"
          },
          "instance": {
            "type": "string",
            "format": "^.{1, 256}$",
            "maxLength": 256,
            "description": "Function instance used to invoke the request"
          },
          "requestId": {
            "type": "string",
            "format": "uuid",
            "maxLength": 36,
            "description": "UUID of the request"
          }
        },
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "instance",
          "requestId"
        ],
        "title": "InvokeError"
      },
      "ChatCompletion": {
        "properties": {
          "id": {
            "description": "A unique identifier for the completion.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "choices": {
            "description": "The list of completion choices the model generated for the input prompt.",
            "items": {
              "$ref": "#/components/schemas/Choice"
            },
            "maxItems": 1,
            "title": "Choices",
            "type": "array"
          },
          "usage": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Usage"
              }
            ],
            "description": "Usage statistics for the completion request."
          }
        },
        "required": [
          "id",
          "choices",
          "usage"
        ],
        "title": "ChatCompletion",
        "type": "object"
      },
      "ChatCompletionChunk": {
        "properties": {
          "id": {
            "description": "A unique identifier for the completion.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "choices": {
            "description": "The list of completion choices the model generated for the input prompt.",
            "items": {
              "$ref": "#/components/schemas/ChoiceChunk"
            },
            "maxItems": 1,
            "title": "Choices",
            "type": "array"
          }
        },
        "required": [
          "id",
          "choices"
        ],
        "title": "ChatCompletionChunk",
        "type": "object"
      },
      "ChatRequest": {
        "additionalProperties": false,
        "properties": {
          "messages": {
            "description": "A list of messages comprising the conversation so far. The roles of the messages must be alternating between `user` and `assistant`. The last input message should have role `user` or `assistant`. A message with the `system` role is optional, and must be the very first message if it is present.",
            "examples": [
              [
                {
                  "content": [
                    {
                      "type": "text",
                      "text": "Hi! What is in this image?"
                    },
                    {
                      "type": "image_url",
                      "image_url": {
                        "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=="
                      }
                    }
                  ],
                  "name": null,
                  "role": "user"
                }
              ],
              [
                {
                  "content": [
                    {
                      "type": "text",
                      "text": "Hi! What is in this image?"
                    },
                    {
                      "type": "image_url",
                      "image_url": {
                        "url": "data:image/png;base64,{base64encodedimage}"
                      }
                    }
                  ],
                  "name": null,
                  "role": "user"
                }
              ]
            ],
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "minItems": 1,
            "title": "Messages",
            "type": "array"
          },
          "temperature": {
            "default": 0.2,
            "description": "The sampling temperature to use for text generation. The higher the temperature value is, the less deterministic the output text will be. It is not recommended to modify both temperature and top_p in the same call.",
            "maximum": 1,
            "minimum": 0,
            "title": "Temperature",
            "type": "number"
          },
          "top_p": {
            "default": 0.7,
            "description": "The top-p sampling mass used for text generation. The top-p value determines the probability mass that is sampled at sampling time. For example, if top_p = 0.2, only the most likely tokens (summing to 0.2 cumulative probability) will be sampled. It is not recommended to modify both temperature and top_p in the same call.",
            "maximum": 1,
            "minimum": 0,
            "title": "Top P",
            "type": "number"
          },
          "max_tokens": {
            "default": 1024,
            "description": "The maximum number of tokens to generate in any given call. Note that the model is not aware of this value, and generation will simply stop at the number of tokens specified.",
            "maximum": 1024,
            "minimum": 1,
            "title": "Max Tokens",
            "type": "integer"
          },
          "seed": {
            "anyOf": [
              {
                "maximum": 18446744073709552000,
                "minimum": 0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result.",
            "examples": [
              42
            ],
            "title": "Seed"
          },
          "stream": {
            "default": false,
            "description": "If set, partial message deltas will be sent. Tokens will be sent as data-only server-sent events (SSE) as they become available (JSON responses are prefixed by `data: `), with the stream terminated by a `data: [DONE]` message.",
            "title": "Stream",
            "type": "boolean"
          }
        },
        "required": [
          "messages"
        ],
        "title": "ChatRequest",
        "type": "object"
      },
      "Choice": {
        "properties": {
          "index": {
            "default": 0,
            "description": "The index of the choice in the list of choices (always 0).",
            "exclusiveMaximum": 1,
            "minimum": 0,
            "title": "Index",
            "type": "integer"
          },
          "message": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Message"
              }
            ],
            "description": "A chat completion message generated by the model.",
            "examples": [
              {
                "content": "The image features a gray and white checkered pattern on a white background.",
                "name": null,
                "role": "assistant"
              }
            ]
          },
          "finish_reason": {
            "anyOf": [
              {
                "enum": [
                  "stop",
                  "length"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, or `length` if the maximum number of tokens specified in the request was reached.",
            "examples": [
              "stop"
            ],
            "title": "Finish Reason"
          }
        },
        "required": [
          "message"
        ],
        "title": "Choice",
        "type": "object"
      },
      "ChoiceChunk": {
        "properties": {
          "index": {
            "default": 0,
            "description": "The index of the choice in the list of choices (always 0).",
            "exclusiveMaximum": 1,
            "minimum": 0,
            "title": "Index",
            "type": "integer"
          },
          "delta": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Message"
              }
            ],
            "description": "A chat completion delta generated by streamed model responses.",
            "examples": [
              {
                "content": "The",
                "name": null,
                "role": "assistant"
              }
            ]
          },
          "finish_reason": {
            "anyOf": [
              {
                "enum": [
                  "stop",
                  "length"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, or `length` if the maximum number of tokens specified in the request was reached. Will be `null` if the model has not finished generating.",
            "title": "Finish Reason"
          }
        },
        "required": [
          "delta"
        ],
        "title": "ChoiceChunk",
        "type": "object"
      },
      "Message": {
        "additionalProperties": false,
        "properties": {
          "role": {
            "description": "The role of the message author.",
            "enum": [
              "system",
              "user",
              "assistant"
            ],
            "title": "Role",
            "type": "string"
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/UserTextContent"
                    },
                    {
                      "$ref": "#/components/schemas/UserImageContent"
                    }
                  ]
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The contents of the message.\n<br>To pass media (only with role=`user`):\n<br>    - Use content parts. Text is passed with `type`=`text`.\n<br>    - Images are passed with `type`=`image_url`; set `image_url.url` to an image URL or a base64 data URI like `data:image/{format};base64,{base64encodedimage}`.\n<br>For `system` and `assistant` roles, the object list format is not supported.\n",
            "title": "Content"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The name of the author of this message. Cannot be used with role=`system`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.",
            "title": "Name"
          }
        },
        "required": [
          "role"
        ],
        "title": "Message",
        "type": "object"
      },
      "Usage": {
        "properties": {
          "completion_tokens": {
            "description": "Number of tokens in the generated completion.",
            "examples": [
              19
            ],
            "maximum": 1024,
            "minimum": 0,
            "title": "Completion Tokens",
            "type": "integer"
          },
          "prompt_tokens": {
            "description": "Number of tokens in the prompt.",
            "examples": [
              46
            ],
            "maximum": 3072,
            "minimum": 0,
            "title": "Prompt Tokens",
            "type": "integer"
          },
          "total_tokens": {
            "description": "Total number of tokens used in the request (prompt + completion).",
            "examples": [
              65
            ],
            "maximum": 4096,
            "minimum": 0,
            "title": "Total Tokens",
            "type": "integer"
          }
        },
        "required": [
          "completion_tokens",
          "prompt_tokens",
          "total_tokens"
        ],
        "title": "Usage",
        "type": "object"
      },
      "UserImageContent": {
        "additionalProperties": false,
        "properties": {
          "type": {
            "const": "image_url",
            "description": "The type of the content part.",
            "title": "Type"
          },
          "image_url": {
            "additionalProperties": false,
            "properties": {
              "url": {
                "description": "The image URL or base64 data URI.",
                "maxLength": 204800,
                "title": "Url",
                "type": "string"
              }
            },
            "required": [
              "url"
            ],
            "title": "Image Url",
            "type": "object"
          }
        },
        "required": [
          "type",
          "image_url"
        ],
        "title": "UserImageContent",
        "type": "object"
      },
      "UserTextContent": {
        "additionalProperties": false,
        "properties": {
          "type": {
            "const": "text",
            "description": "The type of the content part.",
            "title": "Type"
          },
          "text": {
            "description": "The text content.",
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "type",
          "text"
        ],
        "title": "UserTextContent",
        "type": "object"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```