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
hasp_key_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}.