> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API

> API reference for AimlApi: every `aimlapi.api.*` operation with input and output types.

Every `aimlapi.api.*` operation is listed below with parameter shapes and return types from the plugin Zod schemas.

<Info>
  **New to Corsair?** See [API access](/concepts/api), [authentication](/concepts/auth), and [error handling](/concepts/error-handling).
</Info>

## Assistants

### create

`assistants.create`

Create a new AIMLAPI assistant.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.assistants.create({});
```

**Input**

| Name            | Type     | Required | Description |
| --------------- | -------- | -------- | ----------- |
| `model`         | `string` | Yes      | —           |
| `name`          | `string` | No       | —           |
| `description`   | `string` | No       | —           |
| `instructions`  | `string` | No       | —           |
| `tools`         | `any[]`  | No       | —           |
| `toolResources` | `object` | No       | —           |
| `metadata`      | `object` | No       | —           |
| `temperature`   | `number` | No       | —           |
| `topP`          | `number` | No       | —           |

<AccordionGroup>
  <Accordion title="toolResources full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>

  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### delete

`assistants.delete`

Delete an assistant.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.assistants.delete({});
```

**Input**

| Name          | Type     | Required | Description |
| ------------- | -------- | -------- | ----------- |
| `assistantId` | `string` | Yes      | —           |

**Output**

| Name      | Type      | Required | Description |
| --------- | --------- | -------- | ----------- |
| `id`      | `string`  | No       | —           |
| `object`  | `string`  | No       | —           |
| `deleted` | `boolean` | Yes      | —           |

***

### get

`assistants.get`

Retrieve an assistant by ID.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.assistants.get({});
```

**Input**

| Name          | Type     | Required | Description |
| ------------- | -------- | -------- | ----------- |
| `assistantId` | `string` | Yes      | —           |

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### list

`assistants.list`

List configured assistants.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.assistants.list({});
```

**Input**

| Name     | Type     | Required | Description |
| -------- | -------- | -------- | ----------- |
| `limit`  | `number` | No       | —           |
| `order`  | `string` | No       | —           |
| `before` | `string` | No       | —           |
| `after`  | `string` | No       | —           |

**Output**

| Name       | Type      | Required | Description |
| ---------- | --------- | -------- | ----------- |
| `object`   | `string`  | No       | —           |
| `data`     | `any[]`   | Yes      | —           |
| `has_more` | `boolean` | No       | —           |
| `first_id` | `string`  | No       | —           |
| `last_id`  | `string`  | No       | —           |

***

### update

`assistants.update`

Update an assistant definition.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.assistants.update({});
```

**Input**

| Name            | Type     | Required | Description |
| --------------- | -------- | -------- | ----------- |
| `assistantId`   | `string` | Yes      | —           |
| `model`         | `string` | No       | —           |
| `name`          | `string` | No       | —           |
| `description`   | `string` | No       | —           |
| `instructions`  | `string` | No       | —           |
| `tools`         | `any[]`  | No       | —           |
| `toolResources` | `object` | No       | —           |
| `metadata`      | `object` | No       | —           |
| `temperature`   | `number` | No       | —           |
| `topP`          | `number` | No       | —           |

<AccordionGroup>
  <Accordion title="toolResources full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>

  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Batches

### list

`batches.list`

List or retrieve batch processing status and results.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.batches.list({});
```

**Input**

| Name      | Type     | Required | Description |
| --------- | -------- | -------- | ----------- |
| `batchId` | `string` | Yes      | —           |

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Billing

### getBalance

`billing.getBalance`

Retrieve account billing balance.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.billing.getBalance({});
```

**Input:** *empty object*

**Output**

| Name              | Type     | Required | Description |
| ----------------- | -------- | -------- | ----------- |
| `current_balance` | `number` | No       | —           |
| `balance`         | `number` | No       | —           |
| `currency`        | `string` | No       | —           |

***

## Chat

### createCompletion

`chat.createCompletion`

Generate a chat completion using an AIMLAPI-compatible model.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.chat.createCompletion({});
```

**Input**

