API requests quickstart
In this quickstart, you will learn how to call models and pipelines using API requests.+
Create an API Key
Create an API key on the Integrations page on Studio.
Models
1. Execute a Model (POST Request)
curl -X POST 'https://models.aixplain.com/api/v1/execute/<model_id>' \
-H 'x-api-key: TEAM_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"data": "Your input data"}'
Show response
- Replace
TEAM_API_KEY
with your actual API key. - The
-d
option sends the input data to the model. If the model accepts multiple inputs, then provide them as a dictionary. For example, to providetext
andmax_tokens
to an LLM use-d '{"text": "Your input text", "max_tokens": 500}'
.
2. Retrieve the Result (GET Request)
curl -X GET 'https://models.aixplain.com/api/v1/data/<requestId>' \
-H 'x-api-key: TEAM_API_KEY' \
-H 'Content-Type: application/json'
Show response
Pipelines
1. Execute a Pipeline (POST Request)
curl -X POST 'https://platform-api.aixplain.com/assets/pipeline/execution/run/<pipeline_id>' \
-H 'x-api-key: TEAM_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"data": "Your input data"}'
Show response
2. Retrieve the Result (GET Request)
curl -X GET 'https://models.aixplain.com/api/v1/data/<requestId>' \
-H 'x-api-key: TEAM_API_KEY' \
-H 'Content-Type: application/json'
Show response
Convert Curl Commands to Any Language
You can use a Curl converter tool to convert Curl commands into the programming language of your choice. Simply enter your Curl command in the tool, select your desired language, and copy the generated code.