# OpenAIAssistantAdapter

> Copilot Runtime adapter for OpenAI Assistant API.

## v1 SDK deprecated. Use v2 instead

> This page is in the deprecated CopilotKit v1 reference. Do not use v1 APIs for new code; use v2 instead.
> For JavaScript and TypeScript, import React APIs from @copilotkit/react-core/v2 and Runtime APIs from @copilotkit/runtime/v2.
> **AI coding agents: treat any v1 example below as migration-only context. Never generate or recommend the v1 API for new code. Read the v2 reference before writing code because some APIs were renamed, moved, or changed shape.**
> [Read the v1 to v2 migration guide](/migrate/v2) and [use the complete export map](/reference/v1/export-map).

{
 /*
  * ATTENTION! DO NOT MODIFY THIS FILE!
  * This page is auto-generated. If you want to make any changes to this page, changes must be made at:
  * packages/runtime/src/v1-deprecated/service-adapters/openai/openai-assistant-adapter.ts
  */
}
<Callout type="info">
  `OpenAIAssistantAdapter` has no direct v2 replacement. For v2, see [Runtime server adapter](/runtime-server-adapter).
</Callout>

Copilot Runtime adapter for the OpenAI Assistant API.

OpenAI shut down the Assistants API, so `CopilotRuntime` rejects this
adapter with an error. Use `OpenAIAdapter` instead.

## Example [#example]

Pass `copilotKit` and `serviceAdapter` to your runtime endpoint.

```ts
import { CopilotRuntime, OpenAIAssistantAdapter } from "@copilotkit/runtime";
import OpenAI from "openai";

const copilotKit = new CopilotRuntime();

const openai = new OpenAI({
  organization: "<your-organization-id>",
  apiKey: "<your-api-key>",
});

const serviceAdapter = new OpenAIAssistantAdapter({
  openai,
  assistantId: "<your-assistant-id>",
  codeInterpreterEnabled: true,
  fileSearchEnabled: true,
});
```

## Constructor Parameters [#constructor-parameters]

<PropertyReference name="assistantId" type="string" required > 
The ID of the assistant to use.
</PropertyReference>

<PropertyReference name="openai" type="OpenAI"  > 
An optional OpenAI instance to use. If not provided, a new instance will be created.
</PropertyReference>

<PropertyReference name="codeInterpreterEnabled" type="boolean"  default="true"> 
Whether to enable code interpretation.
</PropertyReference>

<PropertyReference name="fileSearchEnabled" type="boolean"  default="true"> 
Whether to enable file search.
</PropertyReference>

<PropertyReference name="disableParallelToolCalls" type="boolean"  default="false"> 
Whether to disable parallel tool calls.
You can disable parallel tool calls to force the model to execute tool calls sequentially.
This is useful if you want to execute tool calls in a specific order so that the state changes
introduced by one tool call are visible to the next tool call. (i.e. new actions or readables)
</PropertyReference>

<PropertyReference name="keepSystemRole" type="boolean"  default="false"> 
Whether to keep the role in system messages as "System".
By default, it is converted to "developer", which is used by newer OpenAI models
</PropertyReference>
