# Asha API documentation The Asha API, made by DNAi Systems: evidence-grounded medical answers and clinical tools over OpenAI- and Anthropic-compatible /v1 endpoints and the A2A v1.0 protocol. Base URL https://api.askasha.org; OpenAI SDK base_url https://api.askasha.org/v1 with the API key. Human-readable pages: https://askasha.org/developers/docs. SDK source (not on PyPI or npm): https://github.com/DNAiOS/asha. ## Overview The Asha API returns Asha's evidence-grounded medical answers over the open A2A v1.0 protocol (HTTP and JSON). Every answer ships with its sources. Keys created on askasha.org reach Asha only. ### At a glance | Item | Value | | --- | --- | | Base URL | `https://api.askasha.org` | | Protocol | A2A v1.0 over HTTPS, JSON bodies. Every response carries the `A2A-Version: 1.0` header. | | Authentication | `Authorization: Bearer ` on every call except signup and health. | | Agent | `asha` (alias `health`). Omitting `agent_id` defaults to Asha. | | Key scope | Asha only. Any other agent id returns 403. | | Input | `text/plain` inside JSON message parts: up to 8,000 characters (~2,000 tokens) on Free Sandbox, 100,000 characters on Pay-As-You-Go and Developer, and 500,000 characters on Pro and Enterprise. | | Output | A task with a `response` artifact (Markdown text) and a `provenance` artifact (sources, citations, evidence count, model). | | Free plan | 250 queries a month, 50 a day (20 RPM), no card. Paid plans open when our API terms are final. Need more than the free tier today? Write to us at hello@dnai.systems. | ### Endpoints | Method | Path | Purpose | Auth | | --- | --- | --- | --- | | POST | `/a2a/v1/message:send` | Ask Asha; returns the completed task. | API key | | POST | `/a2a/v1/message:stream` | Same request, streamed as server-sent events. | API key | | GET | `/a2a/v1/tasks/{task_id}` | Fetch one task. | API key | | GET | `/a2a/v1/tasks` | List your tasks (paginated, filterable). | API key | | POST | `/a2a/v1/tasks/{task_id}:cancel` | Cancel a task that is still working. | API key | | GET | `/a2a/v1/health` | Service health. | None | | POST | `/api/a2a/signup` | Create a free key. | None | | GET | `/api/a2a/usage` | Usage, limits, prepaid balance, and estimated spend for your key. | API key | | GET, PUT | `/api/a2a/preferences` | Saved defaults for your key: name, tone, audience, length, emoji (Customize your agent). | API key | | POST | `/api/a2a/rotate-key` | Replace your key; the old one stops at once. | API key | | GET | `/api/a2a/portal` | Stripe billing portal. | API key | | POST | `/v1/chat/completions` | OpenAI Chat Completions wire format over Asha (Drop-in with OpenAI SDKs). | API key | | GET | `/v1/models` | Model ids for the OpenAI-compatible endpoint. | API key | | GET | `/api/a2a/baa` | Current Business Associate Agreement (JSON, Markdown, HTML). | None | | POST | `/api/a2a/baa/accept` | Accept the agreement for your account (BAA, self-serve). | API key | | GET | `/api/a2a/baa/status` | Acceptance state and PHI readiness. | API key | ### First call ```bash curl -X POST https://api.askasha.org/a2a/v1/message:send \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "agent_id": "asha", "message": { "role": "user", "parts": [{"text": "Which antihypertensives are safe in pregnancy?"}] }, "metadata": {"audience": "clinician", "session_id": "visit-2041"} }' ``` ### Four ways in | Path | Best for | | --- | --- | | A2A `message:send` / `message:stream` | Full task records, provenance artifact, pipeline phases. | | OpenAI-compatible `/v1/chat/completions` | Existing OpenAI SDK, LangChain, LiteLLM, or Vercel AI code: change `base_url` and the key. | | `asha` command line | Setup, settings, questions, live checks, and the BAA from a terminal; one file, no dependencies. | | MCP server (`asha mcp`) | Claude Code, Codex, Cursor, Gemini CLI, VS Code: your coding agent calls Asha and reads these docs as tools. | Source: https://askasha.org/developers/docs/overview ## Drop-in with OpenAI SDKs `POST /v1/chat/completions` speaks the OpenAI Chat Completions wire format. Point any OpenAI SDK, LangChain, LiteLLM, or the Vercel AI SDK at `https://api.askasha.org/v1` with your Asha key and Asha answers, sources attached. ### Two settings | Setting | Value | | --- | --- | | `base_url` | `https://api.askasha.org/v1` | | `api_key` | Your Asha key (`dnai_a2a_...`) | | `model` | `asha` (plan default), `asha-base` (pin Base), `asha-base-2026-12-01` (dated snapshot), `asha-auto` (Enterprise: stakes routing), `asha-apex` (Enterprise, non-streaming). `GET /v1/models` lists every id your key can call. `dnai/asha` and `asha-latest` are accepted too; responses label the model `dnai/`. | ```python from openai import OpenAI client = OpenAI(base_url="https://api.askasha.org/v1", api_key="YOUR_API_KEY") completion = client.chat.completions.create( model="asha", messages=[{"role": "user", "content": "Which antihypertensives are safe in pregnancy?"}], metadata={"audience": "clinician", "session_id": "visit-2041"}, ) print(completion.choices[0].message.content) asha = completion.model_extra["asha"] for ref in asha["references"]: print(ref["marker"], ref["display"]) print(asha["safety"]["escalation"]["level"], asha["receipt_id"]) ``` ### Request mapping | OpenAI field | What Asha does with it | | --- | --- | | `messages[-1]` (role `user`) | The question. Required; the last message must be a user turn. | | Earlier `user` / `assistant` turns | Passed to the engine as conversation history for this request. The endpoint is stateless per request; `metadata.session_id` pins a per-key identity so memory continuity follows your own session ids. | | `system` messages | Folded into the history as caller context. Asha's own system prompt, safety rules, and citations stay in force; this channel cannot switch them off. | | `metadata` | Asha options, same names as the A2A API: `session_id`, `audience` (`patient`, `caregiver`, `clinician`, `nurse`, `pharmacist`, `physician`), `persona`, `verbosity`, `emoji`, `memory: "off"`. Saved key settings apply when a field is absent (Customize your agent). | | `stream`, `stream_options.include_usage` | Server-sent events in the OpenAI chunk format; a final usage chunk when requested. `asha-apex` is non-streaming. | | `user` or header `X-DNAI-User` | Pins the memory identity for continuity (the original way, still honored). | | Header `X-DNAI-Sources: keep` | Keeps the trailing sources panel in the answer text. Off by default; references arrive in the `asha` object either way. | | `instructions` | Developer instructions (up to 50,000 characters with system and developer messages), applied as caller context below Asha's safety layer. | | `response_format` | `text`, `json_object`, or `json_schema` (`{name, schema, strict}`). Output is validated; one repair pass, else 422 `schema_unsatisfied` with `raw_text`. JSON requests return a real status code instead of keep-alive bytes. | | Header `Idempotency-Key` | Same key and body within 24 hours replays the stored response (`Idempotent-Replayed: true`) without running or billing it again; a different body is 409 `idempotency_key_reused`. | | `temperature`, `max_tokens` | Accepted and ignored: the engine sets sampling and answer length. | | `tools` | 400 `tools_unsupported`. Asha runs its own retrieval tools server-side and returns the references. | ### Response | Field | Meaning | | --- | --- | | `id`, `model` | `chatcmpl-...` and `dnai/`. | | `choices[0].message.content` | Asha's answer in Markdown. `finish_reason` is `stop`. | | `usage` | `prompt_tokens`, `completion_tokens`, `total_tokens`, plus `dnai_token_counts_estimated` when the engine did not report exact counts. | | `asha` | The Asha answer object: `references[]` mapped 1:1 to the `[n]` markers, `grounding` (with the corpus commitment), `safety` (escalation, refusal, intended user), `basis`, `usage`, `receipt`. Field list: The asha object page. OpenAI SDKs keep unknown fields (Python: `completion.model_extra["asha"]`). | | `dnai_meta` | Older extension object, kept for existing clients: `depth_requested`, `depth_served` (`base`, `mid`, `apex`), `evidence_count`, `citations[]`. Internal urgency scores are never returned. New code reads `asha`. | | Non-streaming transport | The body starts with whitespace bytes every 20 s while Asha works (valid JSON, keeps proxies open) and ends with the completion object. | | Streaming | `chat.completion.chunk` deltas; the chunk with `finish_reason: "stop"` carries `asha` (and `dnai_meta`). Comment lines (`: phase ...`, `: keep-alive`) report pipeline phases and keep proxies open; SDK parsers skip them. | | Errors | `{"error": {"message", "type", "code"}}` with the usual statuses (401, 403 `plan_required` for `asha-apex` outside Enterprise, 404 `model_not_found`, 429 with `Retry-After`, 500 `engine_error`), so SDKs raise their typed exceptions. | | `GET /v1/models` | Lists the models your key can call, with status, snapshots, plans, intended users and capabilities; `?include=all` adds planned models with the reason. `client.models.list()` works. | ### Node (streaming) ```javascript import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.askasha.org/v1", apiKey: "YOUR_API_KEY" }); const stream = await client.chat.completions.create({ model: "asha", stream: true, messages: [{ role: "user", content: "Red flags for pediatric fever?" }], }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ### curl ```bash curl https://api.askasha.org/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "asha", "messages": [{"role": "user", "content": "Red flags for pediatric fever?"}]}' ``` ### Drop-in across frameworks | Framework / SDK | Configuration | | --- | --- | | OpenAI Python (`openai`) | `OpenAI(base_url="https://api.askasha.org/v1", api_key=os.environ["ASHA_API_KEY"])` with `model="asha"` or `model="asha-base"`. | | OpenAI Node / TypeScript (`openai`) | `new OpenAI({ baseURL: "https://api.askasha.org/v1", apiKey: process.env.ASHA_API_KEY })`. | | Vercel AI SDK (`@ai-sdk/openai`) | `createOpenAI({ baseURL: "https://api.askasha.org/v1", apiKey: process.env.ASHA_API_KEY })("asha")`. | | LangChain (`langchain-openai`) | `ChatOpenAI(model="asha", base_url="https://api.askasha.org/v1", api_key=os.environ["ASHA_API_KEY"])`. | | LiteLLM (`litellm`) | `completion(model="openai/asha", api_base="https://api.askasha.org/v1", api_key=os.environ["ASHA_API_KEY"], messages=...)`. | ### Limits of the compatibility layer | Item | Behaviour | | --- | --- | | Scope | A key from this site calls Asha and its tiers; other DNAi engine ids return 403. | | Depth | Self-serve plans run Base; `asha-auto` is pinned to Base and reported as such in `asha.basis.model.depth_served`. Enterprise unlocks `asha-auto` and `asha-apex`. | | Tools and function calling | Not exposed. Asha runs its own retrieval tools server-side and returns the citations. | | Vision and audio | Not on this endpoint. Text parts only. | | Browser calls | The API is for servers. Cross-origin browser calls are refused; keep the key server-side. | | Metering | One query per request (up to 2,000 input + 2,000 output tokens included in the $0.03 Base query rate; overage above 2,000 tokens is metered at $4.00/1M input and $16.00/1M output tokens). Per-query character cap: 8,000 on Free Sandbox, 100,000 on Pay-As-You-Go and Developer, 500,000 on Pro and Enterprise. | Source: https://askasha.org/developers/docs/openai ## API reference: /v1 Every `/v1` endpoint, the model catalog, headers, and limits. Answers speak the OpenAI and Anthropic wire formats; clinical tools are typed JSON. The OpenAPI 3.1 document at `https://api.askasha.org/openapi.json` is the machine-readable source. ### Endpoints | Method and path | Wire | What it does | Billing (current card) | | --- | --- | --- | --- | | `POST /v1/chat/completions` | OpenAI Chat Completions | Cited answer. `stream`, `instructions`, `response_format` (`json_object`, `json_schema`), `metadata`. Returns the `asha` object. | One query per answer | | `POST /v1/messages` | Anthropic Messages | Same pipeline as chat completions. Point the `anthropic` SDK at `https://api.askasha.org` (`x-api-key` or Bearer). References also ride `content[].citations`. | One query per answer | | `POST /v1/verify` | Asha JSON | Tries to refute one claim against the committed corpus. Verdict `supported`, `contradicted`, `mixed`, `insufficient_evidence`. Preview. | One query per claim | | `POST /v1/clinical/med-check` | Asha JSON | Deterministic medication-list screen. `format: "fhir"` adds FHIR R4 DetectedIssue resources. | Free | | `POST /v1/search` | Asha JSON | Ranked evidence from the committed corpus with typed references and locators. No answer. Preview. | $0.002 per search | | `POST /v1/rerank` | Asha JSON | Cross-encoder relevance scores for up to 1,000 documents. | $0.0005 per 100 documents | | `GET /v1/models`, `GET /v1/models/{id}` | OpenAI models | Models this key may call, with status, snapshots, plans, intended users, capabilities. `?include=all` lists planned models with the reason. | Free | | `GET /v1/receipts/{id}` | Asha JSON | The receipt behind one answer: answer fingerprint, corpus commitment, sources, tier. Readable only with the key that received the answer. | Free | | `GET /v1/corpus-state` | Asha JSON | The corpus commitment answers cite (`hash`, `algorithm`, `collections`, `as_of`, `verify_url`). Public, no key. | Free | ### Models Ids from `GET /v1/models?include=all` on 2026-11-26. `ga` is generally available, `preview` may change with notice, `planned` is not served yet (404 `model_not_available` with the reason). Dated snapshots pin behavior; floating ids move to the newest snapshot. Customer keys on self-serve plans run Base. | Id | Status | Kind | Plans | Notes | | --- | --- | --- | --- | --- | | `asha` | ga | router | all | The account's default tier (Base on self-serve plans). | | `asha-base` | ga | grounded answer | all | Snapshot `asha-base-2026-12-01`. | | `asha-fast` | preview | grounded answer | all | Alias `asha-fast-preview`; snapshot `asha-fast-2026-12-01`. | | `asha-auto` | ga | router | Enterprise | Stakes routing across tiers; snapshot `asha-auto-2026-12-01`. | | `asha-apex` | ga | grounded answer | Enterprise | Non-streaming; snapshot `asha-apex-2026-12-01`. | | `asha-research` | preview | domain answer | all | Alias `asha-lyra`. | | `asha-nutrition` | preview | domain answer | all | Alias `asha-sage`. | | `asha-verify` | preview | verification | all | `POST /v1/verify`. | | `asha-search` | preview | evidence retrieval | all | `POST /v1/search`. | | `asha-rerank` | ga | rerank | all | `POST /v1/rerank`. | | `asha-med-check` | ga | deterministic check | all | `POST /v1/clinical/med-check`; clinician and sandbox keys. | | `asha-embed`, `asha-differential`, `asha-summary`, `asha-fitness` | planned | | | Listed with `?include=all`; not served. | ### Request headers | Header | Meaning | | --- | --- | | `Authorization: Bearer ` | Your Asha key. `/v1/messages` also takes `x-api-key`. | | `Idempotency-Key` | 1 to 255 characters (UUID v4; never personal data). Same key and body within 24 hours replays the stored response with `Idempotent-Replayed: true` and is not billed again. A different body is 409 `idempotency_key_reused`; a retry while the first runs is 409 `idempotency_in_progress` with `Retry-After`. | | `X-Request-ID` | Send your own to correlate logs; otherwise one is generated and returned. | | `X-DNAI-User` | Pins the memory identity across requests (same as `user`). | | `X-DNAI-Sources: keep` | Keeps the trailing sources panel in the answer text. | ### Response headers | Header | Meaning | | --- | --- | | `X-Request-ID` | Quote it to support; errors repeat it. | | `Asha-Model`, `Asha-Snapshot` | The model and dated snapshot that served the request. | | `X-DNAI-Intended-User` | The key's intended-user class (`consumer`, `clinician`, `sandbox`). | | `X-Asha-AI-Generated: true` | Set on generated answers. | | `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` | Per-minute rate limit state for the key. | | `Retry-After` | Seconds to wait, on 429 and retryable 409 and 503 responses. | | `Idempotent-Replayed: true` | The response is the stored one for this Idempotency-Key. | ### Transport | Item | Behavior | | --- | --- | | Non-streaming answers | The body starts with whitespace keep-alive bytes every 20 s while Asha works (valid JSON). `response_format` JSON requests return a real status code instead. | | Streaming | `chat.completion.chunk` or Anthropic events; the final event carries the `asha` object; `: phase ` comment lines report pipeline phases and SDK parsers skip them. | | Tools and function calling | 400 `tools_unsupported`. Asha runs its own retrieval server-side. | | Last message | Must be a user turn (400 otherwise). | | Browser calls | Refused cross-origin; keep the key on your server. | ### Errors on /v1 `/v1/chat/completions` and the tools return `{"error": {"message", "type", "code", "param"}}`; `/v1/messages` returns `{"type": "error", "error": {"type", "message", "code"}}`. Branch on `code`. | HTTP | `code` | Cause | | --- | --- | --- | | 400 | `invalid_request`, `invalid_json`, `tools_unsupported`, `stream_unsupported`, `instructions_too_long` | Malformed body; `stream_unsupported` is `asha-apex` with `stream: true`. | | 401 | `authentication_required`, `invalid_api_key` | Missing or unknown key. | | 403 | `plan_required`, `intended_user_not_allowed`, `model_blocked` | The key's plan or intended user cannot reach the model. | | 404 | `model_not_found`, `model_not_available` | Unknown id, or a planned model (with the reason). | | 409 | `idempotency_key_reused`, `idempotency_in_progress` | See Idempotency-Key above. | | 410 | `model_retired` | With `successor`. | | 422 | `schema_unsatisfied`, `phi_not_allowed` | JSON Schema not met after one repair (with `raw_text`); identifiers sent on a sandbox key. | | 429 | `rate_limited`, `concurrency_limited`, `capacity`, `daily_quota_exceeded`, `monthly_quota_exceeded`, `spending_cap_reached` | With `Retry-After`. Allowance errors reset at 00:00 UTC or on the 1st. | | 451 | `region_not_supported` | The API does not serve the EU, EEA or UK. | | 503 | `verification_unavailable`, `search_unavailable`, `rerank_unavailable` | A dependency did not answer; no verdict or result is invented. `Retry-After` set. | ### Anthropic SDK ```python from anthropic import Anthropic client = Anthropic(base_url="https://api.askasha.org", api_key="YOUR_API_KEY") msg = client.messages.create( model="asha-base", max_tokens=1024, messages=[{"role": "user", "content": "First-line treatment for type 2 diabetes?"}], ) print(msg.content[0].text) print(msg.model_extra["asha"]["references"]) ``` Source: https://askasha.org/developers/docs/reference ## The asha object Every `/v1` answer carries one extension field, `asha`, on the completion (OpenAI wire) or the message (Anthropic wire), and on the final stream event. Fields without an engine signal are `null`; new fields can appear, so ignore what you do not know. ### Top level | Field | Meaning | | --- | --- | | `object`, `version` | `asha.answer`, schema version. | | `references[]` | One entry per `[n]` marker in the text, in order: `id` (`r1`), `marker` (`[1]`), `n`, `type` (`literature`, `drug_label`, `guideline`, `corpus`), `title`, `display`, `source`, `url`, `pmid`, `doi`, `locator` {`pmid`, `doi`, `pmcid`, `url`, `page`}, `evidence_type`, `retrieved_at`. | | `grounding` | `evidence_count` (retrieved), `cited_count`, `coverage`, `unmapped_markers`, `corpus_commitment` {`hash`, `algorithm`, `collections`, `as_of`, `verify_url`}, typed `references[]` (`literature`, `guideline`, `drug_label`, `code`, `dataset`, `context_document`), `verification` {`status`, `method`, `flagged_claims`}. | | `safety` | See below. | | `basis` | `inputs` (what the request supplied, including `ignored_parameters`), `sources`, `missing_data`, `limitations`, `model` {`id`, `snapshot`, `depth_served`}, `pipeline_version`. | | `usage` | `input_tokens`, `output_tokens`, `estimated`, `tier_requested`, `tier_served`. | | `receipt`, `receipt_id` | {`id`, `answer_sha256`, `url`}. Fetch with `GET /v1/receipts/{id}` and the same key. | ### safety | Field | Meaning | What your product does | | --- | --- | --- | | `emergency` | `true` when the question describes a possible emergency. | Show `escalation.message` above the answer. | | `escalation` | {`level` (`none`, `emergency`), `message`, `action`, `timeframe`}. The message is country-aware when the key's country is known. | Display the message as written; do not shorten it. | | `refusal` | {`refused`, `category`}. | Show the refusal text; do not retry with rephrasing to get around it. | | `insufficient_evidence` | `true` when the corpus did not hold enough evidence for a grounded answer. | Say so to the user. | | `requires_clinician_review` | `true` for content a clinician should review before acting. | Route to a clinician. | | `intended_user`, `audience_served` | The key's intended-user class and the register the answer was written in (sandbox keys are served the consumer register). | Match your UI to `audience_served`. | | `phi_detected`, `phi_redacted`, `phi_identifier_kinds` | Identifier screening on the input. | PHI mode is closed: send de-identified data only. | | `uncertainty` | Engine uncertainty signal when present. | | ### Read it from the SDKs | Client | Access | | --- | --- | | `askasha` (Python) | `answer.asha` (typed), `stream.asha` after the last chunk | | `askasha` (TypeScript) | `answer.asha`, `stream.asha` | | `openai` (Python) | `completion.model_extra["asha"]` | | `openai` (Node) | `(completion as any).asha` | | `anthropic` (Python) | `message.model_extra["asha"]`; stream: the `message_delta` event | Source: https://askasha.org/developers/docs/answer-object ## Clinical tools: verify, med-check, search, rerank Typed endpoints with no generated prose. Each response carries `usage` and an `asha` object (`model`, `intended_user`, `safety`, `basis`, `grounding.corpus_commitment`). Identifier-like text is redacted before retrieval. ### POST /v1/verify Tries to refute one claim. Forward and inverse search gather candidate evidence; an NLI cross-encoder gives each a stance; only entailing evidence counts for the claim and only contradicting evidence counts against it. A retracted, refuted or recalled item decides the verdict only when the claim rests on it; otherwise it is listed in `retracted_related`. A claim that survives is not refuted, which is weaker than true. No LLM runs. Preview: calibration is still being tuned, so read `scope` and the evidence lists with the verdict. | Field | Meaning | | --- | --- | | Request | `claim` (required, up to 2,000 characters), `context` (screened and recorded; retrieval embeds the claim alone), `domain` (`medical`, `drug_safety`, `guidelines`, `literature`), `top_k` (1 to 25). | | `verdict` | `supported`, `contradicted`, `mixed`, `insufficient_evidence`. | | `caveat`, `scope` | What the verdict means and what it rests on. Show both with the verdict. | | `evidence_for`, `evidence_against`, `retracted_related` | Typed references (type, title, snippet, year, score, collection, retracted, stance, nli, locator); each list holds at most 10. | | `evidence_counts` | `for`, `against`, `related`, `retracted_related`, `list_cap`. | | Failure | 503 `verification_unavailable` when the vector store, encoder or stance model fails. No verdict is invented. | ```bash curl https://api.askasha.org/v1/verify \ -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \ -d '{"claim": "Metformin is first-line therapy for most adults with type 2 diabetes."}' ``` ### POST /v1/clinical/med-check Deterministic screen over the DNAi rule table: interactions (severity, management, mechanism, source per rule), therapeutic duplication, dose and route ranges, allergies, pregnancy and lactation, ISMP high-alert flags. No LLM and no network call: the same input gives the same output and `rule_table_version`. Every drug the table does not know, and every check whose inputs were missing, is named under `unchecked`. An empty result reads "No findings in the rules checked" with the counts. Free on every plan. | Field | Meaning | | --- | --- | | Request | `medications` (1 to 50; names or {`name`, `dose`, `route`, `frequency`, `sig`, `indication`, `id`}), `age`, `sex`, `weight_kg`, `egfr`, `creatinine`, `potassium`, `allergies`, `pregnancy`, `lactation`, `audience` (`clinician`/`hcp` or `consumer`/`patient`), `format` (`json`, `fhir`). | | `interactions`, `alerts` | Findings: `severity` (`contraindicated`, `major`, `moderate`, `info`), `title`, `medications`, `management`, `mechanism`, `detail`, `source`, `rule`. | | `unchecked` | Drugs and checks the table could not run, with the reason. | | `next_step` | For consumer audiences, routes the next step to the prescriber or pharmacist. | | `fhir` | With `format: "fhir"`: a FHIR R4 Bundle of DetectedIssue resources (`severity`, `code`, `implicated`, `detail`, `evidence`, `mitigation`). | ```bash curl https://api.askasha.org/v1/clinical/med-check \ -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \ -d '{"medications": [{"name": "warfarin", "dose": "5 mg"}, {"name": "fluconazole"}], "age": 67, "format": "fhir"}' ``` ### POST /v1/search and POST /v1/rerank Search is information retrieval only: ranked results from the committed corpus with typed references, a snippet and a locator; no answer and no recommendation. Retracted and refuted items are flagged and ranked last; no hits is 200 with an empty list. Rerank returns cross-encoder relevance scores (BAAI/bge-reranker-v2-m3), relevance only with no claim of clinical validity; documents longer than 2,000 characters are scored on their first 2,000. | Endpoint | Request | Response | | --- | --- | --- | | `/v1/search` | `query` (up to 2,000 characters), `top_k` (1 to 50, default 10), `filters` {`domain` (`general`, `clinical`, `guidelines`, `drugs`, `codes`), `year_from`, `year_to`, `source_type[]` (`literature`, `guideline`, `drug_label`, `code`, `dataset`)} | `data[]` (`rank`, `type`, `title`, `snippet`, `source`, `year`, `score`, `collection`, `retracted`, `refuted`, `locator` {`pmid`, `doi`, `pmcid`, `url`}) | | `/v1/rerank` | `query`, `documents` (strings or {`text`}; up to 1,000), `top_n`, `return_documents` | `results[]` (`index`, `relevance_score`, `document`?) sorted by score | ```bash curl https://api.askasha.org/v1/search \ -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \ -d '{"query": "anticoagulation in atrial fibrillation with CKD", "top_k": 5, "filters": {"year_from": 2020}}' curl https://api.askasha.org/v1/rerank \ -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \ -d '{"query": "first-line therapy for type 2 diabetes", "top_n": 2, "documents": ["Metformin remains first-line.", "Statins lower LDL.", "SGLT2 inhibitors reduce HF admissions."]}' ``` Source: https://askasha.org/developers/docs/tools ## SDKs The `askasha` packages are not on PyPI or npm yet. Today, call the OpenAI-compatible endpoints (`/v1/chat/completions`, `/v1/responses`) with the official `openai` package: base URL `https://api.askasha.org/v1` and your API key, sent as `Authorization: Bearer`. The Python SDK installs from GitHub source. Source, tests and examples: https://github.com/DNAiOS/asha. ### Install | Client | Install | Source | | --- | --- | --- | | `openai` (Python or Node) | `pip install openai` or `npm install openai`, with `base_url` `https://api.askasha.org/v1` and your API key | OpenAI SDK, compatible page | | `askasha` (Python 3.9+, from source) | `pip install "git+https://github.com/DNAiOS/asha#subdirectory=sdk/python"` | https://github.com/DNAiOS/asha/tree/main/sdk/python | | `askasha` (TypeScript) | Not on npm yet. Use the `openai` package (snippet below). | https://github.com/DNAiOS/asha/tree/main/sdk/typescript | ### Surface | Python | TypeScript | Endpoint | | --- | --- | --- | | `client.chat.create(...)`, `client.chat.stream(...)` | `asha.chat.create(...)`, `asha.chat.stream(...)` | `/v1/chat/completions` | | `client.messages.create(...)`, `.stream(...)` | `asha.messages.create(...)`, `.stream(...)` | `/v1/messages` | | `client.verify(claim)` | `asha.verify(claim)` | `/v1/verify` | | `client.clinical.med_check(meds, format="fhir")` | `asha.clinical.medCheck(meds, { format: "fhir" })` | `/v1/clinical/med-check` | | `client.search(query)`, `client.rerank(query, docs)` | `asha.search(query)`, `asha.rerank(query, docs)` | `/v1/search`, `/v1/rerank` | | `client.receipts.get(id)`, `client.models.list()` | `asha.receipts.get(id)`, `asha.models.list()` | `/v1/receipts/{id}`, `/v1/models` | ### Retries and idempotency | Behavior | Detail | | --- | --- | | Idempotency-Key | Every POST carries one (UUID v4 per call unless you pass your own), reused across retries, so a retry never runs or bills twice. | | Retried | Connection errors, 408, 502, 503, 504, and 409/429 responses whose `Retry-After` is at most 60 s (configurable), waiting exactly `Retry-After`. | | Raised at once | Allowance errors (`daily_quota_exceeded`, `monthly_quota_exceeded`, `spending_cap_reached`), auth, validation, 451. | | Typed errors | `AuthenticationError`, `PermissionDeniedError`, `NotFoundError`, `ConflictError`, `GoneError`, `UnprocessableEntityError`, `RateLimitError`, `RegionNotSupportedError`, `InternalServerError`, each with `code`, `type`, request id and retry-after. | | Response metadata | Request id, model, snapshot, intended user, rate-limit headers and the idempotent-replay flag on every result. | ### Python (SDK from source) ```python pip install "git+https://github.com/DNAiOS/asha#subdirectory=sdk/python" from askasha import Asha client = Asha() # reads ASHA_API_KEY answer = client.chat.create( model="asha-base", messages=[{"role": "user", "content": "First-line drug therapy for uncomplicated hypertension?"}], metadata={"audience": "clinician"}, ) print(answer.text) for ref in answer.asha.references: print(ref.marker, ref.display) if answer.asha.safety.needs_escalation: print(answer.asha.safety.escalation.message) v = client.verify("Metformin is first-line therapy for most adults with type 2 diabetes.") print(v.verdict, v.caveat) mc = client.clinical.med_check(["warfarin", "fluconazole"], format="fhir") print(mc.findings_text, len(mc.detected_issues)) ``` ### TypeScript (openai package) ```typescript npm install openai import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.askasha.org/v1", apiKey: process.env.ASHA_API_KEY }); const answer = await client.chat.completions.create({ model: "asha-base", messages: [{ role: "user", content: "First-line drug therapy for uncomplicated hypertension?" }], }); console.log(answer.choices[0].message.content); const asha = (answer as any).asha; for (const ref of asha?.references ?? []) console.log(ref.marker, ref.display); if (asha?.safety?.needs_escalation) console.log(asha.safety.escalation.message); ``` ### MCP The `asha` command line runs an MCP server (`asha mcp`) for asking Asha and for account tools. Setup: Use with your agent (MCP). Source: https://askasha.org/developers/docs/sdks ## Cookbook Runnable recipes on the `askasha` SDK. Each reads `ASHA_API_KEY`, calls production, and exits non-zero when the response lacks what it needs. Every case is synthetic. Source: https://github.com/DNAiOS/asha/tree/main/cookbook. ### Recipes | # | Recipe | File | What it shows | | --- | --- | --- | --- | | 01 | Patient-facing assistant with escalation | `cookbook/01_patient_assistant.py` | Patient register; the escalation message goes above the answer; when-to-seek-care guidance on every reply. | | 02 | Clinician assistant with an A&P template | `cookbook/02_clinician_ap_template.py` | `instructions` carry the template; references with locators; `requires_clinician_review`. | | 03 | Clinical subagent with JSON Schema output | `cookbook/03_clinical_subagent_json.py` | `response_format: json_schema` (strict), validated server-side; handles 422 `schema_unsatisfied`. | | 04 | EHR summary for a downstream agent | `cookbook/04_ehr_summary_for_agent.py` | Synthetic note to a typed summary, extracted medications through med-check, one handoff object with the receipt id. | | 05 | Check claims before you show them | `cookbook/05_verify_before_show.py` | Show only claims the corpus supports; hold the rest with the reason. | | 06 | Medication check with FHIR DetectedIssue | `cookbook/06_med_check_fhir.py` | Deterministic screen with renal and potassium context; FHIR R4 Bundle out. | | 07 | Search plus rerank for your own RAG | `cookbook/07_search_rerank_rag.py` | Typed results with PMID and DOI locators, retracted items dropped, a cited context block for your model. | | 08 | Switch from OpenAI or Anthropic | `cookbook/08_switch_base_url.py` | Official SDKs with only the base URL and key changed. | | 09 | Migrate from Glass | `cookbook/09_migrate_from_glass.py` | Request and response translation; field table in `MIGRATE_FROM_GLASS.md`. | | 10 | Idempotent retries and receipts | `cookbook/10_idempotent_retries_receipts.py` | The same Idempotency-Key replays without billing again; receipt fingerprint and corpus commitment checks. | ### Run them ```bash git clone https://github.com/DNAiOS/asha && cd asha pip install -e "sdk/python[anthropic]" export ASHA_API_KEY=dnai_a2a_... python cookbook/run_all.py --out results.json ``` Source: https://askasha.org/developers/docs/cookbook ## Command line `asha` is a single-file, standard-library Python 3.8+ command line: set up in three steps, customize your agent, ask with streaming, run live checks, handle the BAA, and give your coding agent Asha as a tool over MCP. ### Install and set up: asha init `asha init` does three things: creates or reuses your key, saves how your agent answers (name, organization, tone, audience, length, emoji), and asks a first question so you see a cited answer. `asha init --yes --email you@company.com --name CareBot --verbosity brief` runs it without prompts. | Item | Value | | --- | --- | | Requirement | Python 3.8 or newer, `curl` or `wget`. No packages. | | Install location | `~/.local/bin/asha` (override with `ASHA_INSTALL_DIR`). | | Script | `https://askasha.org/cli/asha` (read it before you run it; it is one file) | | Key storage | `~/.config/asha/credentials.json`, mode 0600. `ASHA_API_KEY` and `--key` override it. | | Base URL | `ASHA_API_BASE` or `--base`; default `https://api.askasha.org`. | ```bash curl -fsSL https://askasha.org/cli/install.sh | sh asha init # 1 key, 2 customize your agent, 3 first answer asha ask "Which antihypertensives are safe in pregnancy?" --audience clinician ``` ### Commands | Command | What it does | | --- | --- | | `asha init [--email E] [--name N] [--org O] [--tone T] [--audience A] [--verbosity V] [--emoji E] [--no-test] [--yes]` | Three steps: key, saved settings, first answer. Prompts when run in a terminal; flags and `--yes` for scripts. | | `asha signup EMAIL [--name NAME] [--save]` | Creates a free Asha-only key (`product: asha`, 250/month, 50/day, 20 RPM) and prints it once. | | `asha login [--key KEY]` | Verifies a key against `/api/a2a/usage` and saves it. | | `asha logout` | Removes the saved key. | | `asha ask "question" [--audience A] [--verbosity V] [--emoji E] [--name N --org O --tone T] [--session ID] [--depth base\|auto] [--model ID] [--no-memory] [--no-stream] [--json] [--verbose]` | Streams the answer, then prints the sources footer. Style flags override the saved settings for this call. `--json` prints the task; `--verbose` shows pipeline phases on stderr. Reads stdin when no question is given. | | `asha config show \| set key=value ... \| reset` | Reads or saves the key's defaults: `name`, `org`, `tone`, `audience`, `verbosity`, `emoji`, `memory`. An empty value clears one field; `name=` drops the white label. | | `asha test [--yes] [--json]` | Three live checks with their task ids: a grounded answer with sources, emergency routing for chest pain, and your saved length and emoji settings. Uses 3 queries. | | `asha mcp` | Runs the MCP server on stdio for coding agents (Use with your agent). | | `asha mcp add claude-code\|codex\|cursor\|gemini\|vscode\|claude-desktop\|other` | Prints the setup command or config for that agent, with the full path to `asha`. | | `asha usage`, `asha whoami` | Plan, scope, today's and this month's counts, remaining, RPM rate limit, max query characters, tokens, prepaid balance, and estimated spend. | | `asha portal [--open] [--json]` | Prints (or opens) the Stripe billing portal URL for invoices, cards, and cancellation. | | `asha rotate [--yes] [--save]` | Replaces the key; the old key stops at once. | | `asha models` | Model ids for the OpenAI-compatible endpoint. | | `asha baa show [--md]` | The current agreement, its version and SHA-256, and PHI readiness. | | `asha baa accept --org --signer --title --email [--yes]` | Records acceptance for your account and prints the receipt. | | `asha baa status` | Acceptance state, whether you are on the current version, PHI mode, next step. | | `asha docs [topic]`, `asha version` | Docs URL, or the doc sections that match a topic (`asha docs errors`, `asha docs benchmarks`, `asha docs pricing`) from llms-full.txt; CLI version (`0.3.0`). | ### Customize from the terminal ```bash asha config set name=CareBot org="Acme Health" tone=warm audience=patient verbosity=brief emoji=off asha config show asha ask "Is it safe to take ibuprofen with lisinopril?" --verbosity detailed # one-call override asha config reset # answer as Asha again ``` ### Exit codes | Code | Meaning | | --- | --- | | 0 | Success. | | 1 | User-facing error (no key, HTTP error, cancelled prompt). Message on stderr, no traceback. | | 2 | `ask --no-stream` returned a task that did not complete, or `asha test` had a failing check. | | 130 | Interrupted. | Source: https://askasha.org/developers/docs/cli ## Customize your agent Choose how Asha answers your users: under your product's name or as Asha, for patients or clinicians, brief or detailed, with or without emoji. Save the settings on your key once, or send them per request. Emergency routing, crisis resources, refusals, and citations are the same under every setting. ### Settings | Setting | Values | Default | Effect | | --- | --- | --- | --- | | `persona.name` | Up to 32 characters, 4 words | None: answers as Asha | Asha presents itself under this name. Asked who built it, it says it is built on DNAi Systems intelligence. Titles and credentials (`Dr`, `MD`, `nurse`), instruction-shaped text, and DNAi agent names are rejected. | | `persona.organization` | Up to 60 characters, 8 words | None | Tells the user the service is presented by your organization. | | `persona.tone` | `warm`, `clinical`, `concise`, `friendly`, `formal` | Asha's own voice | Sets the voice of the answer. | | `audience` | `patient`, `caregiver`, `clinician`, `nurse`, `pharmacist`, `physician` | Read from the question | Plain language for patients and caregivers; peer-grade clinical answers for clinicians. | | `verbosity` | `brief`, `standard`, `detailed` | `standard` | `brief`: the answer itself is about 120 words and leads with what to do; red flags, follow-up questions, and the sources list still follow it. `standard`: Asha's usual length, which depends on the question. `detailed`: about 800 to 1,200 words under headings (evidence and its strength, options, risks, when to get care). Safety warnings and citations stay at every length. | | `emoji` | `off`, `none`, `on` | `off` | `off`: no expressive emoji; functional marks such as ✓ and ⚠ may appear. `none`: plain text only, with check and warning marks as text characters. `on`: up to two of Asha's marks in a reply, never in crisis, grief, clinician, caregiver, or document replies, and not in back-to-back replies. | | `memory` | `on`, `off` | `on` | `off`: no personal-memory read or write for the call. | ### Where to set them | Way | How | Applies to | | --- | --- | --- | | Saved on your key | `PUT /api/a2a/preferences`, `asha config set`, or the `asha_preferences` MCP tool | Every call with the key: `message:send`, `message:stream`, and `/v1/chat/completions`. | | Per request | `metadata` on the same three endpoints, same field names | That call. A request value wins over the saved value field by field; a request `persona` replaces the saved persona whole. | | `asha-apex` model | Enterprise only | Runs the benchmarked configuration unchanged; saved settings do not apply. | ### Endpoints | Method | Path | Behavior | | --- | --- | --- | | GET | `/api/a2a/preferences` | Returns `preferences` (what is saved), `effective` (saved values plus defaults), and `allowed` (every valid value). | | PUT | `/api/a2a/preferences` | Replaces the saved object. Send `{}` to reset. `asha config set` merges for you. Unknown fields return 422; a bad value returns 400 `invalid_params` with `param` naming the field. | | Either | Key type | Keys created on this site (self-service). Internal keys send the same fields in `metadata`. | ```bash curl -X PUT https://api.askasha.org/api/a2a/preferences \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"persona": {"name": "CareBot", "organization": "Acme Health", "tone": "warm"}, "audience": "patient", "verbosity": "brief", "emoji": "off"}' curl https://api.askasha.org/api/a2a/preferences -H "Authorization: Bearer YOUR_API_KEY" ``` ### From the command line ```bash asha config set name=CareBot org="Acme Health" tone=warm audience=patient verbosity=brief emoji=off asha config show asha ask "Is it safe to take ibuprofen with lisinopril?" --verbosity detailed # one-call override asha config reset # answer as Asha again ``` ### Per request ```json { "message": {"role": "user", "parts": [{"text": "Red flags for a fever in a 2-year-old?"}]}, "metadata": { "audience": "caregiver", "verbosity": "detailed", "emoji": "none", "persona": {"name": "CareBot", "organization": "Acme Health"} } } ``` ### What no setting changes | Rule | Under every setting | | --- | --- | | Emergencies | Chest pain, stroke signs, overdose, and similar get the instruction to call emergency services. | | Crisis | Self-harm and suicide questions get crisis resources (988 in the US) and no emoji. | | Evidence | Sources and citations are returned on every answer, in the text and in the provenance artifact. | | Identity | The agent says it is an AI and, when asked, that it is built on DNAi Systems. It never claims a credential. | | Privacy | Personally identifying patterns are redacted before storage. | Source: https://askasha.org/developers/docs/customize ## Use with your agent (MCP) `asha mcp` runs a Model Context Protocol server on your machine. Claude Code, Codex, Cursor, Gemini CLI, VS Code, and Claude Desktop can then ask Asha, read and save your settings, check the BAA, and search these docs while they build your product. ### Set up Install the CLI and run `asha init` once; the server reads the saved key, so no secret goes into your agent's config. `asha mcp add ` prints the line below with the full path filled in. | Agent | Command or config | | --- | --- | | Claude Code | `claude mcp add asha -- asha mcp` | | Codex | `codex mcp add asha -- asha mcp` | | Cursor | `{"mcpServers": {"asha": {"command": "asha", "args": ["mcp"]}}}` | | Gemini CLI | `gemini mcp add asha asha mcp` | | VS Code | `code --add-mcp '{"name":"asha","command":"asha","args":["mcp"]}'` | | Claude Desktop | `{"mcpServers": {"asha": {"command": "/Users/you/.local/bin/asha", "args": ["mcp"]}}}` | ```bash curl -fsSL https://askasha.org/cli/install.sh | sh asha init # saves your key; the MCP server reads it asha mcp add claude-code # prints the exact command for your agent claude mcp add asha -- asha mcp ``` ### Tools | Tool | What it does | Uses a query | | --- | --- | --- | | `ask_asha` | Asks Asha. Inputs: `question`, optional `audience`, `verbosity`, `emoji`, `depth` (`base` \| `auto`), `session_id`, `memory`. Returns the cited answer, its sources, and the task id. | Yes | | `asha_usage` | Plan, queries remaining today and this month, rate limit (RPM), max query characters, prepaid balance, and estimated spend. | No | | `asha_topup` | Billing links for paid accounts. Paid plans open when our API terms are final. | No | | `asha_preferences` | `get`, `set`, or `reset` the key's saved settings (Customize your agent). | No | | `asha_baa` | The BAA summary (version, SHA-256, PHI readiness), the full text, or this account's acceptance status. Read-only. | No | | `asha_docs` | Searches these docs by topic (`errors`, `pricing`, `benchmarks`, `streaming`, `baa`) and returns the matching sections as Markdown. | No | ### Ask your agent | You say | What happens | | --- | --- | | Set up Asha for my app: call it CareBot for Acme Health, brief answers, no emoji. | `asha_preferences` saves the settings on your key. | | Use Asha to check whether ibuprofen interacts with lisinopril, for a patient. | `ask_asha` returns a cited answer your agent can quote and link. | | Write the backend call to Asha with retries. | `asha_docs` pulls the send, errors, and Idempotency-Key sections before your agent writes code. | | Where do we stand on the BAA? | `asha_baa` reports the version, whether you accepted it, and what blocks PHI mode. | ### BAA through an agent | Step | Who | | --- | --- | | Read the agreement and its SHA-256 | Your agent (`asha_baa`) or you (`asha baa show --md`). | | Check acceptance and PHI readiness | Your agent (`asha_baa` with `view: status`) or you (`asha baa status`). | | Accept | A person with authority to bind the organization, in a terminal: `asha baa accept --org ... --signer ... --title ... --email ...`. The MCP server has no accept tool. | ### Protocol | Item | Value | | --- | --- | | Transport | stdio, newline-delimited JSON-RPC 2.0. No network listener; logs go to stderr. | | Protocol versions | 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05 (negotiated at `initialize`). | | Capabilities | `tools`. Each tool declares an input schema and read-only or open-world hints. | | Errors | API errors come back as tool results with `isError: true` and the API's message, for example a daily limit with its reset. | ### Docs for agents without MCP | Document | URL | | --- | --- | | llms.txt (index) | `https://askasha.org/llms.txt` | | llms-full.txt (every page, one Markdown file) | `https://askasha.org/llms-full.txt` | | OpenAPI 3.1 | `https://api.askasha.org/openapi.json` | | Any page | The Copy page as Markdown button at the top of each docs page. | Source: https://askasha.org/developers/docs/agents ## Benchmarks and comparisons Rows from the signed benchmark register only, with the register's own limits beside them. Every row names its pipeline, item count, and grader, and is reproducible from `https://dnai.systems/benchmarks` and `GET /api/benchmarks`. ### Clinical AI Systems (n = 500) Vishwanath et al. 500-Item 3-Judge Panel (Nature Medicine 2026 rubric). Frozen Apex-J, the served Apex tier, under the study's own three-judge panel: +8.9 points over bare GPT-6 Astra on the same 500 answers (paired t-test p = 1.0e-18). | System / Configuration | Score | Details | | --- | --- | --- | | Asha Apex-J | `63.8%` | Frozen 20 Sep 2026; +8.9 points over bare GPT-6 Astra (paired t-test p = 1.0e-18) | | OpenEvidence | `62.6%` | Published clinical reference system | | UpToDate Expert AI | `61.3%` | Published clinical decision support | | GPT-6 Astra (Bare) | `54.9%` | Unassisted frontier baseline | ### HealthBench Hard (n = 1,000) 1,000 High-Difficulty Clinical Cases (Official gpt-4.1 Grader). Official gpt-4.1 grader with OpenAI's reference rubric rendering. Frozen Apex-J 48.7% (95% CI 46.9-50.5) vs 32.4% for bare GPT-6 Astra on the same items (+16.3 points, p = 3.8e-64). June tiers re-graded the same way; May bare models graded that way when run. | System / Configuration | Score | Details | | --- | --- | --- | | Asha Apex (June 2026 build) | `51.4%` | Multi-expert ensemble, June 2026; re-graded with the reference rendering | | Asha Apex-J (served) | `48.7%` | Frozen 20 Sep 2026; 95% CI 46.9-50.5; +16.3 points over bare GPT-6 Astra | | Asha Mid (June 2026 build) | `41.8%` | Three-model merge (898 scored items) | | Bare GPT-5.2 | `40.3%` | Frontier baseline, May 2026 harness (798 scored items) | | Bare GPT-6 Astra | `32.4%` | Apex-J's composer model alone, same items | | Asha Base (June 2026 build) | `29.9%` | Single retrieval-grounded pass | | Bare Gemini 3.1 Pro | `20.6%` | Frontier baseline, May 2026 harness (800 scored items) | ### Delusion and Harm Scenarios (n = 96) psychosis-bench (Au Yeung et al. 2025), 16 scenarios x 12 turns, May 2026. Same model, with and without Asha (May 2026 model, gemini-2.5-flash). Today's frontier models alone also intervene safely (Claude Sonnet 4.5 100%, Gemini 3.6 Flash 93.8%), so the gap is what Asha added to a model below that ceiling. Judge agreement fell below the pre-registered gate, so the formal verdict is inconclusive. Signed register, updated 2026-11-05. | System / Configuration | Score | Details | | --- | --- | --- | | Asha (deployed engine) | `95.8%` | 92 of 96 intervention-eligible turns; gemini-2.5-flash backbone | | Bare Gemini 3.6 Flash | `93.8%` | A current bare model, run by the external validator, September 2026 | | Bare GLM-5.2 | `80.2%` | Open weights, same harness | | Bare gemini-2.5-flash | `30.2%` | The same May 2026 backbone without Asha | ### Asha API and bare model APIs | Platform | Entry & Free Tier | Query & Token Pricing | Clinical Grounding & Verification | Developer Surface & Safety | | --- | --- | --- | --- | --- | | Asha Healthcare API | 250 queries/mo free (50/day, 20 RPM), no card | Paid plans open when our API terms are final. | Sources on every answer, from a publicly committed corpus (about 111M vectors in 20 collections, including PubMed, PMC, StatPearls, DailyMed and FDA labels; not all medical); PMID verification; FENG falsification at Apex | A2A v1.0, OpenAI-compatible `/v1`, 1-file CLI, MCP server, white-label `persona`, BAA draft to read (de-identified input only until PHI mode opens) | | Bare Frontier APIs (Claude / Gemini / GPT) | Varies ($0-$5 credit) | $1.50-$15 / 1M input tokens, $3-$75 / 1M output tokens | Parametric memory or web search; you build citation checking yourself | Safety engineering is left to the developer | ### Verify the benchmark register | Endpoint | What it returns | | --- | --- | | `GET /api/benchmarks` | Full canonical benchmark register JSON and its `register_sha256`. | | `GET /api/benchmarks/verify` | Checks whether `https://dnai.systems/benchmarks.json` matches the live API register byte for byte. | | `GET /api/audit/corpus-state/public` | SHA-512 commitment over the public corpus: 20 collections, about 111M vectors (2026-11-26), not all medical. | ```bash curl -s https://api.askasha.org/api/benchmarks/verify | python3 -m json.tool ``` Source: https://askasha.org/developers/docs/benchmarks ## Authentication and keys Keys are Bearer tokens with the prefix `dnai_a2a_`. A key is shown once at creation and stored server-side as a SHA-256 hash; nobody at DNAi can read it back. ### Create a key: POST /api/a2a/signup | Field | Type | Required | Meaning | | --- | --- | --- | --- | | `email` | string | yes | Account email. One account per address; a second signup returns 409. | | `name` | string | no | Your name or product name. | | `product` | string | no | `asha` for an Asha-only key (what this site sends). Default `dnai` mints a key for every public DNAi engine from dnai.systems. | | `tier` | string | no | Self-serve signup creates `free` keys only. Paid plans open when our API terms are final. | | `hcaptcha_token` | string | conditional | Only when the server has captcha enabled. | ```bash curl -X POST https://api.askasha.org/api/a2a/signup \ -H "Content-Type: application/json" \ -d '{"email": "you@company.com", "name": "Your product", "product": "asha"}' ``` ### Signup response | Field | Meaning | | --- | --- | | `api_key` | The Bearer token. Save it now; it is never shown again. | | `key_prefix` | First 16 characters, used to identify the key in usage and task records. | | `tier` | `free`. | | `monthly_limit`, `daily_limit` | Query allowances for the plan. | | `spending_cap_usd` | Estimated-spend ceiling for paid plans (0 on free). | | `product` | `asha`. | | `scopes` | `["asha"]`: the agents this key may call. | ### Key lifecycle | Action | Call | Effect | | --- | --- | --- | | Check usage | `GET /api/a2a/usage` | Queries today and this month, limits, remaining, `rate_limit_rpm`, `max_query_chars`, `prepaid_balance_usd`, `estimated_spend_usd`, `scopes`, `product`. | | Billing portal | `GET /api/a2a/portal` | Returns a Stripe Customer Portal link for invoices, payment methods, and cancellation. | | Rotate | `POST /api/a2a/rotate-key` | Returns a new key; the old key is invalid immediately. | | Suspend | Stripe `invoice.payment_failed` | Paid accounts pause on failed payment and resume on `invoice.paid`. | | Anti-abuse | Signup | 10 new keys per network address per 24 hours; more on request at hello@dnai.systems. | ```bash curl https://api.askasha.org/api/a2a/usage -H "Authorization: Bearer YOUR_API_KEY" curl -X POST https://api.askasha.org/api/a2a/rotate-key -H "Authorization: Bearer YOUR_API_KEY" ``` Source: https://askasha.org/developers/docs/authentication ## Send a message `POST /a2a/v1/message:send` runs Asha's full pipeline (retrieval, verification, synthesis) and returns the finished task in one response. Typical latency is 10 to 60 seconds depending on the question; use the streaming variant for a live UI. ### Request body | Field | Type | Required | Meaning | | --- | --- | --- | --- | | `message.role` | string | yes | `user`. | | `message.parts[]` | array | yes | At least one part with non-empty `text`. Parts are concatenated. Per-query character cap: 8,000 characters (~2,000 tokens) on Free Sandbox; 100,000 characters on Pay-As-You-Go and Developer; 500,000 characters on Pro and Enterprise. | | `agent_id` | string | no | `asha` or `health`. Defaults to Asha. Any other value returns 403 for a key from this site. | | `metadata` | object | no | Options below. Other keys are reserved; do not send them. | ### metadata options | Key | Values | Meaning | | --- | --- | --- | | `session_id` | string, up to 64 chars | Multi-turn continuity. Reuse the same id across calls and Asha keeps the conversation context. Longer values are truncated to 64 characters. | | `audience` | `patient`, `caregiver`, `consumer`, `principal`, `clinician`, `nurse`, `pharmacist`, `physician`, `hcp`, `professional`, `healthcare_professional` | Selects the register: plain-language patient answers or peer-grade clinical answers. `user_role` is accepted as a synonym. Unrecognized values are ignored. | | `depth` | `base`, `auto` | `base` (all self-serve plans) is one retrieval-grounded pass. `auto` (Enterprise) lets stakes routing escalate to a multi-model merge or an expert panel. Other values return 400. Every task reports `depth_served`. | | `persona` | object `{name, organization, tone}` | White label: Asha answers under your product's name and says it is built on DNAi Systems if asked. Names with credentials or instructions are rejected and the persona is dropped; the accepted name is echoed in `task.metadata.persona`. Safety rules, citations, and disclaimers stay in force. | | `memory` | `on`, `off` | `off` runs the call with no personal-memory read or write. Use for stateless or privacy-sensitive integrations. Default: one memory scope per key, never shared across keys. | | `verbosity` | `brief`, `standard`, `detailed` | Answer length. `brief` keeps the answer itself near 120 words; `detailed` aims for 800 to 1,200 words under headings. Default `standard`. Safety warnings and citations stay at every length (Customize your agent). | | `emoji` | `off`, `none`, `on` | `off` (default): no expressive emoji. `none`: plain text only. `on`: up to two of Asha's marks, never in crisis, grief, clinician, caregiver, or document replies. | ### Response: task | Field | Meaning | | --- | --- | | `task.id` | UUID. Use it with the tasks endpoints. | | `task.status.state` | `COMPLETED` or `FAILED`. | | `task.status.message` | On `FAILED`, an agent message whose text part is the error. | | `task.artifacts[0]` | `name: "response"`. `parts[0].text` is Asha's answer in Markdown. | | `task.artifacts[1]` | `name: "provenance"`. `parts[0].data` holds `sources[]`, `evidence_count`, `citations[]` (up to 20), `contract_hash`, `predicate_scope`, `model`. | | `task.metadata` | `agent_id`, `domain` (`health`), `caller` (your key prefix), `session_id` and `persona` when supplied, `input_tokens`, `output_tokens`, `evidence_count`, `citations` (up to 10), `sources` (up to 10), `depth_served` (`base`, `mid`, `apex`). | | `task.created_at`, `task.updated_at` | ISO 8601 timestamps (UTC). | ### Retries: Idempotency-Key | Header or case | Behavior | | --- | --- | | `Idempotency-Key` | Optional, 1 to 255 characters. Use a fresh UUID v4 per question and reuse it only when retrying that question. Never put personal data in it. | | Same key, same body, within 24 hours | Returns the saved response with `Idempotent-Replayed: true`. Asha does not run again and the allowance is not used again. | | Same key, different body | 409 `idempotency_key_reused`. | | Same key while the first call is still running | 409 `idempotency_in_progress` with `Retry-After: 5`. | | First call failed auth, limits, or validation | Nothing is saved; fix the request and retry with the same key. | | `Idempotency-Status: unavailable` | The retry store was unreachable; the call ran without retry protection. | | Streaming | Not supported on `message:stream`. After a dropped stream, fetch the result with `GET /a2a/v1/tasks/{task_id}`. | ### curl ```bash curl -X POST https://api.askasha.org/a2a/v1/message:send \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "agent_id": "asha", "message": { "role": "user", "parts": [{"text": "Which antihypertensives are safe in pregnancy?"}] }, "metadata": {"audience": "clinician", "session_id": "visit-2041"} }' ``` ### Python ```python import requests r = requests.post( "https://api.askasha.org/a2a/v1/message:send", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "agent_id": "asha", "message": {"role": "user", "parts": [{"text": "Which antihypertensives are safe in pregnancy?"}]}, "metadata": {"audience": "clinician", "session_id": "visit-2041"}, }, timeout=120, ) task = r.json()["task"] answer = task["artifacts"][0]["parts"][0]["text"] provenance = task["artifacts"][1]["parts"][0]["data"] print(answer) print(provenance["evidence_count"], "sources", task["metadata"]["depth_served"]) ``` ### JavaScript ```javascript const res = await fetch("https://api.askasha.org/a2a/v1/message:send", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ agent_id: "asha", message: { role: "user", parts: [{ text: "Which antihypertensives are safe in pregnancy?" }] }, metadata: { audience: "clinician", session_id: "visit-2041" }, }), }); const { task } = await res.json(); const answer = task.artifacts[0].parts[0].text; const provenance = task.artifacts[1].parts[0].data; ``` Source: https://askasha.org/developers/docs/send ## Stream a response `POST /a2a/v1/message:stream` takes the same body and auth as `message:send` and answers with `text/event-stream`: pipeline phases, text chunks as they are written, and a final task envelope. ### Events | Event | Data | When | | --- | --- | --- | | `task_created` | `{task_id, agent_id, state, created_at}` | Once, first frame. | | `phase` | `{name, elapsed_ms, ...}` | Each pipeline step (names below). | | `chunk` | `{text, elapsed_ms}` | Incremental answer text; concatenate in order. | | `heartbeat` | `{elapsed_ms}` | Every 8 seconds of silence; keeps proxies open. | | `task_completed` | `{task_id, state, response, citations, sources, depth_served, ...}` | Once; the last frame. The server closes the stream after it. | | `task_failed` | `{task_id, state, error}` | Terminal on error; the last frame. | ### Phase names | Name | Payload | Meaning | | --- | --- | --- | | `retrieval_start` | | Evidence retrieval across the medical corpus begins. | | `retrieval_complete` | `evidence_count` | Retrieval finished, bounded at 25 seconds. | | `arena_start` | `candidate_count` | Claim competition begins (higher-stakes questions only). | | `arena_complete` | `winner_count` | Claims settled, bounded at 15 seconds. | | `synthesis_start` | | Answer generation begins; `chunk` events follow. | ### curl ```bash curl -N -X POST https://api.askasha.org/a2a/v1/message:stream \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"agent_id": "asha", "message": {"role": "user", "parts": [{"text": "Red flags for pediatric fever?"}]}}' ``` ### JavaScript (fetch + ReadableStream) ```javascript const res = await fetch("https://api.askasha.org/a2a/v1/message:stream", { method: "POST", headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ agent_id: "asha", message: { role: "user", parts: [{ text: "Red flags for pediatric fever?" }] } }), }); const reader = res.body.getReader(); const decoder = new TextDecoder(); let buffer = ""; for (;;) { const { value, done } = await reader.read(); if (done) break; buffer += decoder.decode(value, { stream: true }); const frames = buffer.split("\n\n"); buffer = frames.pop(); for (const frame of frames) { const event = (frame.match(/^event: (.*)$/m) || [])[1]; const data = (frame.match(/^data: (.*)$/m) || [])[1]; if (event === "chunk") process.stdout.write(JSON.parse(data).text); if (event === "task_completed" || event === "task_failed") return; } } ``` Source: https://askasha.org/developers/docs/stream ## Tasks Every call creates a task record you can fetch, list, or cancel. Tasks are scoped to your key: you see yours and nobody else's. ### Endpoints | Method | Path | Parameters | Notes | | --- | --- | --- | --- | | GET | `/a2a/v1/tasks/{task_id}` | | Served from cache, then PostgreSQL. 404 when unknown. | | GET | `/a2a/v1/tasks` | `offset` (default 0), `limit` (default 20, max 100), `state`, `agent_id` | Returns `{tasks[], total, offset, limit}`. | | POST | `/a2a/v1/tasks/{task_id}:cancel` | | 409 when the task already reached a terminal state. | ```bash curl "https://api.askasha.org/a2a/v1/tasks?state=COMPLETED&limit=20" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### States | State | Meaning | | --- | --- | | `SUBMITTED` | Accepted, not started. | | `WORKING` | Pipeline running. | | `COMPLETED` | Answer and provenance attached. | | `FAILED` | Error text in `status.message`. | | `CANCELED` | Stopped by `:cancel`. | Source: https://askasha.org/developers/docs/tasks ## Pricing, limits, and errors The free key sets monthly and daily query allowances, a decoupled RPM rate limit, and a token envelope. Paid plans open when our API terms are final. Need more than the free tier today? Write to us at hello@dnai.systems. ### Free key | Tier | Price | Monthly | Daily | Rate limit | Token envelope | Spend cap | Depth | | --- | --- | --- | --- | --- | --- | --- | --- | | Free Sandbox | $0 | 250 queries / month | 50 queries / day | 20 RPM | Up to 2,000 in + 2,000 out tokens / query (8K chars) | None (hard cap) | `base` | ### Limits | Limit | Value | | --- | --- | | Requests per minute (RPM) | Decoupled from daily allowance in a sliding 60-second window: Free Sandbox 20 RPM, Pay-As-You-Go and Developer 60 RPM, Pro 120 RPM, Enterprise 600 RPM, counted across the whole fleet. Exceeding it returns 429 `rate_limited` with `Retry-After` set to the seconds until the window frees a request. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. | | Answers in flight per key | Free Sandbox 2, Pay-As-You-Go and Developer 5, Pro 10, Enterprise 50. One more returns 429 `concurrency_limited` with `Retry-After`. When the API lane or the Apex lane is full the reply is 429 `capacity` with `Retry-After`. | | Daily counter | Resets at midnight UTC. | | Monthly counter | Resets on the first of the month. | | Message size | 8,000 characters (~2,000 tokens) on Free Sandbox; 100,000 characters on Pay-As-You-Go and Developer; 500,000 characters on Pro and Enterprise. Standard 2,000 input + 2,000 output token envelope included in base query rate; overage billed at $4.00/1M input and $16.00/1M output tokens. | | Task list page | 100 tasks. | | Signups per network | 10 per 24 hours. | ### Error body | Field | Meaning | | --- | --- | | `error.type` | The cause, one value per row in the table below. Branch on this; it does not change. | | `error.code` | JSON-RPC 2.0 / A2A v1.0 number where a standard one exists, so related causes share a code. | | `error.message` | Readable explanation. Wording can change; do not parse it. | | `error.param` | The field or header the error is about, as a dotted path (`metadata.depth`, `message.parts`, `Idempotency-Key`). | | `error.doc_url` | Link to this error type in the reference. | | `error.request_id` | Same as the `X-Request-ID` response header. Quote it when you contact support. | | `error.retry_after` | Seconds until a retry can succeed (limits, some 409s and 503s). Also sent as the `Retry-After` header. | | `error.fields` | `validation_error` only: each failing field as `{loc, msg, type}`. | | `detail` | Older field, kept unchanged for existing clients. New code reads `error`. | | `Accept: application/problem+json` | Send this header to receive the same facts as RFC 9457 Problem Details (`type`, `title`, `status`, `detail`, `instance`, plus `code`, `error_type`, `request_id`, `param`, `retry_after`). | ### Errors | HTTP | `type` | `code` | Cause | | --- | --- | --- | --- | | 400 | `invalid_request` | `-32600` | Empty message, message over the plan's character limit (8,000 on Free Sandbox, 100,000 on Pay-As-You-Go/Developer, 500,000 on Pro/Enterprise), or a signup or billing field the API does not accept (email, `tier`, `product`, paid tier at signup, captcha). | | 400 | `invalid_params` | `-32602` | `metadata.depth` is neither `base` nor `auto`. | | 422 | `validation_error` | `-32602` | Body does not match the schema, for example `message` sent as a string instead of `{role, parts}`. | | 401 | `authentication_required` | `-32050` | No `Authorization: Bearer` header. | | 401 | `invalid_api_key` | `-32050` | Unknown, mistyped, or rotated key. | | 403 | `permission_denied` | `-32051` | Key has no access to the requested agent (Asha keys reach `asha` only). | | 403 | `account_suspended` | `-32051` | Failed payment. Fix it in the billing portal; usage, portal, and upgrade still work. | | 404 | `not_found` | `-32052` | No account or billing record for this key. | | 404 | `agent_not_found` | `-32052` | No public agent with this id. | | 404 | `task_not_found` | `-32001` | Unknown task, or a task created by another key. | | 409 | `conflict` | `-32053` | Signup: an account already exists for that email. Rotate the key instead. | | 409 | `task_not_cancelable` | `-32002` | Cancel on a task that already finished. | | 410 | `agent_retired` | `-32054` | The agent was retired and no longer answers. | | 409 | `idempotency_key_reused` | `-32055` | The `Idempotency-Key` was already used with a different body. Use a new key. | | 409 | `idempotency_in_progress` | `-32056` | The first call with this key is still running. Retry after `retry_after` seconds. | | 429 | `rate_limited` | `-32060` | Per-minute limit for the key. Wait `Retry-After` seconds. | | 429 | `daily_quota_exceeded` | `-32061` | Daily allowance used. Resets 00:00 UTC. | | 429 | `monthly_quota_exceeded` | `-32062` | Monthly allowance used. Resets on the 1st, or upgrade. | | 429 | `spending_cap_reached` | `-32063` | Spend cap for the month reached. | | 429 | `signup_rate_limited` | `-32064` | 10 new keys per network in 24 hours. | | 429 | `concurrency_limited` | `-32065` | The key has its plan's number of answers in flight. Retry when one finishes. | | 429 | `capacity` | `-32066` | The API lane, the Apex lane, or the box is full. Wait `Retry-After` seconds. | | 500 | `internal_error` | `-32603` | Unexpected error. Quote `error.error_id` to support. | | 503 | `service_unavailable` | `-32070` | Database or signup store briefly unavailable; retry in a few minutes. | Source: https://askasha.org/developers/docs/limits ## BAA, self-serve Read, accept, and check a Business Associate Agreement from the API or the command line. The agreement is versioned and hashed; your receipt proves the exact text you accepted. Status is stated, never implied: the current text is a draft pending counsel review, and PHI mode opens only when both gates below clear. ### Endpoints | Method | Path | Auth | Purpose | | --- | --- | --- | --- | | GET | `/api/a2a/baa` | None | Current agreement as JSON (`?format=md` Markdown, `?format=html` page): version, status, SHA-256, sections, subprocessors, PHI readiness. | | POST | `/api/a2a/baa/accept` | API key | Record acceptance for the key's account. Body: `organization`, `signer_name`, `signer_title`, `signer_email`, `attest_authority: true`, `accept_version` (current), optional `accept_sha256`. | | GET | `/api/a2a/baa/status` | API key | Latest acceptance, whether it matches the current version, `phi_allowed`, blockers, next step. | ```bash asha baa show --md # read the agreement (Markdown, with its SHA-256) asha baa accept --org "Acme Health" --signer "Jane Doe" --title CTO --email jane@acme.health asha baa status # receipt, version, PHI readiness, next step ``` ### Receipt | Field | Meaning | | --- | --- | | `acceptance_id`, `accepted_at` | Ledger row and timestamp (UTC). | | `baa_version`, `baa_sha256` | The exact text accepted. Compare with `GET /api/a2a/baa?format=md` at any time. | | `document_status` | Status of the text at acceptance, for example `DRAFT - Internal legal review complete ...`. | | `organization`, `signer` | Who bound whom; the signer attests authority. | | `phi_allowed` | Whether this key may send PHI now. | | `phi_readiness.blockers` | What still stands between acceptance and PHI mode. | ### PHI readiness: the two gates | Gate | Today | Clears when | | --- | --- | --- | | Agreement text effective | No: version 0.2-draft. Internal legal review against 45 CFR 164.504(e)(2) and 164.314(a)(2) complete 2026-09-29; awaiting principal ratification and an external flag-only read | The ratified text is published as v1.0 with `effective: true`; existing acceptances are asked to re-accept in one step. | | Model path inside a DNAi BAA | No: developer traffic runs on the direct Anthropic API, outside a BAA | PHI-designated keys route to the BAA-covered model path (Google Vertex today; Anthropic HIPAA organization pending). | | Result | `phi_allowed: false` for every account | Both gates true: `phi_allowed: true` on accepted, current-version accounts. | ### Subprocessors named in section 6 | Subprocessor | Role | BAA | | --- | --- | --- | | Google Cloud (Vertex AI) | Model inference for PHI-designated traffic | DNAi BAA in place | | Anthropic (direct API) | Model inference for non-PHI traffic (live default) | Outside a BAA; HIPAA organization pending | | Cloudflare | Edge, tunnel, TLS termination (transit only) | To be verified and published before PHI mode opens | | DNAi Systems infrastructure | Retrieval, memory, task and audit stores | First party; PHI-isolated vector store | ### Until PHI mode opens | Item | Rule | | --- | --- | | What you may send | De-identified queries. Personally identifying patterns are redacted before storage on every request regardless. | | Why accept now | Your acceptance is on record with a hash; when the effective version publishes you re-accept in one command instead of starting a paper process. | | Legal effect | None until the effective version is published. Requires review by your own counsel as well. | | Questions | hello@dnai.systems | ```bash curl https://api.askasha.org/api/a2a/baa?format=md curl -X POST https://api.askasha.org/api/a2a/baa/accept \ -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \ -d '{"organization": "Acme Health", "signer_name": "Jane Doe", "signer_title": "CTO", "signer_email": "jane@acme.health", "attest_authority": true, "accept_version": "0.2-draft"}' curl https://api.askasha.org/api/a2a/baa/status -H "Authorization: Bearer YOUR_API_KEY" ``` Source: https://askasha.org/developers/docs/baa ## Machine-readable documents These are the documents AI agents and tooling read. The tables below show what they contain so a person can check them without parsing JSON. ### Documents | Document | URL | Contents | | --- | --- | --- | | Asha agent card | `https://api.askasha.org/.well-known/agent-card.json?agent_id=asha` | A2A discovery document for Asha: interface URL, protocol version, security scheme, skills, epistemic capabilities. | | Directory card | `https://api.askasha.org/.well-known/agent-card.json` | Every public DNAi engine. Keys from this site call Asha only. | | OpenAPI 3.1 | `https://api.askasha.org/openapi.json` (also `/openapi.yaml`) | Generated from the running service; public developer paths only. Every operation has an operationId, examples, and its errors. | | API reference | `https://dnai.systems/api-reference` | The same document rendered for reading: every field, status code, error, and a curl sample per operation. | | llms.txt | `https://askasha.org/llms.txt` | Plain-text index of this API for language-model agents. | | llms-full.txt | `https://askasha.org/llms-full.txt` | Every docs page as one Markdown file, regenerated on each release. `asha docs ` and the `asha_docs` MCP tool search it. | | Corpus commitment | `https://api.askasha.org/api/audit/corpus-state/public` | Cryptographic hash over the knowledge corpus Asha answers from. | | Health | `https://api.askasha.org/a2a/v1/health` | `{status, agents, protocol}`; 503 when the engine is down. | | API terms | `https://api.askasha.org/api/a2a/terms?format=html` | Draft terms pending counsel review; JSON without the query string. | ### Asha agent card fields | Field | Value | | --- | --- | | `name` | Asha | | `version` | 2.0.0 | | `url` | `https://api.askasha.org/a2a/v1` | | `protocolVersion` | 1.0 | | `provider` | DNAi Systems, https://dnai.systems | | `defaultInputModes` | `text/plain`, `application/json` | | `defaultOutputModes` | `text/plain`, `application/json` | | `securitySchemes.bearer` | HTTP Bearer, format API-Key | | `epistemicCapabilities.provenanceInResponses` | true: sources and citations on every task | | `epistemicCapabilities.falsificationEndpoint` | `/api/feng/falsify` (JWT, Asha app accounts) | | `epistemicCapabilities.temporalQuerySupport` | true | | `epistemicCapabilities.evidenceGrounding` | CIU-grounded: retrieval, verification, Merkle audit | | `epistemicCapabilities.hallucinationMitigation` | Pre-generation verification and post-generation entity checks | ### Asha skills (from the agent card) | Skill id | Name | Example prompt | | --- | --- | --- | | `medical-qa` | Medical question answering | What are the latest treatment guidelines for type 2 diabetes? | | `drug-interaction-check` | Drug interaction check | Can a patient on warfarin safely take ibuprofen? | | `clinical-guidelines` | Clinical guideline lookup | USPSTF screening recommendations for colorectal cancer | | `evidence-synthesis` | Evidence synthesis | Summarize the evidence for ketamine in treatment-resistant depression | Source: https://askasha.org/developers/docs/discovery ## Changelog Every change to the developer API, newest first. Additive changes need no action; behavior changes say what to check. ### Versioning | Item | Value | | --- | --- | | Protocol | A2A v1.0. Every `/a2a/v1` response carries `A2A-Version: 1.0`. | | Additive changes | New fields, headers, error types, and endpoints ship without a version change. Clients must ignore fields they do not know. | | Behavior changes | Marked below with what to check. | ### Changes | Date | Change | Kind | | --- | --- | --- | | 2026-11-28 | The developer pages show the free key only. Paid plans and Pay-As-You-Go top-ups open when our API terms are final. The free key keeps 250 queries a month, 50 a day and 20 RPM with no card. | Docs change | | 2026-11-27 | Docs corrected. Pay-As-You-Go is prepaid credit only: $0.03 per Base query (about 333 per $10), and requests stop when the balance reaches zero. Earlier pages said a $10 top-up unlocked 1,000 evaluation queries a month; that was wrong and is withdrawn. The `askasha` packages are not on PyPI or npm, and `@askasha/mcp` is not published; use the `openai` package with base URL `https://api.askasha.org/v1`, or install the Python SDK from GitHub source. The Vishwanath 500-item row now cites the register's paired t-test (p = 1.0e-18). | Docs fix | | 2026-11-26 | SDK source for Python and TypeScript in github.com/DNAiOS/asha on the `openai` and `anthropic` packages, with typed `verify`, `med_check`, `search`, `rerank`, `receipts` and `models`; a ten-recipe cookbook that runs from a clone. Docs: `/v1` reference, the `asha` object, clinical tools. | Additive | | 2026-11-26 | `/v1/messages` (Anthropic wire), `/v1/verify` (preview), `/v1/clinical/med-check`, `/v1/search` (preview), `/v1/rerank`, `/v1/receipts/{id}`, `/v1/corpus-state`; the `asha` object on every `/v1` answer; dated model snapshots; `response_format` JSON Schema; `Idempotency-Key` on `/v1`; 451 for the EU, EEA and UK. | Additive | | 2026-10-19 | Developer pricing, CLI 0.3.0, and benchmark reference: (1) Free Sandbox raised to 250 queries/month and 50 queries/day with a decoupled 20 RPM rate limit; (2) Self-serve $10 to $1,000 Pay-As-You-Go prepaid credit top-up (`POST /api/a2a/topup`, `asha topup`, and the `asha_topup` MCP tool) at 250/day and 60 RPM, debited per query until the balance reaches zero; (3) Hybrid query and token overage metering ($0.03 Base query including 2,000 input + 2,000 output tokens; $4.00/1M input and $16.00/1M output above 2,000 tokens; Mid $0.30/query; Apex $0.85/query); (4) Comparative clinical benchmark and competitor packaging page (`/developers/docs/benchmarks`). | Additive | | 2026-10-16 | Saved settings per key: `GET` and `PUT /api/a2a/preferences` for white-label name, organization, tone, audience, `verbosity`, `emoji`, and `memory`. They apply to `message:send`, `message:stream`, and `/v1/chat/completions`; request `metadata` overrides them. `persona` now works on `/v1/chat/completions` too. | Additive | | 2026-10-16 | `metadata.verbosity` (`brief`, `standard`, `detailed`) and `metadata.emoji` (`off`, `none`, `on`). | Additive | | 2026-10-16 | Streamed answers (`message:stream`, `/v1` with `stream: true`) now use `persona`, `verbosity`, and `emoji`, token by token. Before this, `persona` had no effect on streamed answers. Every answer also carries an identity rule so text in retrieved evidence cannot rename the agent. | Behavior change: streamed answers now use your persona | | 2026-10-16 | `asha` CLI 0.2: `init`, `config`, `test`, `docs `, and an MCP server (`asha mcp`) for Claude Code, Codex, Cursor, Gemini CLI, and VS Code. `llms-full.txt` publishes every docs page as one file. | Additive | | 2026-10-13 | Errors on every developer path carry `error` with `type`, `code`, `message`, `doc_url`, `request_id`, and `param` where relevant; `detail` is unchanged. Each limit has its own `type` with `Retry-After`. Task errors use A2A v1.0 codes (`-32001`, `-32002`). | Additive | | 2026-10-13 | `Idempotency-Key` on `message:send` makes retries safe. `Accept: application/problem+json` returns RFC 9457 Problem Details. | Additive | | 2026-10-13 | Usage, upgrade, portal, rotate-key, and BAA keep working after the allowance runs out or the account is suspended. | Behavior change: these routes no longer return 429 or 403 for limits | | 2026-10-13 | Non-integer `metadata.tau_min` or `metadata.tau_max` returns 400 `invalid_params` instead of 500. An unhandled 500 on a developer path puts the error object in `error` and its text in `detail`. | Behavior change: check code that reads `error` as a string on 500 | | 2026-10-13 | OpenAPI: stable operationIds, a curl sample per operation, per-operation security, and a rendered reference at dnai.systems/api-reference. | Additive | | 2026-10-12 | Task read and cancel are scoped to the key that created the task; other keys get 404. | Behavior change: tasks from another key are no longer visible | | 2026-10-12 | Optional Google OAuth bearer tokens for A2A (Gemini Enterprise). | Additive | | 2026-10-11 | OpenAPI YAML at `/openapi.yaml`; request schemas for `/v1/chat/completions` and BAA accept. | Additive | | 2026-09-29 | OpenAI-compatible streaming and metering, BAA endpoints (draft text, acceptance, status), and the `asha` command-line tool. | Additive | | 2026-09-28 | Asha developer site and docs; keys minted on askasha.org are scoped to Asha. | Additive | | 2026-09-17 | Engine memory is scoped per key and never shared across keys. | Behavior change: earlier calls from other keys no longer inform answers | | 2026-09-16 | Domain keys (`health`, `fitness`, ...), `metadata.depth`, and the curated OpenAPI document. | Additive | | 2026-09-15 | Customer keys run Base depth; Mid and Apex need Enterprise. | Behavior change: `depth_served` reports what ran | Source: https://askasha.org/developers/docs/changelog ## Scope and safety What a key from this site can reach, what Asha's answers are, and how your users' data is handled. ### Scope | Item | Rule | | --- | --- | | Agents | `asha` and its alias `health`. Every other agent id returns 403. | | Key scope field | `scopes: ["asha"]` on signup and usage responses. | | Depth | Self-serve plans run `base`. Enterprise keys may send `depth: "auto"`. | | Hosts | `https://api.askasha.org` is the canonical host for this API. | | Regions | The API does not serve the EU, EEA or UK: requests from there return 451 `region_not_supported`. | ### Clinical use | Item | Rule | | --- | --- | | What an answer is | Evidence-grounded medical information with sources. It is information, and a licensed clinician decides. | | Your product | Keep a clinician in the loop for diagnosis and treatment decisions. Show the sources Asha returns. | | Safety protocols | Crisis and self-harm handling, refusals, and disclaimers stay active under any `persona`. Do not strip them from the text you display. | | Terms | Draft API terms: `https://api.askasha.org/api/a2a/terms?format=html`. | ### Data handling | Item | Rule | | --- | --- | | Logging | Queries are logged for security, abuse prevention, and service improvement. | | PHI | PHI mode is closed: send de-identified or synthetic data only. Sandbox keys get 422 `phi_not_allowed` when identifiers are detected. Personally identifying patterns are redacted before a query is stored. Send `metadata.memory: "off"` to skip personal-memory read and write entirely. | | BAA | Self-serve and versioned (`GET /api/a2a/baa`). The text is a draft pending counsel review; PHI mode opens only after both readiness gates clear. | | Memory scope | One memory per key. Nothing crosses between keys or between your users and Asha's consumer app. | | Sessions | `metadata.session_id` groups turns; omit it for independent questions. | | Privacy policy | `https://askasha.org/privacy` | Source: https://askasha.org/developers/docs/safety