الخطوة 1: الحصول على مفتاح API الخاص بك
إضافة رصيد
انتقل إلى لوحة التحكم وأضف رصيداً إلى حسابك. تسعير حسب الاستخدام (Pay-as-you-go) بدون حد أدنى.
إنشاء مفتاح API
انتقل إلى Dashboard → API Keys وقم بإنشاء مفتاح جديد. انسخه بأمان - يتم عرضه مرة واحدة فقط.
حافظ على أمان مفتاح API الخاص بك. لا تقم أبداً بكشفه في كود جانب العميل (client-side) أو المستودعات العامة.
الخطوة 2: تثبيت SDK
الخطوة 3: إجراء طلبك الأول
cURL
Python
JavaScript
Go
PHP
curl https://api.lemondata.cc/v1/chat/completions \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"}
]
}'
تجربة نماذج مختلفة
يدعم LemonData أكثر من 300 نموذج. ما عليك سوى تغيير بارامتر model:
# OpenAI GPT-4o
response = client.chat.completions.create( model = "gpt-4o" , messages = messages)
# Anthropic Claude Sonnet 4.5
response = client.chat.completions.create( model = "claude-sonnet-4-5" , messages = messages)
# Google Gemini 2.5 Flash
response = client.chat.completions.create( model = "gemini-2.5-flash" , messages = messages)
# DeepSeek R1
response = client.chat.completions.create( model = "deepseek-r1" , messages = messages)
تفعيل البث (Streaming)
للحصول على استجابات في الوقت الفعلي، قم بتفعيل البث:
stream = client.chat.completions.create(
model = "gpt-4o" ,
messages = [{ "role" : "user" , "content" : "Tell me a story" }],
stream = True
)
for chunk in stream:
if chunk.choices[ 0 ].delta.content:
print (chunk.choices[ 0 ].delta.content, end = "" )
ماذا بعد؟