| Name               | Type                 | Required | Description |
| ------------------ | -------------------- | -------- | ----------- |
| `model`            | `string`             | Yes      | —           |
| `messages`         | `object[]`           | Yes      | —           |
| `maxTokens`        | `number`             | No       | —           |
| `temperature`      | `number`             | No       | —           |
| `topP`             | `number`             | No       | —           |
| `frequencyPenalty` | `number`             | No       | —           |
| `presencePenalty`  | `number`             | No       | —           |
| `stop`             | `string \| string[]` | No       | —           |
| `tools`            | `any[]`              | No       | —           |
| `toolChoice`       | `any`                | No       | —           |
| `responseFormat`   | `any`                | No       | —           |
| `seed`             | `number`             | No       | —           |
| `n`                | `number`             | No       | —           |

<AccordionGroup>
  <Accordion title="messages full type">
    ```ts theme={null}
    {
      role: string,
      content: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name      | Type       | Required | Description |
| --------- | ---------- | -------- | ----------- |
| `id`      | `string`   | No       | —           |
| `object`  | `string`   | No       | —           |
| `created` | `number`   | No       | —           |
| `model`   | `string`   | No       | —           |
| `choices` | `object[]` | Yes      | —           |
| `usage`   | `object`   | No       | —           |

<AccordionGroup>
  <Accordion title="choices full type">
    ```ts theme={null}
    {
      index?: number,
      message: {
        role: string,
        content: string
      },
      finish_reason?: string,
      finishReason?: string
    }[]
    ```
  </Accordion>

  <Accordion title="usage full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Luma

### getGeneration

`luma.getGeneration`

Retrieve a Luma video generation by ID.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.luma.getGeneration({});
```

**Input**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `generationId` | `string` | No       | —           |
| `ids`          | `string` | No       | —           |

**Output**

| Name     | Type     | Required | Description |
| -------- | -------- | -------- | ----------- |
| `id`     | `string` | Yes      | —           |
| `status` | `string` | Yes      | —           |
| `video`  | `any`    | No       | —           |
| `error`  | `any`    | No       | —           |
| `meta`   | `any`    | No       | —           |

***

## Messages

### create

`messages.create`

Create a message in a thread.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.messages.create({});
```

**Input**

| Name          | Type     | Required | Description |
| ------------- | -------- | -------- | ----------- |
| `threadId`    | `string` | Yes      | —           |
| `role`        | `string` | Yes      | —           |
| `content`     | `string` | Yes      | —           |
| `attachments` | `any[]`  | No       | —           |
| `metadata`    | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### delete

`messages.delete`

Delete a message.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.messages.delete({});
```

**Input**

| Name        | Type     | Required | Description |
| ----------- | -------- | -------- | ----------- |
| `threadId`  | `string` | Yes      | —           |
| `messageId` | `string` | Yes      | —           |

**Output**

| Name      | Type      | Required | Description |
| --------- | --------- | -------- | ----------- |
| `id`      | `string`  | No       | —           |
| `object`  | `string`  | No       | —           |
| `deleted` | `boolean` | Yes      | —           |

***

### get

`messages.get`

Retrieve a message by ID.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.messages.get({});
```

**Input**

| Name        | Type     | Required | Description |
| ----------- | -------- | -------- | ----------- |
| `threadId`  | `string` | Yes      | —           |
| `messageId` | `string` | Yes      | —           |

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### list

`messages.list`

List messages in a thread.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.messages.list({});
```

**Input**

| Name       | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `limit`    | `number` | No       | —           |
| `order`    | `string` | No       | —           |
| `before`   | `string` | No       | —           |
| `after`    | `string` | No       | —           |
| `threadId` | `string` | Yes      | —           |
| `runId`    | `string` | No       | —           |

**Output**

| Name       | Type      | Required | Description |
| ---------- | --------- | -------- | ----------- |
| `object`   | `string`  | No       | —           |
| `data`     | `any[]`   | Yes      | —           |
| `has_more` | `boolean` | No       | —           |
| `first_id` | `string`  | No       | —           |
| `last_id`  | `string`  | No       | —           |

***

### update

`messages.update`

Update a message.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.messages.update({});
```

**Input**

| Name        | Type     | Required | Description |
| ----------- | -------- | -------- | ----------- |
| `threadId`  | `string` | Yes      | —           |
| `messageId` | `string` | Yes      | —           |
| `metadata`  | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Models

### list

`models.list`

List models currently available to the AIMLAPI account.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.models.list({});
```

