Skip to main content
 print this page

Invoke model

POST 

/ai/models/:model_id

Starts an asynchronous text generation against an enabled AI model. A 200 means accepted, not complete: the call records an invocation with status IN_PROGRESS, and returns immediately with an InvocationId. Poll GET /ai/models/{model_id}?action=invoke&invocation_id=<id> until InvocationStatus is no longer IN_PROGRESS. It becomes COMPLETED with a ModelResponse, or FAILED with a FailureReason. Preconditions: the model must exist and be Enabled; a disabled model returns AI-1007 as a 400. The prompt is capped at 128000 characters. Input and output modality are fixed to TEXT for this endpoint. Guard rails are always applied: Provide GuardrailId to pin a specific Amorphic guard rail , otherwise the environment's default guard rail is used. When a guard rail intervenes, it is recorded on the invocation record rather than returned here. Not idempotent — every call creates a new invocation. Invocation records are retained for 30 days and then expire.

Request

Responses

Invocation accepted and queued. Generation has not run yet — retain InvocationId and poll GET /ai/models/{model_id}?action=invoke&invocation_id=<id> for the result.

Response Headers
    Access-Control-Allow-Origin
    Access-Control-Allow-Methods
    Access-Control-Allow-Headers