Assistant API

Assistants are AI-driven entities with assigned roles and instructions, allowing them to process messages, use tools, and maintain context within threads for structured and interactive responses. One Assistant can be used across multiple Threads and users.

This page provides API schemas for the following methods:

https://api.aimlapi.com/assistants

https://api.aimlapi.com/assistants/{assistantId}

https://api.aimlapi.com/assistants/{assistantId}

https://api.aimlapi.com/assistants/{assistantId}

After each API schema, you'll find a short example demonstrating how to correctly call the described method in code using the OpenAI SDK.

API Schemas

Create an Assistant

Create an Assistant with a model and instructions.

post
Authorizations
AuthorizationstringRequired

Bearer key

Body
modelstring · enumRequiredPossible values:
descriptionstring | nullableOptional

The description of the Assistant. The maximum length is 512 characters.

instructionsstring | nullableOptional

The system instructions that the Assistant uses. The maximum length is 256,000 characters. Instructions can indeed be very large and complex, including full action frameworks, example messages, response formatting guidelines, topic restrictions, and stylistic rules.

namestring | nullableOptional

The name of the Assistant. The maximum length is 256 characters.

reasoning_effortstring · enum | nullableOptional

Constrains effort on reasoning for reasoning models.

Possible values:
response_formatany ofOptional

Specifies the format that the model must output.

string · enumOptionalPossible values:
or
anyOptional
or
or
or
any | nullableOptional
temperaturenumber | nullableOptional

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

top_pnumber | nullableOptional

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

Responses
post
/assistants
default

Python + OpenAI SDK Example:


Retrieve a list of Assistants along with their parameters

get
Authorizations
AuthorizationstringRequired

Bearer key

Query parameters
limitintegerOptional

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

orderstringOptional

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

beforestringOptional

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

afterstringOptional

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

Responses
get
/assistants
default

Python + OpenAI SDK Example:


Retrieve information about a specific Assistant by its ID

get
Authorizations
AuthorizationstringRequired

Bearer key

Path parameters
assistantIdstringRequired
Responses
get
/assistants/{assistantId}
default

Python + OpenAI SDK Example:


Modify a specific Assistant by its ID

post
Authorizations
AuthorizationstringRequired

Bearer key

Path parameters
assistantIdstringRequired
Body
anyOptional
Responses
post
/assistants/{assistantId}
default

Python + OpenAI SDK Example:


Delete a specific Assistant by its ID

delete
Authorizations
AuthorizationstringRequired

Bearer key

Path parameters
assistantIdstringRequired
Responses
delete
/assistants/{assistantId}
default

Python + OpenAI SDK Example:

Last updated

Was this helpful?