--- title: "Sliding window" slug: "clovastudio-sliding" updated: 2026-09-17T09:35:47Z published: 2026-09-17T09:35:47Z canonical: "api.ncloud-docs.com/clovastudio-sliding" --- > ## Documentation Index > Fetch the complete documentation index at: https://api.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # Sliding window Available in Classic and VPC Delete sentences that exceed the maximum number of tokens when using Chat completions API. The oldest conversation turns are deleted to free up tokens so that conversations can be created without interruption. Note For a detailed description of how the sliding window works and how to work with it, see [Utilize API](https://guide.ncloud-docs.com/docs/en/clovastudio-explorer03#%EC%8A%AC%EB%9D%BC%EC%9D%B4%EB%94%A9%EC%9C%88%EB%8F%84%EC%9A%B0API) of the CLOVA Studio user guide. ## Request This section describes the request format. The method and URI are as follows: | Method | URI | | --- | --- | | POST | /v1/api-tools/sliding/chat-messages/{modelName} | ### Request headers For information about the headers common to all CLOVA Studio APIs, see [CLOVA Studio request headers](/docs/en/ai-naver-clovastudio-summary#%EC%9A%94%EC%B2%AD%ED%97%A4%EB%8D%94). ### Request path parameters You can use the following path parameters with your request: | Field | Type | Required | Description | | --- | --- | --- | --- | | `modelName` | String | Required | Model name - HCX-003 | ### Request body You can include the following data in the body of your request: | Field | Type | Required | Description | | --- | --- | --- | --- | | `maxTokens` | Integer | Required | Maximum number of generated tokens - 0 < `maxTokens` ≤ 4096 (default: 100) | | `messages` | Array | Required | Conversation message list: [messages](/docs/en/clovastudio-sliding#messages1) - Need to be adjusted for maximum number of tokens | #### `messages` The following describes `messages`. | Field | Type | Required | Description | | --- | --- | --- | --- | | `role` | Enum | Required | Role of conversation messages - `system` \| `user` \| `assistant` - `system`: directives that define roles - `user`: user utterances/questions - `assistant`: answers to user utterances/questions | | `content` | String | Required | Content of conversation messages | Note When entering some fields, check the following. - `messages`: The sum of the number of tokens entered and the number of tokens entered in `maxTokens` can't exceed 4096 tokens. The number of tokens entered in `messages` can be checked by calling the Token calculation API. ### Request example The request example is as follows: ``` curl --location --request POST 'https://clovastudio.stream.ntruss.com/v1/api-tools/sliding/chat-messages/{modelName}' \ --header 'Authorization: Bearer {API Key}' \ --header 'X-NCP-CLOVASTUDIO-REQUEST-ID: {Request ID}' \ --header 'Content-Type: application/json' \ --data '{ "maxTokens" : 200, "messages" : [ { "role" : "user", "content" : "hello" } ] }' ``` ## Response This section describes the response format. ### Response body The following describes the body. | Field | Type | Required | Description | | --- | --- | --- | --- | | `status` | Object | - | See [Response status](/docs/en/ai-naver-clovastudio-summary#%EC%9D%91%EB%8B%B5). | | `result` | Object | - | Response result - Result of adjusting for the maximum number of tokens | | `result.messages` | Array | - | Conversation message list: [messages](/docs/en/clovastudio-sliding#messages2) | #### `messages` The following describes `messages`. | Field | Type | Required | Description | | --- | --- | --- | --- | | `role` | Enum | - | Role of conversation messages - `system` \| `user` \| `assistant` - `system`: directives that define roles - `user`: user utterances/questions - `assistant`: answers to user utterances/questions | | `content` | String | - | Content of conversation messages | ### Response example The response example is as follows: #### Succeeded The following is a sample response upon a successful call. ``` { "status": { "code": "20000", "message": "OK" }, "result": { "messages": [ { "role": "user", "content": "hello" } ] } } ``` #### Failure The following is a sample response upon a failed call. - [Common client error troubleshooting (4xx)](/docs/en/clovastudio-troubleshoot-c4xx) - [Common server error troubleshooting (5xx)](/docs/en/clovastudio-troubleshoot-c5xx)