Set an app's OpenAI key
cometchat_set_openai_keySaves the OpenAI API key the app's AI features use, replacing any existing key. Only use a key the user gave you; it is never returned.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"app_id": "<app_id>",
"openai_key": "<openai_key>"
},
"name": "cometchat_set_openai_key"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | The CometChat App ID (from cometchat_list_apps). | |
| confirm | No | Set true only after the user has explicitly agreed to this change. On a local connection that is enough; on the hosted server this change needs approval_code from the user's browser instead, and confirm is ignored. | |
| openai_key | Yes | OpenAI API key, starting with sk- | |
| approval_code | No | The code the user got after approving this exact change in their browser. Only ever from the user; never make one up or reuse one for different arguments. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | App ID | |
| openai_key_set | Yes | Always true when the call succeeds |