# Asha API > The Asha API, made by DNAi Systems: evidence-grounded medical answers with typed references, plus claim checks, medication checks, evidence search and rerank. OpenAI-compatible and Anthropic-compatible `/v1` endpoints, the open A2A v1.0 protocol, Python and TypeScript SDK source on GitHub, and an MCP server in the `asha` CLI. Keys created on askasha.org reach Asha only. ## Start here - [Asha API page](https://askasha.org/developers): free key in a minute (250 queries/month, 50/day, 20 RPM, no card), quickstart, pricing. Paid plans open when our API terms are final. - [Documentation](https://askasha.org/developers/docs): every detail as a table; every page copies as Markdown. - [llms-full.txt](https://askasha.org/llms-full.txt): every docs page in one Markdown file. - [OpenAPI 3.1](https://api.askasha.org/openapi.json): generated from the running service. - Base URL: https://api.askasha.org. Auth: `Authorization: Bearer ` (`/v1/messages` also takes `x-api-key`). Key from `POST /api/a2a/signup` with `{"email": ..., "product": "asha"}`. ## SDKs, MCP, cookbook - The `askasha` packages are not on PyPI or npm yet. Any OpenAI SDK works today: `base_url` https://api.askasha.org/v1 and your API key, on `/v1/chat/completions` or `/v1/responses`. - Python SDK from source: `pip install "git+https://github.com/DNAiOS/asha#subdirectory=sdk/python"`. `Asha().chat.create(...)` returns the text plus the typed `asha` object; `verify`, `clinical.med_check`, `search`, `rerank`, `receipts.get`, `models.list`; streaming surfaces the final `asha` object; retries honor `Retry-After`; every POST carries an Idempotency-Key. Docs: https://askasha.org/developers/docs/sdks - TypeScript: SDK source in the repo (not on npm yet); use the `openai` package with `baseURL` https://api.askasha.org/v1 meanwhile. - MCP server: the `asha` CLI runs one (`asha mcp`) for asking Asha and for account tools. Docs: https://askasha.org/developers/docs/agents - Cookbook (https://github.com/DNAiOS/asha/tree/main/cookbook): patient-facing assistant with escalation, clinician A&P template, clinical subagent with JSON Schema output, EHR summary for a downstream agent, check claims before showing them, med-check to FHIR DetectedIssue, search plus rerank for your own RAG, switch from OpenAI or Anthropic, migrate from Glass, idempotent retries and receipts. Docs: https://askasha.org/developers/docs/cookbook - Source and examples (Apache-2.0): https://github.com/DNAiOS/asha ## /v1 endpoints - `POST /v1/chat/completions`: OpenAI wire. `model`, `messages` (last must be a user turn), `stream`, `instructions` (caller context below Asha's safety layer), `response_format` (`text`, `json_object`, `json_schema`; validated, one repair pass, else 422 `schema_unsatisfied`), `metadata` (`session_id`, `audience`, `persona`, `verbosity`, `emoji`, `memory`). `tools` returns 400. Response adds the `asha` object (and the older `dnai_meta`). Docs: https://askasha.org/developers/docs/openai - `POST /v1/messages`: Anthropic wire, same pipeline. Point the `anthropic` SDK at `https://api.askasha.org`. References ride `content[].citations` (`web_search_result_location`) and the `asha` object; the stream's `message_delta` carries `asha`. - `POST /v1/verify` (preview): tries to refute one claim against the committed corpus. Verdict `supported`, `contradicted`, `mixed`, `insufficient_evidence`; `caveat`, `scope`, `evidence_for`, `evidence_against`, `retracted_related`. A supported claim is not refuted, which is weaker than true. No LLM. 503 `verification_unavailable` instead of a guessed verdict. - `POST /v1/clinical/med-check`: deterministic medication-list screen (interactions, duplication, dose and renal ranges, allergies, pregnancy and lactation, high-alert flags). Lists every drug and check it could not run under `unchecked`; an empty result means no findings in the rules checked. `format: "fhir"` adds FHIR R4 DetectedIssue resources. Free. - `POST /v1/search` (preview): ranked evidence from the committed corpus with typed references (`literature`, `guideline`, `drug_label`, `code`, `dataset`), snippet and locator (PMID, DOI, PMCID, URL); retracted items flagged and ranked last. No answer. - `POST /v1/rerank`: cross-encoder relevance scores for up to 1,000 documents; relevance only. - `GET /v1/models`, `GET /v1/models/{id}`: models this key may call with status, snapshots, plans, intended users, capabilities; `?include=all` adds planned models with the reason. - `GET /v1/receipts/{id}`: the receipt behind one answer (answer SHA-256, corpus commitment, sources, tier); same key only. - `GET /v1/corpus-state`: the corpus commitment answers cite. Public. - Reference: https://askasha.org/developers/docs/reference. Tools: https://askasha.org/developers/docs/tools ## Models (GET /v1/models, 2026-11-26) - `asha` (ga, router: the account default, Base on self-serve plans), `asha-base` (ga; snapshot `asha-base-2026-12-01`), `asha-fast` (preview; alias `asha-fast-preview`), `asha-auto` (ga, Enterprise), `asha-apex` (ga, Enterprise, non-streaming), `asha-research` (preview; alias `asha-lyra`), `asha-nutrition` (preview; alias `asha-sage`). - Tools: `asha-verify` (preview), `asha-search` (preview), `asha-rerank` (ga), `asha-med-check` (ga). - Planned, not served: `asha-embed`, `asha-differential`, `asha-summary`, `asha-fitness`. ## The asha object - `references[]`: one per `[n]` marker (`id`, `marker`, `n`, `type`, `title`, `display`, `source`, `url`, `pmid`, `doi`, `locator`, `retrieved_at`). - `grounding`: `evidence_count`, `cited_count`, `coverage`, `corpus_commitment` {`hash`, `algorithm`, `collections`, `as_of`, `verify_url`}, typed `references[]`, `verification`. - `safety`: `emergency`, `escalation` {`level` none|emergency, `message`, `action`, `timeframe`}, `refusal`, `insufficient_evidence`, `uncertainty`, `phi_detected`, `phi_redacted`, `intended_user`, `audience_served`, `requires_clinician_review`. Show `escalation.message` above the answer when `level` is not `none`. - `basis`: `inputs`, `sources`, `missing_data`, `limitations`, `model` {`id`, `snapshot`, `depth_served`}, `pipeline_version`. - `usage` {`input_tokens`, `output_tokens`, `estimated`, `tier_requested`, `tier_served`}; `receipt` {`id`, `answer_sha256`, `url`} and `receipt_id`. - Docs: https://askasha.org/developers/docs/answer-object ## Headers, errors, limits - Request: `Idempotency-Key` (same key and body within 24 h replays with `Idempotent-Replayed: true`, not billed again; different body 409 `idempotency_key_reused`; still running 409 `idempotency_in_progress`), `X-Request-ID`, `X-DNAI-User`. - Response: `X-Request-ID`, `Asha-Model`, `Asha-Snapshot`, `X-DNAI-Intended-User`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`, `Retry-After` on 429 and retryable 409/503. - Errors: `/v1/chat/completions` and tools `{"error": {"message", "type", "code", "param"}}`; `/v1/messages` `{"type": "error", "error": {...}}`; A2A paths `{"error": {"code", "type", "message", "doc_url", "request_id"}}`. Codes: `invalid_request`, `tools_unsupported`, `stream_unsupported`, `invalid_api_key`, `plan_required`, `intended_user_not_allowed`, `model_not_found`, `model_not_available`, `model_retired`, `schema_unsatisfied`, `phi_not_allowed`, `rate_limited`, `concurrency_limited`, `capacity`, `daily_quota_exceeded`, `monthly_quota_exceeded`, `spending_cap_reached`, `region_not_supported`. Docs: https://askasha.org/developers/docs/limits - Limits: Free Sandbox 20 RPM and 2 answers in flight; Pay-As-You-Go and Developer 60 RPM and 5; Pro 120 RPM and 10; Enterprise 600 RPM and 50. Message size 8,000 characters on Free Sandbox, 100,000 on Pay-As-You-Go and Developer, 500,000 on Pro and Enterprise. ## Pricing (current card) - Plans: Free Sandbox ($0, 250 queries/month, 50/day, 20 RPM, no card). Paid plans and Pay-As-You-Go top-ups open when our API terms are final; need more than the free tier today? Write to hello@dnai.systems. Docs: https://askasha.org/developers/docs/limits - Tools: verify one query per claim; search $0.002 per search; rerank $0.0005 per 100 documents; med-check free. Each tool response reports `usage.amount_usd` and `usage.price_card`. ## Data, BAA, regions - PHI mode is closed: send de-identified or synthetic data only. Sandbox keys get 422 `phi_not_allowed` when identifiers are detected. - BAA, self-serve: `GET /api/a2a/baa` (JSON, `?format=md`, `?format=html`), `POST /api/a2a/baa/accept`, `GET /api/a2a/baa/status`. Versioned and hashed; the text is a draft pending counsel review, and PHI mode stays closed until both readiness gates clear. Docs: https://askasha.org/developers/docs/baa - Regions: the API does not serve the EU, EEA or UK (451 `region_not_supported`). - Answers are reference information for the stated audience; a licensed clinician decides. Docs: https://askasha.org/developers/docs/safety ## A2A v1.0 - `POST /a2a/v1/message:send`, `POST /a2a/v1/message:stream`, `GET /a2a/v1/tasks/{task_id}`, `GET /a2a/v1/tasks`, `POST /a2a/v1/tasks/{task_id}:cancel`. `agent_id` `asha` (alias `health`). Docs: https://askasha.org/developers/docs/send - Key and plan: `GET /api/a2a/usage`, `GET`/`PUT /api/a2a/preferences`, `GET /api/a2a/portal` (paid accounts), `POST /api/a2a/rotate-key`. - Command line: `curl -fsSL https://askasha.org/cli/install.sh | sh` then `asha init`. Docs: https://askasha.org/developers/docs/cli ## Machine-readable - [Asha agent card](https://api.askasha.org/.well-known/agent-card.json?agent_id=asha) - [OpenAPI 3.1](https://api.askasha.org/openapi.json) - [Benchmark register](https://api.askasha.org/api/benchmarks) - [Corpus commitment](https://api.askasha.org/v1/corpus-state) - [Health](https://api.askasha.org/a2a/v1/health) - [API terms (draft)](https://api.askasha.org/api/a2a/terms?format=html) ## Contact - hello@dnai.systems