> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo-platform/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo-platform/_mcp/server.

# Ingest Chat Completion

POST https://host.com/apis/intake/v2/workspaces/{workspace}/ingest/chat-completions
Content-Type: application/json

Reference: https://docs.nvidia.com/nemo-platform/nemo-platform/documentation/reference/api-reference/ingest/chat-completion-apis-intake-v-2-workspaces-workspace-ingest-chat-completions-post

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Nemo Platform API
  version: 1.0.0
paths:
  /apis/intake/v2/workspaces/{workspace}/ingest/chat-completions:
    post:
      operationId: >-
        chat-completion-apis-intake-v-2-workspaces-workspace-ingest-chat-completions-post
      summary: Ingest Chat Completion
      tags:
        - subpackage_ingest
      parameters:
        - name: workspace
          in: path
          required: true
          schema:
            type: string
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionsIngestResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionsIngestRequest'
servers:
  - url: https://host.com
    description: Default
components:
  schemas:
    ExperimentContext:
      type: object
      properties:
        experiment_id:
          type: string
          description: Name of an existing Experiment entity.
        test_case_id:
          type: string
          description: Optional producer-supplied test case id.
      required:
        - experiment_id
      description: Experiment context accepted by ingest endpoints.
      title: ExperimentContext
    EvaluationContext:
      type: object
      properties:
        evaluation_id:
          type: string
        evaluation_sha:
          type: string
        evaluation_run_id:
          type: string
        test_case_id:
          type: string
        metadata:
          type: object
          additionalProperties:
            description: Any type
      title: EvaluationContext
    ChatMessageRole:
      type: string
      enum:
        - user
        - system
        - assistant
        - developer
        - tool
        - function
      description: Valid role values for captured chat-completions messages.
      title: ChatMessageRole
    CapturedChatMessage:
      type: object
      properties:
        role:
          $ref: '#/components/schemas/ChatMessageRole'
          description: The role of the message sender.
      required:
        - role
      description: >-
        A flexible message model that requires a valid role field but allows
        provider-specific fields.
      title: CapturedChatMessage
    CapturedChatCompletionsRequest:
      type: object
      properties:
        messages:
          type: array
          items:
            $ref: '#/components/schemas/CapturedChatMessage'
          description: Messages comprising the conversation.
        model:
          type: string
          description: The model identifier used for this request.
      required:
        - messages
        - model
      description: Flexible captured chat-completions request.
      title: CapturedChatCompletionsRequest
    CapturedChatCompletionsResponse:
      oneOf:
        - description: Any type
        - description: Any type
      description: Flexible captured chat-completions response.
      title: CapturedChatCompletionsResponse
    ChatCompletionsIngestRequest:
      type: object
      properties:
        experiment_context:
          $ref: '#/components/schemas/ExperimentContext'
        evaluation_context:
          $ref: '#/components/schemas/EvaluationContext'
          description: >-
            Deprecated. Use experiment_context; when both are sent,
            experiment_context takes precedence.
        request:
          $ref: '#/components/schemas/CapturedChatCompletionsRequest'
        response:
          $ref: '#/components/schemas/CapturedChatCompletionsResponse'
        session_id:
          type: string
          description: >-
            Groups related chat-completions calls without forcing them into the
            same trace.
        trace_id:
          type: string
          description: >-
            Opt into joining an existing trace built via OTel or ATIF. This is
            not a grouping mechanism for chat-completions calls; use session_id
            to group related calls.
        provider:
          type: string
        cost_usd:
          type: number
          format: double
          description: >-
            Total estimated cost of this model call in USD. This matches ATIF
            step metrics; Intake stores it as semantic cost_total_usd on spans.
        cost_input_usd:
          type: number
          format: double
          description: Estimated input-token cost of this model call in USD.
        cost_output_usd:
          type: number
          format: double
          description: Estimated output-token cost of this model call in USD.
        cost_details:
          type: object
          additionalProperties:
            type: number
            format: double
          description: Additional estimated cost breakdown fields in USD.
      required:
        - request
        - response
      title: ChatCompletionsIngestRequest
    ChatCompletionsIngestResponse:
      type: object
      properties:
        session_id:
          type: string
        span_id:
          type: string
      required:
        - session_id
        - span_id
      title: ChatCompletionsIngestResponse
    ValidationErrorLocItems:
      oneOf:
        - type: string
        - type: integer
      title: ValidationErrorLocItems
    ValidationError:
      type: object
      properties:
        loc:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorLocItems'
        msg:
          type: string
        type:
          type: string
        input:
          description: Any type
        ctx:
          type: object
          additionalProperties:
            description: Any type
      required:
        - loc
        - msg
        - type
      title: ValidationError
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
      title: HTTPValidationError

```

## Examples



**Request**

```json
{
  "request": {
    "messages": [
      {
        "role": "user"
      }
    ],
    "model": "gpt-4o-mini"
  },
  "response": {
    "error": {}
  }
}
```

**Response**

```json
{
  "session_id": "session_9f8b7c6d4a2e3f1b",
  "span_id": "span_4e5d6f7a8b9c0d1e"
}
```

**SDK Code**

```python
import requests

url = "https://host.com/apis/intake/v2/workspaces/workspace/ingest/chat-completions"

payload = {
    "request": {
        "messages": [{ "role": "user" }],
        "model": "gpt-4o-mini"
    },
    "response": { "error": {} }
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript
const url = 'https://host.com/apis/intake/v2/workspaces/workspace/ingest/chat-completions';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"request":{"messages":[{"role":"user"}],"model":"gpt-4o-mini"},"response":{"error":{}}}'
};

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

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://host.com/apis/intake/v2/workspaces/workspace/ingest/chat-completions"

	payload := strings.NewReader("{\n  \"request\": {\n    \"messages\": [\n      {\n        \"role\": \"user\"\n      }\n    ],\n    \"model\": \"gpt-4o-mini\"\n  },\n  \"response\": {\n    \"error\": {}\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://host.com/apis/intake/v2/workspaces/workspace/ingest/chat-completions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"request\": {\n    \"messages\": [\n      {\n        \"role\": \"user\"\n      }\n    ],\n    \"model\": \"gpt-4o-mini\"\n  },\n  \"response\": {\n    \"error\": {}\n  }\n}"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://host.com/apis/intake/v2/workspaces/workspace/ingest/chat-completions")
  .header("Content-Type", "application/json")
  .body("{\n  \"request\": {\n    \"messages\": [\n      {\n        \"role\": \"user\"\n      }\n    ],\n    \"model\": \"gpt-4o-mini\"\n  },\n  \"response\": {\n    \"error\": {}\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://host.com/apis/intake/v2/workspaces/workspace/ingest/chat-completions', [
  'body' => '{
  "request": {
    "messages": [
      {
        "role": "user"
      }
    ],
    "model": "gpt-4o-mini"
  },
  "response": {
    "error": {}
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://host.com/apis/intake/v2/workspaces/workspace/ingest/chat-completions");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"request\": {\n    \"messages\": [\n      {\n        \"role\": \"user\"\n      }\n    ],\n    \"model\": \"gpt-4o-mini\"\n  },\n  \"response\": {\n    \"error\": {}\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "request": [
    "messages": [["role": "user"]],
    "model": "gpt-4o-mini"
  ],
  "response": ["error": []]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/apis/intake/v2/workspaces/workspace/ingest/chat-completions")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```