---
updatedAt: 2026-09-14T13:53:27.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/nemotron-parse",
    "description": "The NVIDIA NIM REST API. Please see https://docs.api.nvidia.com/nim/reference/nvidia-nemotron-parse 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 Software and Model Evaluation License Agreement",
      "url": "https://developer.download.nvidia.com/licenses/NVIDIA_Software_and_Model_Evaluation_License_Agreement.pdf"
    }
  },
  "servers": [
    {
      "url": "https://integrate.api.nvidia.com/v1/"
    }
  ],
  "tags": [
    {
      "name": "Multimodal API",
      "description": "This API performs inference using document content extraction models"
    }
  ],
  "paths": {
    "/chat/completions": {
      "post": {
        "tags": [
          "Multimodal API"
        ],
        "summary": "Request response from the model",
        "description": "Invokes inference using the model chat parameters.",
        "operationId": "nvidia-nemotron-parse-2_0-infer",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NIMLLMChatCompletionRequest"
              },
              "example": {
                "model": "nvidia/nemotron-parse-2.0",
                "messages": [
                  {
                    "role": "user",
                    "content": [
                      {
                        "type": "text",
                        "text": "</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>"
                      },
                      {
                        "type": "image_url",
                        "image_url": {
                          "url": "https://assets.ngc.nvidia.com/products/api-catalog/nemoretriever-parse/example_1.jpg"
                        }
                      }
                    ]
                  }
                ],
                "max_tokens": 1024,
                "temperature": 0
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Invocation is fulfilled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionStreamResponse"
                }
              }
            }
          },
          "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/ErrorResponse"
                },
                "example": {
                  "type": "urn:nvcf-worker-service:problem-details:unprocessable-entity",
                  "title": "Unprocessable Entity",
                  "status": 422,
                  "detail": "string",
                  "instance": "/v2/nvcf/pexec/functions/e598bfc1-b058-41af-869d-556d3c7e1b48",
                  "requestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
                }
              }
            }
          },
          "500": {
            "description": "The invocation ended with an error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "type": "urn:nvcf-worker-service:problem-details:internal-server-error",
                  "title": "Internal Server Error",
                  "status": 500,
                  "detail": "string",
                  "instance": "/v2/nvcf/pexec/functions/e598bfc1-b058-41af-869d-556d3c7e1b48",
                  "requestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
                }
              }
            }
          }
        },
        "x-nvai-meta": {
          "name": "Create chat completion",
          "returns": "Returns a [chat completion](/docs/api-reference/chat/object) object.\n",
          "path": "create",
          "examples": [
            {
              "name": "document1",
              "input": {
                "image": "https://assets.ngc.nvidia.com/products/api-catalog/nemoretriever-parse/example_1.jpg",
                "prompt": "</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>"
              },
              "requestJson": "{\n  \"model\": \"nvidia/nemotron-parse-2.0\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"<%- input.prompt %>\"\n        },\n        {\n          \"type\": \"image_url\",\n          \"image_url\": {\n            \"url\": \"<%- input.image %>\"\n          }\n        }\n      ]\n    }\n  ],\n  \"max_tokens\": 1024,\n  \"temperature\": 0\n}\n",
              "responseJson": "{\n  \"id\": \"chatcmpl-94444bbf3f421c5f\",\n  \"object\": \"chat.completion\",\n  \"created\": 1786657564,\n  \"model\": \"nvidia/nemotron-parse-2.0\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"<x_0.5312><y_0.1531>**CUDA C++ Programming Guide, Release 12.8**<x_0.7852><y_0.1648><class_Page-header>\\n\\n<x_0.2217><y_0.1984>\\\\begin{tabular}{cc}\\n**Thread Scope** & **Description**\\\\\\\\cuda::thread\\\\_scope::thread\\\\_scope\\\\_thread & Only the CUDA thread which initiated asynchronous op- erations synchronizes.\\\\\\\\cuda::thread\\\\_scope::thread\\\\_scope\\\\_block & All or any CUDA threads within the same thread block as the initiating thread synchronizes.\\\\\\\\cuda::thread\\\\_scope::thread\\\\_scope\\\\_device & All or any CUDA threads in the same GPU device as the initiating thread syn- chronizes.\\\\\\\\cuda::thread\\\\_scope::thread\\\\_scope\\\\_system & All or any CUDA or CPU threads in the same system as the initiating thread syn- chronizes.\\\\\\\\\\n\\\\end{tabular}<x_0.7842><y_0.418><class_Table>\\n\\n<x_0.2217><y_0.432>These thread scopes are implemented as extensions to standard C++ in the CUDA Standard C++ li- brary.<x_0.7852><y_0.4555><class_Text>\\n\\n<x_0.2217><y_0.482>## 5.6. Compute Capability<x_0.5039><y_0.5055><class_Section-header>\\n\\n<x_0.2217><y_0.5242>The _compute capability_ of a device is represented by a version number, also sometimes called its “SM version”. This version number identifies the features supported by the GPU hardware and is used by applications at runtime to determine which hardware features and/or instructions are available on the present GPU.<x_0.7852><y_0.5703><class_Text>\\n\\n<x_0.2217><y_0.5766>The compute capability comprises a major revision number X and a minor revision number Y and is denoted by X.Y.<x_0.7852><y_0.5992><class_Text>\\n\\n<x_0.2217><y_0.6062>Devices with the same major revision number are of the same core architecture. The major revision number is 9 for devices based on the _NVIDIA Hopper GPU_ architecture, 8 for devices based on the _NVIDIA Ampere GPU_ architecture, 7 for devices based on the _Volta_ architecture, 6 for devices based on the _Pascal_ architecture, 5 for devices based on the _Maxwell_ architecture, and 3 for devices based on the _Kepler_ architecture.<x_0.7852><y_0.6641><class_Text>\\n\\n<x_0.2217><y_0.6703>The minor revision number corresponds to an incremental improvement to the core architecture, possibly including new features.<x_0.7852><y_0.693><class_Text>\\n\\n<x_0.2217><y_0.7>_Turing_ is the architecture for devices of compute capability 7.5, and is an incremental update based on the _Volta_ architecture.<x_0.7852><y_0.7227><class_Text>\\n\\n<x_0.2217><y_0.7289>_CUDA-Enabled GPUs_ lists of all CUDA-enabled devices along with their compute capability. _Compute Capabilities_ gives the technical specifications of each compute capability.<x_0.7852><y_0.7516><class_Text>\\n\\n<x_0.2217><y_0.7695>**Note:** The compute capability version of a particular GPU should not be confused with the CUDA version (for example, CUDA 7.5, CUDA 8, CUDA 9), which is the version of the CUDA _software platform_. The CUDA platform is used by application developers to create applications that run on many generations of GPU architectures, including future GPU architectures yet to be invented. While new versions<x_0.7852><y_0.8156><class_Text>\\n\\n<x_0.2217><y_0.8438>**5.6. Compute Capability**<x_0.3633><y_0.8547><class_Page-footer>\\n\\n<x_0.7705><y_0.8445>19<x_0.7852><y_0.8539><class_Page-footer>\",\n        \"refusal\": null,\n        \"annotations\": null,\n        \"audio\": null,\n        \"function_call\": null,\n        \"reasoning\": null\n      },\n      \"logprobs\": null,\n      \"finish_reason\": \"stop\",\n      \"stop_reason\": null,\n      \"token_ids\": null,\n      \"routed_experts\": null\n    }\n  ],\n  \"service_tier\": null,\n  \"system_fingerprint\": \"vllm-0.24.0-4447e481\",\n  \"usage\": {\n    \"prompt_tokens\": 6,\n    \"total_tokens\": 683,\n    \"completion_tokens\": 677,\n    \"prompt_tokens_details\": null\n  },\n  \"prompt_logprobs\": null,\n  \"prompt_token_ids\": null,\n  \"prompt_text\": null,\n  \"kv_transfer_params\": null\n}\n"
            },
            {
              "name": "document2",
              "input": {
                "image": "https://assets.ngc.nvidia.com/products/api-catalog/nemotron-parse/example_2.jpg",
                "prompt": "</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>"
              },
              "requestJson": "{\n  \"model\": \"nvidia/nemotron-parse-2.0\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"<%- input.prompt %>\"\n        },\n        {\n          \"type\": \"image_url\",\n          \"image_url\": {\n            \"url\": \"<%- input.image %>\"\n          }\n        }\n      ]\n    }\n  ],\n  \"max_tokens\": 1024,\n  \"temperature\": 0\n}\n",
              "responseJson": "{\n  \"id\": \"chatcmpl-8b5e2de3961a811c\",\n  \"object\": \"chat.completion\",\n  \"created\": 1786657659,\n  \"model\": \"nvidia/nemotron-parse-2.0\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"<x_0.1162><y_0.0672>Appl. Sci. 2023, 13, 12967\\n4 of 21<x_0.8818><y_0.0766><class_Page-header>\\n\\n<x_0.3076><y_0.1148>Table 1. Adopted material properties.<x_0.5254><y_0.1258><class_Caption>\\n\\n<x_0.1514><y_0.1422>\\\\begin{tabular}{cccccc}\\n\\\\multirow{2}{*}{**Quantity**} & \\\\multirow{2}{*}{**Symbol**} & \\\\multirow{2}{*}{**Units**} & \\\\multicolumn{3}{c}{**Materials**}\\\\\\\\\\n{} & {} & {} & **Ti-6Al-4V** & **Al. 7075 T6** & **SikaPower®-1277**\\\\\\\\\\nModulus of elasticity & E & MPa & 115,000 & 71,955 ± 224 & 2280 ± 533\\\\\\\\\\nPoisson’s ratio & v & / & 0.34 & 0.3 & 0.33\\\\\\\\\\nUltimate tensile strength & σuts & MPa & 950 & 610 ± 15 & 35.7 ± 1.4\\\\\\\\\\nDensity & ρ & g/cc & 4.395 & 2.8 & 1.1\\\\\\\\\\nLoss factor & LF & / & 2.96 × 10−4 & 3.5 × 10−3 & 2 × 10−2\\\\\\\\\\nViscosity & V & Pa·s & / & / & 430 (at 20 °C)\\\\\\\\\\n\\\\end{tabular}<x_0.8701><y_0.2844><class_Table>\\n\\n<x_0.3066><y_0.3102>The adopted experimental equipment for performing VHCF tests was an ultrasonic\\nfatigue testing machine (UFTM). The UFTM is shown in Figure 1 and was developed at\\nPolitecnico di Torino for testing components in the chosen fatigue range. The UFTM can\\nperform tests at 20 ± 0.5 kHz under fully reversed tension–compression stress (R = −1),\\nwhich significantly reduces the testing time compared to conventional testing apparatuses.\\nTo perform fatigue tests, the UFTM adopts the following devices: (i) an electric generator\\n(Branson DCX 4 kW, not visible in Figure 1) which generates an electrical sinusoidal wave\\nat 20 kHz; (ii) a piezoelectric transducer, responsible for converting the electrical wave\\ninto a mechanical vibration; (iii) a booster and a horn made of Ti–6Al–4V that amplify and\\nconvey the vibration to the specimen under testing; (iv) the specimen under investigation,\\nwhich was designed for the UFTM resonance conditions; (v) a laser displacement sensor\\nthat measures the displacement at the specimen free end; (vi) vortex tubes to keep the\\ntemperature controlled in the range (20–24) ◦C; and (vii) a temperature sensor to observe\\nthe temperature evolution during the test execution.<x_0.8838><y_0.5156><class_Text>\\n\\n<x_0.1914><y_0.5578>Piezoelectric\\ntransducer<x_0.7666><y_0.5852><class_Text>\\n\\n<x_0.2334><y_0.643>Vortex tube<x_0.2998><y_0.6547><class_Text>\\n\\n<x_0.6846><y_0.6359>Booster<x_0.7305><y_0.6477><class_Text>\\n\\n<x_0.1826><y_0.6625>Horn<x_0.7119><y_0.6734><class_Text>\\n\\n<x_0.2021><y_0.6836>Temperature sensor<x_0.3154><y_0.6953><class_Text>\\n\\n<x_0.6758><y_0.6937>Specimen<x_0.7334><y_0.7055><class_Text>\\n\\n<x_0.6826><y_0.7211>Laser-displacement\\nsensor<x_0.7969><y_0.7469><class_Text>\\n\\n<x_0.3076><y_0.8336>Figure 1. The UFTM equipment [43].<x_0.5215><y_0.8445><class_Text>\\n\\n<x_0.3076><y_0.8586>Performing fatigue tests with the UFTM consists of the application of alternated stress\\nin specimens that are designed to work in resonance conditions. The specimen and the\\nvibration components are thus designed to have a resonance frequency corresponding to a\\nlongitudinal mode of vibration close to 20 kHz. Moreover, the UFTM adopts a closed-loop\\nproportional–integrative–derivative (PID) control logic where the displacement measured<x_0.8818><y_0.9305><class_Text>\",\n        \"refusal\": null,\n        \"annotations\": null,\n        \"audio\": null,\n        \"function_call\": null,\n        \"reasoning\": null\n      },\n      \"logprobs\": null,\n      \"finish_reason\": \"stop\",\n      \"stop_reason\": null,\n      \"token_ids\": null,\n      \"routed_experts\": null\n    }\n  ],\n  \"service_tier\": null,\n  \"system_fingerprint\": \"vllm-0.24.0-4447e481\",\n  \"usage\": {\n    \"prompt_tokens\": 6,\n    \"total_tokens\": 934,\n    \"completion_tokens\": 928,\n    \"prompt_tokens_details\": null\n  },\n  \"prompt_logprobs\": null,\n  \"prompt_token_ids\": null,\n  \"prompt_text\": null,\n  \"kv_transfer_params\": null\n}\n"
            }
          ],
          "templates": [
            {
              "title": "Default",
              "requestEjs": {
                "python": "<%\n  const req = request || {};\n  const model = req.model || \"nvidia/nemotron-parse-2.0\";\n  const defaultPrompt = \"</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>\";\n  const imagePart = { type: \"image_url\", image_url: { url: \"https://assets.ngc.nvidia.com/products/api-catalog/nemoretriever-parse/example_1.jpg\" } };\n  const rawMessages = Array.isArray(req.messages) ? req.messages : (typeof req.messages === \"string\" ? [{ role: \"user\", content: req.messages }] : []);\n  const toMessage = (msg) => {\n    const m = (msg && typeof msg === \"object\") ? msg : { content: msg };\n    const role = m.role || \"user\";\n    if (Array.isArray(m.content)) return { role, content: m.content };\n    const text = (m.content === undefined || m.content === null || String(m.content).trim() === \"\") ? defaultPrompt : String(m.content);\n    return role === \"user\" ? { role, content: [{ type: \"text\", text }, imagePart] } : { role, content: text };\n  };\n  const messages = (rawMessages.length ? rawMessages : [{ role: \"user\", content: defaultPrompt }]).map(toMessage);\n  const num = (v, d) => (v === undefined || v === null || v === \"\" || Number.isNaN(Number(v))) ? d : Number(v);\n  const temperature = num(req.temperature, 0);\n  const topP = num(req.top_p, 1);\n  const maxTokens = num(req.max_tokens, 1024);\n  const stream = req.stream === true || req.stream === \"true\";\n  const prettyJson = (value, level, py) => {\n    const pad = \" \".repeat(level);\n    const inner = \" \".repeat(level + 2);\n    if (value === null || value === undefined) return py ? \"None\" : \"null\";\n    if (typeof value === \"boolean\") return py ? (value ? \"True\" : \"False\") : String(value);\n    if (typeof value === \"number\") return String(value);\n    if (typeof value === \"string\") return JSON.stringify(value);\n    if (Array.isArray(value)) return value.length ? \"[\\n\" + value.map((v) => inner + prettyJson(v, level + 2, py)).join(\",\\n\") + \"\\n\" + pad + \"]\" : \"[]\";\n    const keys = Object.keys(value);\n    return keys.length ? \"{\\n\" + keys.map((k) => inner + JSON.stringify(k) + \": \" + prettyJson(value[k], level + 2, py)).join(\",\\n\") + \"\\n\" + pad + \"}\" : \"{}\";\n  };\n-%>\nfrom openai import OpenAI\n\nclient = OpenAI(\n  base_url = \"https://integrate.api.nvidia.com/v1\",\n  api_key = \"$NVIDIA_API_KEY\"\n)\n\nmessages = <%- prettyJson(messages, 0, true) %>\n\ncompletion = client.chat.completions.create(\n  model=\"<%- model %>\",\n  messages=messages,\n  temperature=<%- temperature %>,\n  top_p=<%- topP %>,\n  max_tokens=<%- maxTokens %>,\n  stream=<%- stream ? \"True\" : \"False\" %>\n)\n<% if (stream) { %>\nfor chunk in completion:\n  if not getattr(chunk, \"choices\", None):\n    continue\n  if chunk.choices[0].delta.content is not None:\n    print(chunk.choices[0].delta.content, end=\"\")\n<% } else { %>\nprint(completion.choices[0].message.content)\n<% } %>\n",
                "langChain": "<%\n  const req = request || {};\n  const model = req.model || \"nvidia/nemotron-parse-2.0\";\n  const defaultPrompt = \"</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>\";\n  const imagePart = { type: \"image_url\", image_url: { url: \"https://assets.ngc.nvidia.com/products/api-catalog/nemoretriever-parse/example_1.jpg\" } };\n  const rawMessages = Array.isArray(req.messages) ? req.messages : (typeof req.messages === \"string\" ? [{ role: \"user\", content: req.messages }] : []);\n  const toMessage = (msg) => {\n    const m = (msg && typeof msg === \"object\") ? msg : { content: msg };\n    const role = m.role || \"user\";\n    if (Array.isArray(m.content)) return { role, content: m.content };\n    const text = (m.content === undefined || m.content === null || String(m.content).trim() === \"\") ? defaultPrompt : String(m.content);\n    return role === \"user\" ? { role, content: [{ type: \"text\", text }, imagePart] } : { role, content: text };\n  };\n  const messages = (rawMessages.length ? rawMessages : [{ role: \"user\", content: defaultPrompt }]).map(toMessage);\n  const num = (v, d) => (v === undefined || v === null || v === \"\" || Number.isNaN(Number(v))) ? d : Number(v);\n  const temperature = num(req.temperature, 0);\n  const topP = num(req.top_p, 1);\n  const maxTokens = num(req.max_tokens, 1024);\n  const stream = req.stream === true || req.stream === \"true\";\n  const prettyJson = (value, level, py) => {\n    const pad = \" \".repeat(level);\n    const inner = \" \".repeat(level + 2);\n    if (value === null || value === undefined) return py ? \"None\" : \"null\";\n    if (typeof value === \"boolean\") return py ? (value ? \"True\" : \"False\") : String(value);\n    if (typeof value === \"number\") return String(value);\n    if (typeof value === \"string\") return JSON.stringify(value);\n    if (Array.isArray(value)) return value.length ? \"[\\n\" + value.map((v) => inner + prettyJson(v, level + 2, py)).join(\",\\n\") + \"\\n\" + pad + \"]\" : \"[]\";\n    const keys = Object.keys(value);\n    return keys.length ? \"{\\n\" + keys.map((k) => inner + JSON.stringify(k) + \": \" + prettyJson(value[k], level + 2, py)).join(\",\\n\") + \"\\n\" + pad + \"}\" : \"{}\";\n  };\n-%>\nfrom langchain_nvidia_ai_endpoints import ChatNVIDIA\n\nclient = ChatNVIDIA(\n  model=\"<%- model %>\",\n  api_key=\"$NVIDIA_API_KEY\",\n  temperature=<%- temperature %>,\n  top_p=<%- topP %>,\n  max_tokens=<%- maxTokens %>,\n)\n\nmessages = <%- prettyJson(messages, 0, true) %>\n<% if (stream) { %>\nfor chunk in client.stream(messages):\n  print(chunk.content, end=\"\")\n<% } else { %>\nresponse = client.invoke(messages)\nprint(response.content)\n<% } %>\n",
                "node.js": "<%\n  const req = request || {};\n  const model = req.model || \"nvidia/nemotron-parse-2.0\";\n  const defaultPrompt = \"</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>\";\n  const imagePart = { type: \"image_url\", image_url: { url: \"https://assets.ngc.nvidia.com/products/api-catalog/nemoretriever-parse/example_1.jpg\" } };\n  const rawMessages = Array.isArray(req.messages) ? req.messages : (typeof req.messages === \"string\" ? [{ role: \"user\", content: req.messages }] : []);\n  const toMessage = (msg) => {\n    const m = (msg && typeof msg === \"object\") ? msg : { content: msg };\n    const role = m.role || \"user\";\n    if (Array.isArray(m.content)) return { role, content: m.content };\n    const text = (m.content === undefined || m.content === null || String(m.content).trim() === \"\") ? defaultPrompt : String(m.content);\n    return role === \"user\" ? { role, content: [{ type: \"text\", text }, imagePart] } : { role, content: text };\n  };\n  const messages = (rawMessages.length ? rawMessages : [{ role: \"user\", content: defaultPrompt }]).map(toMessage);\n  const num = (v, d) => (v === undefined || v === null || v === \"\" || Number.isNaN(Number(v))) ? d : Number(v);\n  const temperature = num(req.temperature, 0);\n  const topP = num(req.top_p, 1);\n  const maxTokens = num(req.max_tokens, 1024);\n  const stream = req.stream === true || req.stream === \"true\";\n  const prettyJson = (value, level, py) => {\n    const pad = \" \".repeat(level);\n    const inner = \" \".repeat(level + 2);\n    if (value === null || value === undefined) return py ? \"None\" : \"null\";\n    if (typeof value === \"boolean\") return py ? (value ? \"True\" : \"False\") : String(value);\n    if (typeof value === \"number\") return String(value);\n    if (typeof value === \"string\") return JSON.stringify(value);\n    if (Array.isArray(value)) return value.length ? \"[\\n\" + value.map((v) => inner + prettyJson(v, level + 2, py)).join(\",\\n\") + \"\\n\" + pad + \"]\" : \"[]\";\n    const keys = Object.keys(value);\n    return keys.length ? \"{\\n\" + keys.map((k) => inner + JSON.stringify(k) + \": \" + prettyJson(value[k], level + 2, py)).join(\",\\n\") + \"\\n\" + pad + \"}\" : \"{}\";\n  };\n-%>\nimport OpenAI from 'openai';\n\nconst openai = new OpenAI({\n  apiKey: '$NVIDIA_API_KEY',\n  baseURL: 'https://integrate.api.nvidia.com/v1',\n})\n\nasync function main() {\n  const completion = await openai.chat.completions.create({\n    model: \"<%- model %>\",\n    messages: <%- prettyJson(messages, 4) %>,\n    temperature: <%- temperature %>,\n    top_p: <%- topP %>,\n    max_tokens: <%- maxTokens %>,\n    stream: <%- stream %>,\n  })\n<% if (stream) { %>\n  for await (const chunk of completion) {\n    process.stdout.write(chunk.choices[0]?.delta?.content || '')\n  }\n<% } else { %>\n  process.stdout.write(completion.choices[0]?.message?.content ?? '')\n<% } %>\n}\n\nmain();",
                "curl": "<%\n  const req = request || {};\n  const model = req.model || \"nvidia/nemotron-parse-2.0\";\n  const defaultPrompt = \"</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>\";\n  const imagePart = { type: \"image_url\", image_url: { url: \"https://assets.ngc.nvidia.com/products/api-catalog/nemoretriever-parse/example_1.jpg\" } };\n  const rawMessages = Array.isArray(req.messages) ? req.messages : (typeof req.messages === \"string\" ? [{ role: \"user\", content: req.messages }] : []);\n  const toMessage = (msg) => {\n    const m = (msg && typeof msg === \"object\") ? msg : { content: msg };\n    const role = m.role || \"user\";\n    if (Array.isArray(m.content)) return { role, content: m.content };\n    const text = (m.content === undefined || m.content === null || String(m.content).trim() === \"\") ? defaultPrompt : String(m.content);\n    return role === \"user\" ? { role, content: [{ type: \"text\", text }, imagePart] } : { role, content: text };\n  };\n  const messages = (rawMessages.length ? rawMessages : [{ role: \"user\", content: defaultPrompt }]).map(toMessage);\n  const num = (v, d) => (v === undefined || v === null || v === \"\" || Number.isNaN(Number(v))) ? d : Number(v);\n  const temperature = num(req.temperature, 0);\n  const topP = num(req.top_p, 1);\n  const maxTokens = num(req.max_tokens, 1024);\n  const stream = req.stream === true || req.stream === \"true\";\n  const prettyJson = (value, level, py) => {\n    const pad = \" \".repeat(level);\n    const inner = \" \".repeat(level + 2);\n    if (value === null || value === undefined) return py ? \"None\" : \"null\";\n    if (typeof value === \"boolean\") return py ? (value ? \"True\" : \"False\") : String(value);\n    if (typeof value === \"number\") return String(value);\n    if (typeof value === \"string\") return JSON.stringify(value);\n    if (Array.isArray(value)) return value.length ? \"[\\n\" + value.map((v) => inner + prettyJson(v, level + 2, py)).join(\",\\n\") + \"\\n\" + pad + \"]\" : \"[]\";\n    const keys = Object.keys(value);\n    return keys.length ? \"{\\n\" + keys.map((k) => inner + JSON.stringify(k) + \": \" + prettyJson(value[k], level + 2, py)).join(\",\\n\") + \"\\n\" + pad + \"}\" : \"{}\";\n  };\n  const body = { model, messages, temperature, top_p: topP, max_tokens: maxTokens, stream };\n-%>\ncurl https://integrate.api.nvidia.com/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $NVIDIA_API_KEY\" \\\n  -d '<%- prettyJson(body, 0).split(\"'\").join(\"'\\\"'\\\"'\") %>'\n"
              },
              "response": "{\n  \"id\": \"...\",\n  \"object\": \"chat.completion\",\n  \"created\": ...,\n  \"model\": \"nvidia/nemotron-parse-2.0\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"...\"\n      },\n      \"logprobs\": null,\n      \"finish_reason\": \"stop\",\n      \"stop_reason\": null\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 5,\n    \"total_tokens\": 35,\n    \"completion_tokens\": 30\n  },\n  \"prompt_logprobs\": null\n}\n"
            }
          ]
        }
      }
    }
  },
  "security": [
    {
      "Token": []
    }
  ],
  "components": {
    "securitySchemes": {
      "Token": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "ChatCompletionResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "object": {
            "type": "string",
            "enum": [
              "chat.completion"
            ],
            "const": "chat.completion",
            "title": "Object",
            "default": "chat.completion"
          },
          "created": {
            "type": "integer",
            "title": "Created"
          },
          "model": {
            "type": "string",
            "title": "Model"
          },
          "choices": {
            "items": {
              "$ref": "#/components/schemas/ChatCompletionResponseChoice"
            },
            "type": "array",
            "title": "Choices"
          },
          "usage": {
            "$ref": "#/components/schemas/UsageInfo"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "model",
          "choices",
          "usage"
        ],
        "title": "ChatCompletionResponse"
      },
      "ChatCompletionResponseChoice": {
        "properties": {
          "index": {
            "type": "integer",
            "title": "Index"
          },
          "message": {
            "$ref": "#/components/schemas/ChatMessage"
          },
          "finish_reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "stop",
                  "length"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Finish Reason"
          },
          "stop_reason": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop Reason"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "index",
          "message"
        ],
        "title": "ChatCompletionResponseChoice"
      },
      "ChatCompletionResponseStreamChoice": {
        "properties": {
          "index": {
            "type": "integer",
            "title": "Index"
          },
          "delta": {
            "$ref": "#/components/schemas/DeltaMessage"
          },
          "finish_reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "stop",
                  "length"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Finish Reason"
          },
          "stop_reason": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop Reason"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "index",
          "delta"
        ],
        "title": "ChatCompletionResponseStreamChoice"
      },
      "ChatCompletionStreamResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "object": {
            "type": "string",
            "enum": [
              "chat.completion.chunk"
            ],
            "const": "chat.completion.chunk",
            "title": "Object",
            "default": "chat.completion.chunk"
          },
          "created": {
            "type": "integer",
            "title": "Created"
          },
          "model": {
            "type": "string",
            "title": "Model"
          },
          "choices": {
            "items": {
              "$ref": "#/components/schemas/ChatCompletionResponseStreamChoice"
            },
            "type": "array",
            "title": "Choices"
          },
          "usage": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UsageInfo"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "model",
          "choices"
        ],
        "title": "ChatCompletionStreamResponse"
      },
      "ChatMessage": {
        "properties": {
          "role": {
            "type": "string",
            "title": "Role"
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "role"
        ],
        "title": "ChatMessage"
      },
      "DeltaMessage": {
        "properties": {
          "role": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Role"
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "DeltaMessage"
      },
      "ErrorResponse": {
        "properties": {
          "object": {
            "type": "string",
            "title": "Object",
            "default": "error"
          },
          "message": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Type"
          },
          "param": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Param"
          },
          "code": {
            "type": "integer",
            "title": "Code"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "message",
          "type",
          "code"
        ],
        "title": "ErrorResponse"
      },
      "ImageURL": {
        "properties": {
          "url": {
            "type": "string",
            "title": "Url"
          }
        },
        "type": "object",
        "required": [
          "url"
        ],
        "title": "ImageURL"
      },
      "NIMLLMChatCompletionMessage": {
        "properties": {
          "role": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Role"
              }
            ],
            "description": "The role of the message's author."
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/NIMVLMChatCompletionContentPartImage"
                    },
                    {
                      "$ref": "#/components/schemas/NIMVLMChatCompletionContentPartText"
                    }
                  ]
                },
                "type": "array",
                "contains": {
                  "$ref": "#/components/schemas/NIMVLMChatCompletionContentPartImage"
                },
                "minContains": 0,
                "maxContains": 1
              }
            ],
            "title": "Content",
            "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>    - The model processes a single document image per request: include at most one `image_url` part.\n<br>For `system` and `assistant` roles, the object list format is not supported.\n"
          }
        },
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "title": "NIMLLMChatCompletionMessage"
      },
      "NIMLLMChatCompletionRequest": {
        "properties": {
          "messages": {
            "items": {
              "$ref": "#/components/schemas/NIMLLMChatCompletionMessage"
            },
            "type": "array",
            "minItems": 1,
            "title": "Messages",
            "description": "A list of messages comprising the conversation so far."
          },
          "model": {
            "type": "string",
            "title": "Model",
            "description": "The model to use.",
            "default": "nvidia/nemotron-parse-2.0"
          },
          "frequency_penalty": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 2,
                "minimum": -2
              },
              {
                "type": "null"
              }
            ],
            "title": "Frequency Penalty",
            "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.",
            "default": 0
          },
          "max_tokens": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 8192,
                "minimum": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Tokens",
            "description": "The maximum number of tokens that can be generated.",
            "default": 3500
          },
          "presence_penalty": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 2,
                "minimum": -2
              },
              {
                "type": "null"
              }
            ],
            "title": "Presence Penalty",
            "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.",
            "default": 0
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 9223372036854776000,
                "minimum": -9223372036854776000
              },
              {
                "type": "null"
              }
            ],
            "title": "Seed",
            "description": "Changing the seed will produce a different response with similar characteristics. Fixing the seed will reproduce the same results if all other parameters are also kept constant."
          },
          "stop": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop",
            "description": "Sequences where the API will stop generating further tokens."
          },
          "stream": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stream",
            "description": "If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]`",
            "default": false
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 2,
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature",
            "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.",
            "default": 0
          },
          "top_p": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1,
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "title": "Top P",
            "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.",
            "default": 1
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "messages",
          "model"
        ],
        "title": "NIMLLMChatCompletionRequest"
      },
      "NIMVLMChatCompletionContentPartImage": {
        "properties": {
          "image_url": {
            "$ref": "#/components/schemas/ImageURL"
          },
          "type": {
            "type": "string",
            "enum": [
              "image_url"
            ],
            "const": "image_url",
            "title": "Type"
          }
        },
        "type": "object",
        "required": [
          "image_url",
          "type"
        ],
        "title": "NIMVLMChatCompletionContentPartImage"
      },
      "NIMVLMChatCompletionContentPartText": {
        "properties": {
          "text": {
            "type": "string",
            "title": "Text"
          },
          "type": {
            "type": "string",
            "enum": [
              "text"
            ],
            "const": "text",
            "title": "Type"
          }
        },
        "type": "object",
        "required": [
          "text",
          "type"
        ],
        "title": "NIMVLMChatCompletionContentPartText"
      },
      "Role": {
        "type": "string",
        "enum": [
          "assistant",
          "user"
        ],
        "title": "Role"
      },
      "UsageInfo": {
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "title": "Prompt Tokens",
            "default": 0
          },
          "total_tokens": {
            "type": "integer",
            "title": "Total Tokens",
            "default": 0
          },
          "completion_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completion Tokens",
            "default": 0
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "UsageInfo"
      }
    }
  }
}
```