---
title: "Run inference-only employee chat through an OpenAI-compatible shape"
description: "With `stream: true`, the successful response is `text/event-stream` containing OpenAI chat completion chunks followed by `[DONE]`; without streaming it is the JSON chat completion schema below."
---

> Documentation Index
> Fetch the complete documentation index at: https://tryshiba.dev/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Shiba public API › openai-compatible

`POST /chat/completions`

With `stream: true`, the successful response is `text/event-stream` containing OpenAI chat completion chunks followed by `[DONE]`; without streaming it is the JSON chat completion schema below.

## Authentication

Requires one of the following:

- `bearerAuth`, http, header `Authorization`, format `API key`
- `cookieAuth`, apiKey, in cookie

## Request body

_Required._

- `model` (`createOpenAiChatCompletion.model`; string, required)
  - minLength 1; maxLength 200
- `messages` (`createOpenAiChatCompletion.messages`; array<object>, required)
  - `role` (`createOpenAiChatCompletion.messages.role`; string, required)
    - one of `"system"`, `"user"`, `"assistant"`
  - `content` (`createOpenAiChatCompletion.messages.content`; string, required)
    - minLength 1; maxLength 12000
- `stream` (`createOpenAiChatCompletion.stream`; boolean, optional)
- `user` (`createOpenAiChatCompletion.user`; string, optional)
  - minLength 1; maxLength 200
- `conversationId` (`createOpenAiChatCompletion.conversationId`; string, optional)
  - minLength 1; maxLength 128

## Example request

```json
{
  "model": "string",
  "messages": [
    {
      "role": "system",
      "content": "string"
    }
  ],
  "stream": true,
  "user": "string",
  "conversationId": "string",
  "property1": null,
  "property2": null
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/api/v1/chat/completions' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "string",
  "messages": [
    {
      "role": "system",
      "content": "string"
    }
  ],
  "stream": true,
  "user": "string",
  "conversationId": "string",
  "property1": null,
  "property2": null
}
'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/chat/completions';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    model: 'string',
    messages: [{role: 'system', content: 'string'}],
    stream: true,
    user: 'string',
    conversationId: 'string',
    property1: null,
    property2: null
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/api/v1/chat/completions"

payload = {
    "model": "string",
    "messages": [
        {
            "role": "system",
            "content": "string"
        }
    ],
    "stream": True,
    "user": "string",
    "conversationId": "string",
    "property1": None,
    "property2": None
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

Success

#### Example

```json
{
  "id": "string",
  "object": "chat.completion",
  "created": 9007199254740991,
  "model": "string",
  "choices": [
    {
      "index": 9007199254740991,
      "message": {
        "role": "assistant",
        "content": "string"
      },
      "finish_reason": "stop"
    }
  ]
}
```

- `id` (`createOpenAiChatCompletion.response.200.id`; string, required)
- `object` (`createOpenAiChatCompletion.response.200.object`; string, required)
- `created` (`createOpenAiChatCompletion.response.200.created`; integer, required)
  - min 0; max 9007199254740991
- `model` (`createOpenAiChatCompletion.response.200.model`; string, required)
- `choices` (`createOpenAiChatCompletion.response.200.choices`; array<object>, required)
  - `index` (`createOpenAiChatCompletion.response.200.choices.index`; integer, required)
    - min 0; max 9007199254740991
  - `message` (`createOpenAiChatCompletion.response.200.choices.message`; object, required)
    - `role` (`createOpenAiChatCompletion.response.200.choices.message.role`; string, required)
    - `content` (`createOpenAiChatCompletion.response.200.choices.message.content`; string, required)
  - `finish_reason` (`createOpenAiChatCompletion.response.200.choices.finish_reason`; any of, required)
    - any of: `string`, `null`

### 400

Invalid request

#### Example

```json
{
  "ok": false,
  "error": "string",
  "detail": "string",
  "code": "string"
}
```

- `error` (`createOpenAiChatCompletion.response.400.error`; string, required)
- `ok` (`createOpenAiChatCompletion.response.400.ok`; boolean, optional)
- `detail` (`createOpenAiChatCompletion.response.400.detail`; string, optional)
- `code` (`createOpenAiChatCompletion.response.400.code`; string, optional)

### 404

Employee model not found

#### Example

```json
{
  "ok": false,
  "error": "string",
  "detail": "string",
  "code": "string"
}
```

- `error` (`createOpenAiChatCompletion.response.404.error`; string, required)
- `ok` (`createOpenAiChatCompletion.response.404.ok`; boolean, optional)
- `detail` (`createOpenAiChatCompletion.response.404.detail`; string, optional)
- `code` (`createOpenAiChatCompletion.response.404.code`; string, optional)


Source: https://tryshiba.dev/reference/api/openai-compatible/createOpenAiChatCompletion/index.md
