> ISPO SDK documentation. [HTML](https://ispo.ai/docs/interfaces/core.ChatsApi.html) · [Documentation index](https://ispo.ai/docs/llms.txt)

# Interface ChatsApi

```typescript
interface ChatsApi {
    agents: ChatAgentsApi;
    compose(prompt: string): void;
    create(input?: ChatCompanionCreateArgs): Promise<ChatCompanionCreateResult>;
    list(): Promise<ChatCompanionListResult>;
    onSelectionChange(handler: ChatSelectionHandler): () => void;
    open(input: ChatCompanionOpenArgs): Promise<void>;
    subscribe(subscriber: ChatListSubscriber): ChatSubscriptionClose;
}
```

Types: [agents](#agents), [ChatAgentsApi](core.ChatAgentsApi.md), [compose](#compose-1), [create](#create-1), [ChatCompanionCreateArgs](core.ChatCompanionCreateArgs.md), [ChatCompanionCreateResult](core.ChatCompanionCreateResult.md), [list](#list-1), [ChatCompanionListResult](../types/core.ChatCompanionListResult.md), [onSelectionChange](#onselectionchange-1), [ChatSelectionHandler](../types/core.ChatSelectionHandler.md), [open](#open-1), [ChatCompanionOpenArgs](core.ChatCompanionOpenArgs.md), [subscribe](#subscribe-1), [ChatListSubscriber](../types/core.ChatListSubscriber.md), [ChatSubscriptionClose](../types/core.ChatSubscriptionClose.md)

##### Index

### <a id="properties"></a>Properties

[agents](#agents)

### <a id="methods"></a>Methods

[compose](#compose) [create](#create) [list](#list) [onSelectionChange](#onselectionchange) [open](#open) [subscribe](#subscribe)

## <a id="properties-1"></a>Properties

### <a id="agents"></a>agents

```typescript
agents: ChatAgentsApi
```

Types: [ChatAgentsApi](core.ChatAgentsApi.md)

## <a id="methods-1"></a>Methods

### <a id="compose"></a>compose

*   <a id="compose-1"></a>
    
    ```typescript
    compose(prompt: string): void
    ```
    
    #### Parameters
    
    *   prompt: string
    
    #### Returns void
    

### <a id="create"></a>create

*   <a id="create-1"></a>
    
    ```typescript
    create(input?: ChatCompanionCreateArgs): Promise<ChatCompanionCreateResult>
    ```
    
    Types: [ChatCompanionCreateArgs](core.ChatCompanionCreateArgs.md), [ChatCompanionCreateResult](core.ChatCompanionCreateResult.md)
    
    #### Parameters
    
    *   `Optional`input: [ChatCompanionCreateArgs](core.ChatCompanionCreateArgs.md)
    
    #### Returns Promise<[ChatCompanionCreateResult](core.ChatCompanionCreateResult.md)\>
    

**Authority for `chats.create`**

Reviewed request token: `ui.chat-companion`. Authority depends on the arguments, resource, and caller; check the live capability surface.

Handle structured `ProjectRpcError` failures. A timeout does not guarantee cancellation; do not automatically retry effects without a documented idempotency contract. [Method authority and recovery](/docs/documents/Method_authority.md).

### <a id="list"></a>list

*   <a id="list-1"></a>
    
    ```typescript
    list(): Promise<ChatCompanionListResult>
    ```
    
    Types: [ChatCompanionListResult](../types/core.ChatCompanionListResult.md)
    
    #### Returns Promise<[ChatCompanionListResult](../types/core.ChatCompanionListResult.md)\>
    

**Authority for `chats.list`**

Reviewed request token: `ui.chat-companion`. Authority depends on the arguments, resource, and caller; check the live capability surface.

Handle structured `ProjectRpcError` failures. A timeout does not guarantee cancellation; do not automatically retry effects without a documented idempotency contract. [Method authority and recovery](/docs/documents/Method_authority.md).

### <a id="onselectionchange"></a>onSelectionChange

*   <a id="onselectionchange-1"></a>
    
    ```typescript
    onSelectionChange(handler: ChatSelectionHandler): () => void
    ```
    
    Types: [ChatSelectionHandler](../types/core.ChatSelectionHandler.md)
    
    #### Parameters
    
    *   handler: [ChatSelectionHandler](../types/core.ChatSelectionHandler.md)
    
    #### Returns () \=> void
    

### <a id="open"></a>open

*   <a id="open-1"></a>
    
    ```typescript
    open(input: ChatCompanionOpenArgs): Promise<void>
    ```
    
    Types: [ChatCompanionOpenArgs](core.ChatCompanionOpenArgs.md)
    
    #### Parameters
    
    *   input: [ChatCompanionOpenArgs](core.ChatCompanionOpenArgs.md)
    
    #### Returns Promise<void\>
    

**Authority for `chats.open`**

Reviewed request token: `ui.chat-companion`. Authority depends on the arguments, resource, and caller; check the live capability surface.

Handle structured `ProjectRpcError` failures. A timeout does not guarantee cancellation; do not automatically retry effects without a documented idempotency contract. [Method authority and recovery](/docs/documents/Method_authority.md).

### <a id="subscribe"></a>subscribe

*   <a id="subscribe-1"></a>
    
    ```typescript
    subscribe(subscriber: ChatListSubscriber): ChatSubscriptionClose
    ```
    
    Types: [ChatListSubscriber](../types/core.ChatListSubscriber.md), [ChatSubscriptionClose](../types/core.ChatSubscriptionClose.md)
    
    #### Parameters
    
    *   subscriber: [ChatListSubscriber](../types/core.ChatListSubscriber.md)
    
    #### Returns [ChatSubscriptionClose](../types/core.ChatSubscriptionClose.md)
