دليل شامل لاستخدام واجهة API الطبية من Dr7.ai
تستخدم واجهة API الطبية من Dr7.ai مفاتيح API للمصادقة. أدرج مفتاح API في ترويسة Authorization:
Authorization: Bearer sk-dr7-your-api-keyملاحظة: حافظ على أمان مفتاح API ولا تكشفه أبدًا في الشيفرة من جهة العميل. يمكنك إدارة مفاتيح API من لوحة التحكم.
/v1/medical/chat/completionsتوليد ردود طبية استنادًا إلى الأعراض والاستفسارات الطبية
curl https://dr7.ai/api/v1/medical/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-dr7-your-api-key" \
-d '{
"model": "medgemma-4b-it",
"messages": [
{
"role": "user",
"content": "Patient reports headache for 3 days with fever of 38.5°C"
}
],
"max_tokens": 1000,
"temperature": 0.7
}'{
"id": "med-1234567890",
"object": "medical.chat.completion",
"created": 1677652288,
"model": "medgemma-4b-it",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Based on the symptoms you described, the patient presents with headache accompanied by fever. The following diagnoses should be considered..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 150,
"total_tokens": 175
}
}يستخدم API رموز حالة HTTP القياسية ويعيد تفاصيل الأخطاء بصيغة JSON:
{
"error": {
"message": "Invalid API key provided",
"type": "authentication_error",
"code": "invalid_api_key"
}
}| Status Code | Description |
|---|---|
| 401 | مفتاح API غير صالح أو مفقود |
| 402 | رصيد الحساب غير كافٍ |
| 429 | تم تجاوز حد معدل الطلبات |
| 500 | خطأ داخلي في الخادم |
يعتمد API لدينا على التسعير حسب عدد الرموز (tokens). تدفع فقط مقابل ما تستخدمه.
| النموذج | إدخال | إخراج |
|---|---|---|
| med-palm-2 | $0.001 / 1K tokens | $0.002 / 1K tokens |
| biogpt | $0.001 / 1K tokens | $0.002 / 1K tokens |
| chexagent | $0.002 / 1K tokens | $0.004 / 1K tokens |
| llava-med | $0.002 / 1K tokens | $0.004 / 1K tokens |
| meditron | $0.001 / 1K tokens | $0.002 / 1K tokens |
| pmc-llama | $0.001 / 1K tokens | $0.002 / 1K tokens |
| med-flamingo | $0.002 / 1K tokens | $0.004 / 1K tokens |
| biomedlm | $0.001 / 1K tokens | $0.002 / 1K tokens |
| biomedclip | $0.002 / 1K tokens | $0.004 / 1K tokens |
| clinical-camel | $0.001 / 1K tokens | $0.002 / 1K tokens |
| medgemma-4b-it | $0.001 / 1K tokens | $0.002 / 1K tokens |
| medgemma-27b-it | $0.003 / 1K tokens | $0.006 / 1K tokens |
| medsiglip-v1 | $0.005 / 1K tokens | $0.002 / 1K tokens |
| alphagenome | $0.002 / 1K tokens | $0.004 / 1K tokens |
| baichuan-m3 | $0.001 / 1K tokens | $0.002 / 1K tokens |