> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/ai/ai-chat.md).

# AI chat

Ask the AI about your project — the Hub chat for your team and the API chat for your end users.

**Where:** no Cloud screen in this release · Hub chat: `POST /v3/account/chat/turn` · API chat: `POST /v3/ai/chat/turn` and the Admin Portal

Norbix has two chats. Both run on your project's [LLM integrations](/codemash/cloud/ai/llm.md) and may call the tools of its [MCP integrations](/codemash/cloud/ai/mcp.md).

|                | Hub chat                                                                                           | API chat                                                                                                                                         |
| -------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Who            | you and your team (Norbix account users)                                                           | your end users (project users)                                                                                                                   |
| What it may do | structural work: schemas, integrations, templates, settings — only what your own permissions allow | only the signed-in user's **own** data (profile, own records); never structure, never another user's data                                        |
| Where          | the Hub (`/account/chat/…`); SDK `norbix.hub.account`                                              | the Api (`/ai/chat/…`); the Admin Portal chat; SDK `norbix.api.ai`                                                                               |
| Turned on by   | always on for signed-in team members                                                               | Project → Settings → **Admin Portal** → **Show AI chat**, with an assistant on [Project → Settings → AI](/codemash/cloud/project/settings/ai.md) |

{% hint style="warning" %}
Cloud has no screen for the AI chat yet: the chat drawer is switched off in this release, and Cloud shows a **Connect your AI** button instead, which connects your own AI tool (Claude, Cursor, ChatGPT, …) to Norbix — see [AI for developers](/codemash/ai/developers.md). Use the SDK, the CLI or the API below for the Hub chat, and the Admin Portal (or the SDK's `norbix.api.ai`) for the API chat.
{% endhint %}

## Before you start

* An enabled LLM integration on an OpenAI-compatible provider — OpenAI, Groq, Mistral, OpenRouter or Grok. Anthropic, Ollama and Google can be saved but cannot chat yet ([LLM providers](/codemash/cloud/ai/llm/providers.md)).
* A signed-in session or an AI service-user key in `NORBIX_API_KEY` ([Keys and environments](/codemash/get-started/keys-and-environments.md)).
* For the API chat: an assistant and the default LLM on [Project → Settings → AI](/codemash/cloud/project/settings/ai.md), and **Show AI chat** on.

## Steps

1. **Open the chat** — ask what is available. The answer lists the chat **profiles** (sets of tools, for example `assistant`, `database-inspector`, `ai-integrations-manager`) and the **models** the model picker offers: one row per enabled LLM integration, labelled with the integration name and model.
2. **Pick a model** — pass `llmIntegrationId` and `model` from that list. Without them the chat uses the project's [default LLM](/codemash/cloud/ai/llm/set-default.md).
3. **Ask** — send the question with a profile. The first question opens a session (`aics_…`); send its `sessionId` with the next questions to continue the same chat.
4. **Approve a plan** — for bigger jobs the assistant first answers with a numbered plan of tool steps; nothing runs until you decide it (`decideChatPlan` in the SDK, `norbix hub account chat plan decide` in the CLI). Steps that change data wait for your confirmation. The test model of our stack never proposes a plan, so this step was not run for this page.

## Result

The answer comes back as `reply`, and the session keeps every entry (`getChatSessionEntries`): your message (`user.message`), the answer (`assistant.text`), plans, steps and questions. Sessions are listed per project and environment (`getChatSessions`) and can be pinned, archived, shared or deleted.

## Change or remove it later

* Delete a session: `deleteChatSession` (`norbix hub account chat session delete`), or archive it with `setChatSessionArchived`.
* Forget what the chat remembers about you: `getChatMemory` / `forgetChatMemory`.
* Turn the end-user chat off: Project → Settings → **Admin Portal** → **Show AI chat** off.

## Do it from code

The client setup is on the [AI page](/codemash/cloud/ai.md#use-it-from-code).

```ts
const { models } = await norbix.hub.account.chatAvailability({ projectId, env: 'PROD' });
console.log(models.map((m) => `${m.label} · ${m.model}`)); // what the model picker offers

const turn = await norbix.hub.account.chatTurn({
  projectId,
  env: 'PROD',
  profile: 'assistant',
  llmIntegrationId: models[0].llmIntegrationId,
  model: models[0].model,
  message: 'Which modules are enabled in this project?',
});
console.log(turn.sessionId, turn.reply); // aics_… and the answer
```

```sh
norbix hub account turn chat --body '{"projectId":"pr_1EbxZuxAcCIW9tfBoDfGri","env":"PROD","profile":"assistant","llmIntegrationId":"int_44q3sq04tnjAzbPYAmFskM","model":"gpt-4o-mini","message":"Which modules are enabled in this project?"}'
```

The CLI line needs `--body`: a `--profile` flag is taken by the CLI's own profile option. A failed turn answers *Error while running chat turn* — the reason (for example the provider's *401 Unauthorized*) is only in the server log.

API: [Chat Turn](/codemash/api-reference/account/chat/chat-turn.md) · [Chat Availability](/codemash/api-reference/account/chat/chat-availability.md) · end-user chat: [Start End User Chat Turn](/codemash/api-reference/ai/chat/start-end-user-chat-turn.md) · [Get End User Chat Availability](/codemash/api-reference/ai/chat/get-end-user-chat-availability.md). The end-user side is described in [AI in your products](/codemash/ai/products.md).
