Skip to content

Commit fdda8bf

Browse files
committed
Clarify Default Chat API Key creation for existing instances
- Specify that Default Chat API Key is only auto-created for fresh instances - Add note for users with existing instances - Include curl example for manually creating a chat API key - Document chatCompletions action in API keys reference This addresses the issue where users with existing Meilisearch instances need to manually create their chat API key since the default one is only created for fresh instances.
1 parent 4375cf3 commit fdda8bf

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

learn/chat/getting_started_with_chat.mdx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,40 @@ curl \
3030

3131
## Find your chat API key
3232

33-
When Meilisearch runs with a master key, it automatically creates a "Default Chat API Key" with `chatCompletions` permission. Find it using:
33+
When Meilisearch runs with a master key on a **fresh instance**, it automatically creates a "Default Chat API Key" with `chatCompletions` permission.
34+
35+
<Note>
36+
The Default Chat API Key is only created automatically for new Meilisearch instances. If you have an existing instance, you'll need to create your own API key with `chatCompletions` permission.
37+
</Note>
38+
39+
Find existing keys using:
3440

3541
```bash
3642
curl http://localhost:7700/keys \
3743
-H "Authorization: Bearer MEILISEARCH_KEY"
3844
```
3945

40-
Look for the key with "Default Chat API Key" in the description. Use this key when queryin the `/chats` endpoint.
46+
Look for the key with "Default Chat API Key" in the description. Use this key when querying the `/chats` endpoint.
47+
48+
### Creating a chat API key for existing instances
49+
50+
If you have an existing Meilisearch instance and don't see a Default Chat API Key, create one manually:
51+
52+
```bash
53+
curl \
54+
-X POST 'http://localhost:7700/keys' \
55+
-H 'Authorization: Bearer MEILISEARCH_KEY' \
56+
-H 'Content-Type: application/json' \
57+
--data-binary '{
58+
"name": "Chat API Key",
59+
"description": "API key for chat completions",
60+
"actions": ["search", "chatCompletions"],
61+
"indexes": ["*"],
62+
"expiresAt": null
63+
}'
64+
```
65+
66+
This creates an API key with both `search` and `chatCompletions` permissions, which are required for the chat feature.
4167

4268
## Configure your indexes for chat
4369

reference/api/keys.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ For security reasons, we do not recommend creating keys that can perform all act
110110
| **`keys.delete`** | Provides access to the [delete key](#delete-a-key) endpoint |
111111
| **`network.get`** | Provides access to the [get the network object](/reference/api/network#get-the-network-object) endpoint |
112112
| **`network.update`** | Provides access to the [update the network object](/reference/api/network#update-the-network-object) endpoint |
113+
| **`chatCompletions`** | Provides access to the [chat completions endpoints](/reference/api/chats). Requires experimental feature to be enabled. Usually paired with `search` action |
113114

114115
### `indexes`
115116

0 commit comments

Comments
 (0)