使用 Dr7.ai 医疗 API 的完整指南
Dr7.ai 医疗 API 使用 API 密钥进行身份验证。请在 Authorization 头中包含您的 API 密钥:
Authorization: Bearer sk-dr7-your-api-key
注意:请保护好您的 API 密钥,切勿在客户端代码中暴露。您可以在控制台中管理您的 API 密钥。
/v1/medical/chat/completions
基于症状和医疗查询生成医疗响应
curl https://api.dr7.ai/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": "患者主诉头痛3天,伴有发热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": "根据您描述的症状,患者出现头痛伴发热,需要考虑以下可能的诊断..."
},
"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 使用基于令牌的定价。您只需为使用的部分付费。
模型 | 输入 | 输出 |
---|---|---|
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 / image | $0.002 / 1K tokens |