# Making Requests to the i14 API: Chat Completions Guide

> Learn how to structure requests to the i14 API, pass parameters, and handle responses for chat completions with Sugar Glider.

Source: https://i14.ai/docs/api-usage/making-requests/

The i14 API is OpenAI-compatible. If you’ve used the OpenAI API, the request format will feel familiar - only the base URL and model ID are different. You can migrate existing OpenAI integrations by swapping two values and be up and running immediately.

## Base URL

All requests are made to the following base URL:

```plaintext
https://api.i14.ai/v1
```

To get your API key, see [Get your API key](https://i14.ai/docs/authentication/#get-your-api-key).

## Request Format

Send a `POST` request to `/v1/chat/completions` with your API key in the `Authorization` header and a JSON body containing the model, messages, and any optional parameters.

macOS and Linux (bash or zsh)

```bash
curl https://api.i14.ai/v1/chat/completions \
  -H "Authorization: Bearer $I14_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "i14-sugarglider-nemotron3-super-120b-v1",
    "messages": [
      { "role": "system", "content": "You are a helpful assistant." },
      { "role": "user", "content": "What is the capital of France?" }
    ],
    "temperature": 0.7,
    "max_tokens": 2048
  }'
```

## Key Parameters

`model` (string, required)

The model ID to use for the completion. Use `i14-sugarglider-nemotron3-super-120b-v1`.

`messages` (array, required)

An array of message objects that form the conversation history. Each object must include a `role` (`system`, `user`, or `assistant`) and a `content` string. Sugar Glider (`i14-sugarglider-nemotron3-super-120b-v1`) accepts text only.

`temperature` (number)

Sampling temperature between `0` and `2`. Higher values produce more creative output; lower values produce more deterministic output. Defaults to `1`.

`max_tokens` (integer)

The maximum number of tokens to generate in the response. Set it explicitly for predictable output length. When thinking is enabled, reasoning tokens count toward the limit, so leave room for both reasoning and the visible answer.

`stream` (boolean)

Set to `true` to receive the response as a stream of Server-Sent Events (SSE). See the [Streaming](https://i14.ai/docs/api-usage/streaming/) page for details.

`top_p` (number)

Nucleus sampling threshold. The model considers only the tokens comprising the top `top_p` probability mass. Defaults to `1`.

## Response

A successful non-streaming request returns a JSON object like the following:

```json
{
  "id": "req_fbc98589b09740fd8eda2e28d6306ec8",
  "object": "chat.completion",
  "created": 1791426828,
  "model": "i14-sugarglider-nemotron3-super-120b-v1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "\n\nThe capital of France is Paris. It is the country's political, cultural, and economic center, housing major government institutions such as the Élysée Palace (the presidential residence) and the National Assembly. Paris has been the capital since the Middle Ages and remains a global hub for art, fashion, and history.",
        "reasoning_content": "Okay, the user is asking for the capital of France. Let me start by re..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 44,
    "completion_tokens": 369,
    "total_tokens": 413,
    "completion_tokens_details": {
      "reasoning_tokens": 305
    }
  },
  "x_i14_perf": {
    "tokens_per_second": 36.227,
    "generation_time_s": 10.1859,
    "time_to_first_token_s": 0.1052
  }
}
```

The `choices[0].message.content` field contains the model’s answer. The `choices[0].message.reasoning_content` field, when present, contains separately emitted reasoning. The example is trimmed: the real `reasoning_content` is longer. The `usage` object reports token counts for the request, which you can use for cost tracking. The i14-specific `x_i14_perf` object reports generation speed and timing; it contains additional fields beyond the three shown here.

## Using the OpenAI SDK

Because the i14 API is OpenAI-compatible, you can use the official OpenAI SDK in any language by pointing it at the i14 base URL. Pass your i14 API key as the `api_key` argument.

* Python

  ```python
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["I14_API_KEY"],
      base_url="https://api.i14.ai/v1",
  )

  response = client.chat.completions.create(
      model="i14-sugarglider-nemotron3-super-120b-v1",
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "What is the capital of France?"},
      ],
      temperature=0.7,
      max_tokens=2048,
  )

  print(response.choices[0].message.content)
  ```

* Node.js

  ```javascript
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.I14_API_KEY,
    baseURL: "https://api.i14.ai/v1",
  });

  const response = await client.chat.completions.create({
    model: "i14-sugarglider-nemotron3-super-120b-v1",
    messages: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: "What is the capital of France?" },
    ],
    temperature: 0.7,
    max_tokens: 2048,
  });

  console.log(response.choices[0].message.content);
  ```
