API Dokümantasyonu
FreeGPT API servisine hoş geldiniz. Bu servis, OpenAI standartlarını takip eden yapay zeka modelleriyle (GPT-5 Nano vb.) kolayca iletişim kurmanızı sağlar.
Kimlik Doğrulama
API istekleri için Authorization başlığında Bearer Token kullanmanız gerekir. API anahtarınızı Dashboard sayfasından alabilirsiniz.
Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxx
Chat Completions
POST
/v1/chat/completions
Verilen mesaj geçmişine göre modelin üreteceği bir sonraki mesajı döndürür.
Parametreler
| Parametre | Tip | Açıklama |
|---|---|---|
| model Zorunlu | string | Kullanılacak model ID'si. Örn: gpt-5-nano-2025-08-07 |
| messages Zorunlu | array | Sohbet geçmişini içeren mesaj listesi. |
| stream | boolean | true olarak ayarlanırsa yanıt parça parça (token token) döner. |
Örnek İstek (Python)
import requests
import json
url = "https://www.mertkan.freegpt.com.tr/v1/chat/completions"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer ACCESS_TOKEN_GOES_HERE"
}
data = {
"model": "gpt-5-nano-2025-08-07",
"messages": [
{"role": "system", "content": "Sen yardımcı bir asistansın."},
{"role": "user", "content": "Merhaba!"}
],
"stream": True
}
response = requests.post(url, headers=headers, json=data, stream=True)
for line in response.iter_lines():
if line:
# Stream veri işleme
print(line.decode('utf-8'))
Örnek İstek (cURL)
curl https://www.mertkan.freegpt.com.tr/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ACCESS_TOKEN_GOES_HERE" \
-d '{
"model": "gpt-5-nano-2025-08-07",
"messages": [{"role": "user", "content": "Bana bir fıkra anlat."}]
}'