API Documentation

Complete guide to using Dr7.ai Medical API

Quick Start

API Endpoints

Authentication

Dr7.ai Medical API uses API keys for authentication. Include your API key in the Authorization header:

Authorization: Bearer sk-dr7-your-api-key

Note: Keep your API key secure and never expose it in client-side code. You can manage your API keys in the dashboard.

Medical Chat Completions

POST/v1/medical/chat/completions

Generate medical responses based on symptoms and medical queries

Request

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": "患者主诉头痛3天,伴有发热38.5°C"
      }
    ],
    "max_tokens": 1000,
    "temperature": 0.7
  }'

Response

{
  "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
  }
}

Error Handling

The API uses standard HTTP status codes and returns error details in JSON format:

{
  "error": {
    "message": "Invalid API key provided",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}
Status CodeDescription
401Invalid or missing API key
402Insufficient account balance
429Rate limit exceeded
500Internal server error

Pricing

Our API uses token-based pricing. You only pay for what you use.

ModelInputOutput
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