**Input:** *empty object*

**Output:** `object`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      type?: string,
      name?: string,
      provider?: string,
      info?: {
        name?: string,
        developer?: string,
        description?: string,
        contextLength?: number,
        maxTokens?: number,
        url?: string,
        docsUrl?: string,
        docs_url?: string,
        releasedAt?: string
      },
      features?: string[],
      endpoints?: string[],
      aliases?: string[],
      tags?: string[],
      metadata?: {
      }
    }[] | {
      object?: string,
      data: {
        id: string,
        type?: string,
        name?: string,
        provider?: string,
        info?: {
          name?: string,
          developer?: string,
          description?: string,
          contextLength?: number,
          maxTokens?: number,
          url?: string,
          docsUrl?: string,
          docs_url?: string,
          releasedAt?: string
        },
        features?: string[],
        endpoints?: string[],
        aliases?: string[],
        tags?: string[],
        metadata?: {
        }
      }[],
      has_more?: boolean,
      first_id?: string,
      last_id?: string
    }
    ```
  </Accordion>
</AccordionGroup>

***

### listWithDetails

`models.listWithDetails`

List models with pagination metadata and expanded details.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.models.listWithDetails({});
```

**Input**

| Name     | Type     | Required | Description |
| -------- | -------- | -------- | ----------- |
| `limit`  | `number` | No       | —           |
| `order`  | `string` | No       | —           |
| `before` | `string` | No       | —           |
| `after`  | `string` | No       | —           |
| `model`  | `string` | No       | —           |

