Vaidya.ai

Introduction

A single, OpenAI-compatible endpoint for healthcare AI — symptom triage, drug lookups, lab analysis, and more.

What is Vaidya AI API?

Vaidya AI API is an OpenAI/vLLM-compatible Chat Completions endpoint built for healthcare. Send a standard model and messages body; add optional case when you want a credit-priced healthcare workflow (symptom triage, drug lookup, labs, and more).

If you've used the OpenAI SDK before, you already know the request format. case is optional for general chat and required only when your deployment or product uses workflow routing.

Why use it?

  • One endpoint, many workflows — symptom Q&A, drug interactions, lab analysis, health plans, and more behind a single POST.
  • Drop-in compatible — works with the OpenAI Python/JS SDK, requests, curl, or any HTTP client.
  • Predictable pricing — credit-based model so you know the cost per call before you ship.

Features and credits

Each case maps to a healthcare capability and costs a fixed number of credits:

FeaturecaseCreditsFile upload?What it does
Symptom Q&Asymptom_qa1NoTriage and next-step guidance per turn
Drug Lookupdrug_lookup2NoInteraction checks, side effects, spacing advice
Lab Report (text)lab_report_text10NoStructured interpretation of pasted lab values
Lab Report (image)lab_report_image20YesOCR + interpretation from a photo of a report

Quick overview

Base URLhttps://api.vaidya-dev.fractal.ai
EndpointPOST /chat/completions
AuthBearer token — get your key from console.vaidya.ai
FormatStandard OpenAI chat request; optional case for healthcare workflows

Minimal request

The smallest valid call matches OpenAI Chat Completions — no case required for general chat:

curl --request POST \
  --url https://api.vaidya-dev.fractal.ai/chat/completions \
  --header "authorization: Bearer $VAIDYA_API_KEY" \
  --header "content-type: application/json" \
  --data '{
  "model": "Vaidya-v2",
  "messages": [
    {
      "role": "user",
      "content": "Explain the pathogenesis of rheumatoid arthritis."
    }
  ],
  "max_tokens": 1000,
  "temperature": 0.7
}'

Same body as JSON:

{
  "model": "Vaidya-v2",
  "messages": [
    {
      "role": "user",
      "content": "Explain the pathogenesis of rheumatoid arthritis."
    }
  ],
  "max_tokens": 1000,
  "temperature": 0.7
}

Add "case": "drug_lookup" (or another value from the table above) when you need a specific healthcare workflow and credit pricing.

Error handling scenarios

Failures return JSON with an error object (message, type, code) and an HTTP status, similar to OpenAI-style APIs. Typical situations:

ScenarioStatusWhat to do
No Authorization header, wrong key format, or invalid key401Send Authorization: Bearer <key> with a key from console.vaidya.ai. See Authentication.
Key revoked or expired401Create a new key in the console and update your config.
Key lacks access to the resource or project403Check account or project permissions in the console.
Unknown or unsupported case value400Use a supported case from the table above (full list in Chat Completions).
messages missing roles, empty content, or invalid structure400Match the chat schema: alternating user/assistant turns with string content (or valid multimodal parts).
File-backed case without a file in the request400Attach the required PDF or image for that case.
Request or file payload too large413Shorten text, compress images, or split work across calls.
Field types or enums fail validation422Align types with the API reference (e.g. temperature as number).
Too many requests in a short window429Retry with exponential backoff; honor Retry-After when present.
Client or upstream timeout408Increase timeout, retry idempotent calls, or shorten prompts.
Transient server or overload500 / 503Retry with backoff; log the response/request id if you need support.

Using LiteLLM

When you call Vaidya through LiteLLM (Python SDK or Proxy), LiteLLM maps provider HTTP errors to OpenAI-compatible exception types. You can import them from litellm or catch the matching openai types — see LiteLLM’s Exception Mapping.

Each raised exception includes at least status_code, message, and llm_provider (in addition to the standard OpenAI error fields when present).

HTTP statusLiteLLM / OpenAI exception (typical)Vaidya-related examples
400BadRequestErrorInvalid case, bad messages, missing file for a file-backed case, payload rules; may be ContextWindowExceededError, ContentPolicyViolationError, or UnsupportedParamsError when the message matches those cases
401AuthenticationErrorMissing/invalid/expired API key
403PermissionDeniedErrorKey or account lacks permission
404NotFoundErrorWrong model id in config (often before the request reaches Vaidya)
408APITimeoutErrorRequest timeout from client or gateway
413BadRequestErrorRequest or attachment too large (treat as 400-class; confirm with status_code)
422UnprocessableEntityErrorValidation failures on typed fields
429RateLimitErrorRate limit exceeded
500APIError, APIConnectionError, or InternalServerErrorUpstream or network failure; LiteLLM may use APIConnectionError when mapping is ambiguous
503ServiceUnavailableErrorTemporary unavailability

LiteLLM Proxy only: spend or budget limits can raise BudgetExceededError (no fixed HTTP status — handled in your proxy config).

import os

import litellm
from litellm import AuthenticationError, BadRequestError, RateLimitError
from openai import APIStatusError

try:
    response = litellm.completion(
        model="openai/Vaidya-v2",  # example: your LiteLLM model name
        api_base="https://api.vaidya-dev.fractal.ai",
        api_key=os.environ["VAIDYA_API_KEY"],
        extra_body={"case": "drug_lookup"},
        messages=[{"role": "user", "content": "Can I take ibuprofen with paracetamol?"}],
    )
except AuthenticationError as e:
    # e.status_code == 401
    ...
except BadRequestError as e:
    # e.status_code often 400; inspect e.message for Vaidya `error.code`
    ...
except RateLimitError as e:
    # e.status_code == 429
    ...
except APIStatusError as e:
    # Fallback for any mapped OpenAI-style error with a status code
    ...

For the raw JSON error shape, Vaidya error.code values, and retry guidance, see Error Responses and Rate Limiting and Retries in Chat Completions.

Who is this for?

  • Health apps — add symptom triage, drug info, or lab analysis to your product.
  • Wellness platforms — generate health scores and personalized plans.
  • Clinical tools — build copilots and workflow assistants for care teams.
  • Enterprise — embed healthcare AI into internal tools and customer-facing products.

Next steps

  1. Get your API key at console.vaidya.ai.
  2. Set up auth — see Authentication.
  3. Write better prompts — read the Prompt Guide.
  4. Start building — jump to the Chat Completions API reference.
  5. Ship safely — follow Best Practices for prompts, retries, security, and disclaimers.
  6. Watch usage — use the Console Monitoring Usage page for quotas, charts, and alerts.

On this page