Skip to main content
POST
Run HASP's native chat completion for the caller's org

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Validates POST /v1/ai/chat per PRD §05-public-api.

HASP-509: extended from a single-turn message field to a full superset — messages[] history (same content-block dialect Anthropic-compat uses, so AnthropicMessagesRequestBuilder is reused verbatim for both), tools, and the full cross-provider parameter set (top_p/top_k/tool_choice/ metadata/stop_sequences). message (singular) is preserved as shorthand for a single user-turn request — exactly one of message/messages must be present.

message
string
Maximum string length: 100000
model
string | null
Maximum string length: 100
conversation_id
string | null

Either a bare ULID (the pre-existing passthrough tag) or a conv_-prefixed id naming a server-owned conversation (ADR-AHK8YT). Validated as a pattern rather than ulid so the prefixed form is not rejected before the controller can resolve it; which of the two it is decides whether the call is stateful.

Pattern: ^(conv_)?[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$
stream
boolean | null
store
boolean | null
system
string | null
Maximum string length: 10000
tool_choice
string | null

InferenceRequest's canonical vocabulary directly: 'auto'|'any'| 'none'| — no compat-surface wire shape to normalize.

top_p
number | null
Required range: 0 <= x <= 1
top_k
integer | null
Required range: x >= 1
provider_extensions
string[] | null

Escape hatch for provider-specific wire keys the canonical fields above don't (yet) model — see ADR-ZP99PX.

stop_sequences
string[] | null
metadata
object
subject
object

PRD-phi-reidentification-map §8: contextual subject binding for the audit row fidelity layer. Optional everywhere — when present, both type and id must be set (rule required_with on each side).

on_behalf_of
object

Asserted end-user identity: which user of your application took this action. Recorded on the audit chain as an assertion made by your integration — HASP does not verify it, and it is never shown to the model. Distinct from subject, which names who or what the action is about. id is your stable identifier for the person; display is an optional human-readable name shown to audit reviewers. Supported for API-key credentials only.

messages
object[]
Minimum array length: 1
tools
object[] | null

App-domain tool shape — no wire-format translation needed since this is HASP's own surface, not a compat passthrough.

Response

success
boolean
required
data
object
required
meta
object
required