# Sohbet tamamlama isteği oluşturun

**API:** Model API

**Endpoint:** `POST /api/v1/chat/completions`

OpenAI uyumlu Chat Completions API'si. Server-Sent Events almak için stream=true ayarlayın. Yanıt ve hata zarfı Chat Completions/OpenAI uyumlu biçimi izler.

## Base URL

- `https://openapi.felo.ai` — Üretim

## Authentication

- `FeloBearerAuth` (http bearer) — `Authorization: Bearer <key>` biçiminde gönderilen Felo API anahtarı.
- `FeloApiKey` (apiKey in header `X-API-Key`) — `X-API-Key: <key>` biçiminde gönderilen Felo API anahtarı.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `X-Felo-Channel` | header | no | string, default: "default" | Virgülle ayrılmış sıralı genel kanal kodları. Varsayılanı kullanmak için bu başlığı atlayın; default tek başına kullanılmalıdır. Cüzdan modunda default, modelin geçerli genel kanal sırasını tersten tarar, yayımlanmamış veya kullanılamayan kanalları atlar ve ilk kullanılabilir kanalın sağlayıcısını seçer. Aynı üst kaynak model kimliğine ve hizmet katmanına sahip, o sağlayıcıya ait kullanılabilir uç noktaları içerir. Açıkça belirtilen kanallar istemcinin belirttiği sırayla doğrulanır; yalnızca ilk kanalın sağlayıcı grubu gönderilir. Diğer sağlayıcılara otomatik geçiş yapılmaz. Eski sağlayıcı başlıkları kanal yönlendirmesini geçersiz kılamaz. |

## Request body

Required: **yes**

### application/json

Schema: `ChatCompletionRequest` (`#/components/schemas/ChatCompletionRequest`)

```json
{
  "type": "object",
  "required": [
    "model",
    "messages"
  ],
  "properties": {
    "model": {
      "type": "string"
    },
    "messages": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/ChatMessage"
      }
    },
    "stream": {
      "type": "boolean",
      "default": false
    },
    "temperature": {
      "type": "number",
      "minimum": 0
    },
    "top_p": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "n": {
      "type": "integer",
      "minimum": 1
    },
    "max_tokens": {
      "type": "integer",
      "minimum": 1
    },
    "max_completion_tokens": {
      "type": "integer",
      "minimum": 1
    },
    "stop": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "tool_choice": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "additionalProperties": true
        }
      ]
    },
    "response_format": {
      "type": "object",
      "additionalProperties": true
    },
    "user": {
      "type": "string"
    },
    "service_tier": {
      "type": [
        "string",
        "null"
      ],
      "default": "default",
      "description": "Şu anda yalnızca default (standart) desteklenir. Atlanan, null, takma adlar ve desteklenmeyen dizeler default değerine döner; diğer türler HTTP 400 döndürür. Yapılandırılmış kanallar ve fiyatlar değişmez. Metin API'leri sağlayıcının standart değerini gönderir; Decisions ve oluşturma API'leri üst kaynak alanını atlar."
    }
  },
  "additionalProperties": true
}
```

Example:

```json
{
  "model": "gpt-5.5",
  "messages": [
    {
      "role": "user",
      "content": "Write a one-sentence greeting."
    }
  ],
  "stream": false
}
```

## Responses

### 200 — Sohbet tamamlama veya akış yanıtı

**application/json**

Schema: `ChatCompletionResponse` (`#/components/schemas/ChatCompletionResponse`)

**text/event-stream**

Schema: string

```json
{
  "type": "string",
  "description": "chat.completion.chunk veri olaylarını içeren SSE parçaları."
}
```

### 400 — Geçersiz istek, model veya sağlayıcı eşlemesi

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 401 — Geçersiz veya eksik Felo API anahtarı

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 402 — Yetersiz bakiye

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 403 — Hesabın modeli kullanma izni yok. Devre dışı modeller de üst kaynak çağrılarından önce reddedilir. Mevcut kabul edilmiş istekler ve görevler devam eder.

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 429 — Harcama veya istek sınırına ulaşıldı

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 502 — Üst kaynak sağlayıcı isteği başarısız oldu

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 503 — Sağlayıcı veya faturalandırma hizmeti kullanılamıyor

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

## Schema definitions

### ChatChoice

`#/components/schemas/ChatChoice`

```json
{
  "type": "object",
  "properties": {
    "index": {
      "type": "integer"
    },
    "message": {
      "$ref": "#/components/schemas/ChatMessage"
    },
    "finish_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "logprobs": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
```

### ChatCompletionResponse

`#/components/schemas/ChatCompletionResponse`

```json
{
  "type": "object",
  "required": [
    "id",
    "object",
    "choices"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "type": "string",
      "description": "Akışsız yanıtlarda genellikle chat.completion."
    },
    "created": {
      "type": "integer",
      "format": "int64"
    },
    "model": {
      "type": "string"
    },
    "choices": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/ChatChoice"
      }
    },
    "usage": {
      "$ref": "#/components/schemas/Usage"
    },
    "system_fingerprint": {
      "type": "string"
    }
  },
  "additionalProperties": true
}
```

### ChatMessage

`#/components/schemas/ChatMessage`

```json
{
  "type": "object",
  "required": [
    "role",
    "content"
  ],
  "properties": {
    "role": {
      "type": "string",
      "enum": [
        "system",
        "developer",
        "user",
        "assistant",
        "tool"
      ]
    },
    "content": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "tool_call_id": {
      "type": "string"
    },
    "tool_calls": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    }
  },
  "additionalProperties": true
}
```

### OpenAIErrorResponse

`#/components/schemas/OpenAIErrorResponse`

```json
{
  "type": "object",
  "description": "OpenAI uyumlu hata zarfı. Router, tüm isteğe bağlı üst kaynak alanları olmadan code ve message içerebilir.",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "message"
      ],
      "properties": {
        "message": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "description": "Sağlandığında OpenAI uyumlu hata türü."
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "code": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
```

### Usage

`#/components/schemas/Usage`

```json
{
  "type": "object",
  "description": "Sağlayıcı kullanım nesnesi. Alanlar uç noktaya ve sağlayıcıya göre değişir.",
  "additionalProperties": true
}
```
