The Hasp AI API exposes two inference surfaces. Both enforce the same compliance checks — BAA validation, credit accounting, PHI scanning — but they differ in what they expose and who they’re designed for.Documentation Index
Fetch the complete documentation index at: https://docs.usehasp.com/llms.txt
Use this file to discover all available pages before exploring further.
Surface comparison
Native (/v1/ai/chat) | Anthropic-compat (/v1/messages) | |
|---|---|---|
| Primary use case | New integrations, regulated workflows | Drop-in for existing Anthropic SDK code |
| Migration effort | Minimal (Hasp-native SDK) | None — change baseURL only |
| Response envelope | Hasp envelope with meta.request_id, meta.phi | Anthropic wire format |
| Error format | Hasp error codes (INVALID_API_KEY, etc.) | Anthropic error types (authentication_error, etc.) |
| Streaming | SSE with Hasp event taxonomy | SSE matching Anthropic’s stream protocol |
| PHI metadata | Exposed in response (meta.phi.*) | Not exposed |
| Audit access | Retrieve via GET /v1/ai/messages/{id} | Same — request_id maps to same record |
| Future features | First to get Hasp-native capabilities | Anthropic wire compatibility only |
When to use native (/v1/ai/chat)
Use the native surface when you:
- Are building a new integration and want full Hasp capabilities from the start.
- Need PHI metadata in responses (entity types detected, redaction count).
- Want the Hasp error vocabulary (
PHI_BLOCKED,BAA_REQUIRED, etc.) rather than the Anthropic mapping. - Are building tooling against the audit trail and want the richest response envelope.
When to use Anthropic-compat (/v1/messages)
Use the compat surface when you:
- Already have code using
@anthropic-ai/sdkand want Hasp compliance with zero code changes. - Are evaluating Hasp as a drop-in replacement for direct Anthropic calls.
- Are building a prototype and want to defer the native migration.
Migrating from compat to native
meta.request_id at top level and meta.phi if redaction was applied. Anthropic-compat responses follow the standard Anthropic shape with id as the request identifier.
What’s the same on both surfaces
- All compliance checks run. PHI scanning, BAA validation, credit checks, and audit logging are identical on both surfaces. You cannot bypass compliance by using the compat endpoint.
- Same API keys. The same
wa_live_*key works on both surfaces with theai:chatscope. - Same model identifiers. The Hasp model name (
claude-sonnet-4-6) is the same on both. - Same request_id. The
idfield on compat responses and themeta.request_idon native responses resolve to the same record viaGET /v1/ai/messages/{id}.