**Output:** `object`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      type?: string,
      name?: string,
      provider?: string,
      info?: {
        name?: string,
        developer?: string,
        description?: string,
        contextLength?: number,
        maxTokens?: number,
        url?: string,
        docsUrl?: string,
        docs_url?: string,
        releasedAt?: string
      },
      features?: string[],
      endpoints?: string[],
      aliases?: string[],
      tags?: string[],
      metadata?: {
      }
    }[] | {
      object?: string,
      data: {
        id: string,
        type?: string,
        name?: string,
        provider?: string,
        info?: {
          name?: string,
          developer?: string,
          description?: string,
          contextLength?: number,
          maxTokens?: number,
          url?: string,
          docsUrl?: string,
          docs_url?: string,
          releasedAt?: string
        },
        features?: string[],
        endpoints?: string[],
        aliases?: string[],
        tags?: string[],
        metadata?: {
        }
      }[],
      has_more?: boolean,
      first_id?: string,
      last_id?: string
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Responses

### get

`responses.get`

Retrieve a response by ID.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.responses.get({});
```

**Input**

| Name                 | Type       | Required | Description |
| -------------------- | ---------- | -------- | ----------- |
| `responseId`         | `string`   | Yes      | —           |
| `include`            | `string[]` | No       | —           |
| `startingAfter`      | `number`   | No       | —           |
| `includeObfuscation` | `boolean`  | No       | —           |

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Runs

### cancel

`runs.cancel`

Cancel an in-progress run.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.runs.cancel({});
```

**Input**

| Name       | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `threadId` | `string` | Yes      | —           |
| `runId`    | `string` | Yes      | —           |

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### create

`runs.create`

Create a run for a thread and assistant.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.runs.create({});
```

**Input**

| Name                     | Type     | Required | Description |
| ------------------------ | -------- | -------- | ----------- |
| `threadId`               | `string` | Yes      | —           |
| `assistantId`            | `string` | Yes      | —           |
| `instructions`           | `string` | No       | —           |
| `additionalInstructions` | `string` | No       | —           |
| `tools`                  | `any[]`  | No       | —           |
| `metadata`               | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### get

`runs.get`

Retrieve a run by ID.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.runs.get({});
```

**Input**

| Name       | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `threadId` | `string` | Yes      | —           |
| `runId`    | `string` | Yes      | —           |

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### list

`runs.list`

List runs for a thread.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.runs.list({});
```

**Input**

| Name       | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `limit`    | `number` | No       | —           |
| `order`    | `string` | No       | —           |
| `before`   | `string` | No       | —           |
| `after`    | `string` | No       | —           |
| `threadId` | `string` | Yes      | —           |

**Output**

| Name       | Type      | Required | Description |
| ---------- | --------- | -------- | ----------- |
| `object`   | `string`  | No       | —           |
| `data`     | `any[]`   | Yes      | —           |
| `has_more` | `boolean` | No       | —           |
| `first_id` | `string`  | No       | —           |
| `last_id`  | `string`  | No       | —           |

***

### submitToolOutputs

`runs.submitToolOutputs`

Submit tool outputs for a run.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.runs.submitToolOutputs({});
```

**Input**

| Name          | Type     | Required | Description |
| ------------- | -------- | -------- | ----------- |
| `threadId`    | `string` | Yes      | —           |
| `runId`       | `string` | Yes      | —           |
| `toolOutputs` | `any[]`  | No       | —           |

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### update

`runs.update`

Update a run.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.runs.update({});
```

**Input**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `threadId`     | `string` | Yes      | —           |
| `runId`        | `string` | Yes      | —           |
| `instructions` | `string` | No       | —           |
| `metadata`     | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Run Steps

### get

`runSteps.get`

Retrieve a single run step.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.runSteps.get({});
```

**Input**

| Name       | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `threadId` | `string` | Yes      | —           |
| `runId`    | `string` | Yes      | —           |
| `stepId`   | `string` | Yes      | —           |

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### list

`runSteps.list`

List run steps for a run.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.runSteps.list({});
```

**Input**

| Name       | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `limit`    | `number` | No       | —           |
| `order`    | `string` | No       | —           |
| `before`   | `string` | No       | —           |
| `after`    | `string` | No       | —           |
| `threadId` | `string` | Yes      | —           |
| `runId`    | `string` | Yes      | —           |

**Output**

| Name       | Type      | Required | Description |
| ---------- | --------- | -------- | ----------- |
| `object`   | `string`  | No       | —           |
| `data`     | `any[]`   | Yes      | —           |
| `has_more` | `boolean` | No       | —           |
| `first_id` | `string`  | No       | —           |
| `last_id`  | `string`  | No       | —           |

***

## Threads

### create

`threads.create`

Create an AIMLAPI thread.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.threads.create({});
```

**Input**

| Name            | Type       | Required | Description |
| --------------- | ---------- | -------- | ----------- |
| `messages`      | `object[]` | No       | —           |
| `toolResources` | `object`   | No       | —           |
| `metadata`      | `object`   | No       | —           |

<AccordionGroup>
  <Accordion title="messages full type">
    ```ts theme={null}
    {
      role: string,
      content: string
    }[]
    ```
  </Accordion>

  <Accordion title="toolResources full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>

  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### delete

`threads.delete`

Delete a thread.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.threads.delete({});
```

**Input**

| Name       | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `threadId` | `string` | Yes      | —           |

**Output**

| Name      | Type      | Required | Description |
| --------- | --------- | -------- | ----------- |
| `id`      | `string`  | No       | —           |
| `object`  | `string`  | No       | —           |
| `deleted` | `boolean` | Yes      | —           |

***

### get

`threads.get`

Retrieve a thread by ID.

**Risk:** `read`

```ts theme={null}
await corsair.aimlapi.api.threads.get({});
```

**Input**

| Name       | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `threadId` | `string` | Yes      | —           |

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### update

`threads.update`

Update thread metadata or resources.

**Risk:** `write`

```ts theme={null}
await corsair.aimlapi.api.threads.update({});
```

**Input**

| Name            | Type     | Required | Description |
| --------------- | -------- | -------- | ----------- |
| `threadId`      | `string` | Yes      | —           |
| `toolResources` | `object` | No       | —           |
| `metadata`      | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="toolResources full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>

  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name         | Type     | Required | Description |
| ------------ | -------- | -------- | ----------- |
| `id`         | `string` | Yes      | —           |
| `object`     | `string` | No       | —           |
| `created`    | `number` | No       | —           |
| `created_at` | `number` | No       | —           |
| `status`     | `string` | No       | —           |
| `model`      | `string` | No       | —           |
| `metadata`   | `object` | No       | —           |

<AccordionGroup>
  <Accordion title="metadata full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***
