# Perform non-streaming chat completion inference on the service

**POST /_inference/chat_completion/{inference_id}**

The chat completion inference API enables rich responses for chat completion tasks.
It only works with the `chat_completion` task type.

NOTE: The `chat_completion` task type supports both streaming and non-streaming.
The Chat completion inference API provides more comprehensive customization options through more fields and function calling support.
To determine whether a given inference service supports this task type, please see the page for that service.

These services support non-streaming chat completion inference:
- AI21
- Azure OpenAI
- Deepseek
- Elastic
- FireworksAI
- Groq
- Huggingface
- IBMWatsonX
- Llama
- Mistral
- NVIDIA
- OpenAI
- OpenShiftAI


## Servers
- http://api.example.com: http://api.example.com ()


## Authentication methods
- Api key auth


## Parameters

### Path parameters

- **inference_id** (string)
  The inference Id


### Query parameters

- **timeout** (string)
  Specifies the amount of time to wait for the inference request to complete.


### Body: application/json (object)

- **messages** (array[object])
  A list of objects representing the conversation.
  Requests should generally only add new messages from the user (role `user`).
  The other message roles (`assistant`, `system`, or `tool`) should generally only be copied from the response to a previous completion request, such that the messages array is built up throughout a conversation.

- **model** (string)
  The ID of the model to use. By default, the model ID is set to the value included when creating the inference endpoint.

- **max_completion_tokens** (number)
  The upper bound limit for the number of tokens that can be generated for a completion request.

- **reasoning** (object)
  The reasoning configuration for the completion request.
  This controls the model's reasoning process in one of two ways:

  * By specifying the model’s reasoning effort level with the `effort` field.
  * By enabling reasoning with default settings by setting `enabled` field to `true`.

  It also includes optional settings to control:

  * The level of detail in the summary returned in the response with the `summary` field.
  * Whether reasoning details are included in the response at all with the `exclude` field.

  Example (effort):
  ```
  {
     "reasoning": {
         "effort": "high",
         "summary": "concise",
         "exclude": false
     }
  }
  ```
  Example (enabled):
  ```
  {
     "reasoning": {
         "enabled": true,
         "summary": "concise",
         "exclude": false
     }
  }
  ```
  Currently supported only for `elastic` provider.

- **stop** (array[string])
  A sequence of strings to control when the model should stop generating additional tokens.

- **temperature** (number)
  The sampling temperature to use.

- **tool_choice** (string | object)
  Controls which tool is called by the model.
  String representation: One of `auto`, `none`, or `requrired`. `auto` allows the model to choose between calling tools and generating a message. `none` causes the model to not call any tools. `required` forces the model to call one or more tools.
  Example (object representation):
  ```
  {
    "tool_choice": {
        "type": "function",
        "function": {
            "name": "get_current_weather"
        }
    }
  }
  ```

- **tools** (array[object])
  A list of tools that the model can call.
  Example:
  ```
  {
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_price_of_item",
                "description": "Get the current price of an item",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "item": {
                            "id": "12345"
                        },
                        "unit": {
                            "type": "currency"
                        }
                    }
                }
            }
        }
    ]
  }
  ```

- **top_p** (number)
  Nucleus sampling, an alternative to sampling with temperature.



## Responses
### 200


#### Body: application/json (object)
- **id** (string)
  The unique identifier for the completion.

- **choices** (array[object])
  The list of completion choices the model generated for the input message.

- **model** (string)
  The model used to generate the completion.

- **object** (string)
  The object type.

- **usage** (object)
  The token usage statistics for the completion request.
  Omitted when usage information is not available.



[Powered by Bump.sh](https://bump.sh)
