# Vista Brain — Libraxis API

> Bounded veterinary evidence retrieval with stable source provenance, OpenAI Responses API inference, Anthropic Messages compatibility, embeddings, reranking, and clinical speech-to-text on Libraxis hardware.

Base URL: `https://api.libraxis.com`

## When to use this

Reach for `api.libraxis.com` when your agent or veterinary software needs any of these jobs:

1. **Evidence-backed veterinary retrieval (`Vista Brain`)** — Check readiness via `GET /v1/vista-brain/index/status`, retrieve bounded chunks with stable source provenance via `POST /v1/vista-brain/search`, or run safety-gated clinical synthesis via `POST /v1/vista-brain/query` (or SSE `POST /v1/vista-brain/query/stream`).
2. **Canonical LLM & multimodal inference (`Responses API`)** — Call `POST /v1/responses` with a canonical model alias from `GET /v1/models` (`chat`, `buddy`, `soap`, `master`, `emergency`, `programmer`, `big-buddy`, `ai-suggestions`). Supports sync JSON, SSE (`Accept: text/event-stream`), NDJSON (`Accept: application/x-ndjson`), `previous_response_id` server-side turn chaining, structured outputs (`text.format`), function calling, and `input_image` / `input_file` (`text/plain`, `text/markdown`, `application/pdf`).
3. **Clinical speech-to-text (Polish & English)** — Upload audio to `POST /v1/audio/transcriptions` (multipart or base64 JSON; returns `text`, timestamps, and optional `response_id` for direct LLM chaining), stream NDJSON chunks to `POST /v1/audio/transcribe:stream`, or run transcription + formatting via `POST /v1/audio/transcriptions:format`.
4. **Anthropic SDK drop-in & retrieval primitives** — Call `POST /v1/messages` (with `anthropic-version`), `POST /v1/embeddings`, or `POST /v1/rerank`.

Do **not** use `api.libraxis.com` for:
- Autonomous veterinary diagnosis without clinician review.
- Raw Hugging Face model repository IDs — they are rejected by design; always query `GET /v1/models` and send a canonical alias.
- `/v1/chat/completions` when building new integrations (compatibility only; use `POST /v1/responses`).

## How to verify liveness and authenticate

1. **Public liveness probe (no key required):**
   `curl -sS https://api.libraxis.com/health` → returns `{"ok": true}`.
   Speech health probes: `GET /v1/audio/health` and `GET /v1/audio/ready`.
2. **Authentication (required on all other `/v1/*` routes):**
   Send either `Authorization: Bearer $LIBRAXIS_API_KEY` or `X-API-Key: $LIBRAXIS_API_KEY`.
   To obtain a key, request a reviewed beta registration token via `contact@libraxis.ai` and exchange it at `https://api.libraxis.com/access` (full walkthrough in `https://api.libraxis.com/auth.md`).
3. **Rate limits & backoff:**
   Every response returns IETF headers (`RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, `RateLimit-Policy`) plus legacy `X-RateLimit-*` headers. On `HTTP 429`, honor `Retry-After` (seconds).

## Quickstart Calls

### 1. Canonical Responses API (`POST /v1/responses`)

```bash
curl -sS https://api.libraxis.com/v1/responses \
  -H "Authorization: Bearer $LIBRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "chat",
    "input": [
      {"role": "user", "content": [{"type": "input_text", "text": "Summarize canine pancreatitis monitoring in 3 bullets."}]}
    ],
    "stream": false
  }'
```

### 2. Vista Brain Evidence Search (`POST /v1/vista-brain/search`)

```bash
curl -sS https://api.libraxis.com/v1/vista-brain/search \
  -H "Authorization: Bearer $LIBRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "feline chronic kidney disease IRIS staging", "limit": 5}'
```

### 3. Speech Transcription (`POST /v1/audio/transcriptions`)

```bash
curl -sS https://api.libraxis.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $LIBRAXIS_API_KEY" \
  -F "file=@visit_note.m4a" \
  -F "language=pl" \
  -F "response_format=verbose_json"
```

## Documentation

- [API Reference](https://api.libraxis.com/api-reference): Interactive and static HTML/Markdown reference for all public endpoints
- [Developer Docs](https://api.libraxis.com/docs): Direct documentation URL with Markdown negotiation (`Accept: text/markdown`)
- [Full Agent Handbook](https://api.libraxis.com/llms-full.txt): Complete guide with Python OpenAI SDK examples, SSE framing, model aliases, and error codes
- [Authentication Guide](https://api.libraxis.com/auth.md): Step-by-step beta token exchange and header reference
- [Pricing & Beta Access Terms](https://api.libraxis.com/pricing.md): Reviewed private beta access model and clinic deployment licensing
- [OpenAPI 3.1 JSON](https://api.libraxis.com/openapi.json): Machine-readable allowlisted OpenAPI 3.1.0 schema
- [OpenAPI 3.1 YAML](https://api.libraxis.com/openapi.yaml): YAML rendering of the same OpenAPI 3.1.0 schema
- [Private Beta Access](https://api.libraxis.com/access): Exchange an issued registration token for a short-lived API key

## Organization & Trust

- [About Libraxis](https://api.libraxis.com/about): Company overview, Vista Brain architecture, and local MLX inference substrate
- [Contact](https://api.libraxis.com/contact): Beta onboarding, developer support, and security disclosures (`contact@libraxis.ai`)
- [Privacy Policy](https://api.libraxis.com/privacy): Data handling, `store: false` ephemeral mode, and GDPR rights
