Documentation

Authentication

To ensure secure access to our APIs, each request must be authenticated using an API key. This key should be included in the request header as x-api-key: `YOUR_API_KEY`. You can generate your personal API key in your profile section. Please visit this link to generate or retrieve your API key.

API Description

The complete description of our APIs, including endpoints, request formats, and response examples, can be found here.

Prediction API

Create a new prediction from a given model input:

POST https://apiforai.io/api/v1/prediction

To get the final result of the prediction, you must either provide a webhook URL to be called when the results are ready, or regularly poll the retrieval API to get a prediction until the status is succeeded or failed.

Request:

id

Required. #integer

The model id
input

Required. #object

The JSON object serves as the input for the model. The structure of this input varies based on the specific model being utilized.
webhook

#string

An HTTPS URL for receiving a webhook when the prediction is completed. The request body as the retrieval API

Response:

generation_id

#string

The prediction id to re-use on the retrieval API

Get a prediction

GET https://apiforai.io/api/v1/prediction/{prediction_id}

This endpoint allows you to obtain the result of a previously performed prediction. It enables you to know the status of your prediction and to retrieve the output of your prediction.

Response

status

#string

Prediction's status. [starting, processing, failed, succeeded, cancelled]
output

#object

Object containing the output of the model. Any files will be represented as HTTPS URLs

Billing

Billing is only applied for successful API calls. Charges are automatically deducted from your account upon the successful execution of an API request. To view the prediction times and history of your API usage, please visit your Here section.

APIForAI

Build fast by accessing AI models easily