---
title: 2. Connect the AI you use
description: Connect ChatGPT, Claude, Claude Code or Codex to Thegram, and set the permission that lets it write records to your storage.
url: https://docs.thegram.one/start/connect/
lang: en
tier: current
editorial_sources:
  - https://thegram.one/install/
  - https://thegram.one/install/agents.md
  - https://thegram.one/install/chatgpt.md
---

# 2. Connect the AI you use

<p class="tg-lede">In this chapter: connect one AI you already use to Thegram. ChatGPT and Claude take a few clicks. Claude Code and Codex need an API key and a few terminal commands.</p>

## Which AI do you use? {#choose}

| Your AI | How it connects | Where to look |
| --- | --- | --- |
| ChatGPT | Install the plugin and sign in with your Thegram account | [ChatGPT](#chatgpt) |
| Claude | Connect from the Claude Directory and sign in with your Thegram account | [Claude](#claude) |
| Claude Code | Create an API key and connect in the terminal | [Claude Code and Codex](#agents) |
| Codex | Create an API key and connect in the terminal | [Claude Code and Codex](#agents) |

Pick the same AI on the tabs in step 2 of the guide. If you use several, connect them one at a time. Step 2 is done as soon as one is connected.

## ChatGPT {#chatgpt}

1. In step 2 of the guide, choose the **ChatGPT** tab and select **Connect in ChatGPT**. The Thegram plugin page opens in ChatGPT.
2. In ChatGPT, select **Install plugin**.
3. When the Thegram sign-in screen appears, sign in with your Thegram account and approve the storage ChatGPT may use.
4. Return to the guide in Thegram. It confirms the connection on its own.

<figure class="tg-screen"><a href="/images/product/start/en-2-chatgpt.webp" target="_blank" rel="noopener"><img src="/images/product/start/en-2-chatgpt.webp" width="1362" height="734" alt="Step 2 of the guide with the ChatGPT tab chosen: three lines of guidance, the Connect in ChatGPT button and a Waiting for the connection status" loading="lazy" /></a><figcaption>The ChatGPT tab. Before it connects, the status reads "Waiting for the connection".</figcaption></figure>

## Claude {#claude}

1. In step 2 of the guide, choose the **Claude** tab and select **Open in Claude**. The Thegram page opens in the Claude Directory.
2. In Claude, select **Connect**.
3. Sign in with your Thegram account and approve the storage Claude may use.
4. Return to the guide in Thegram. It confirms the connection on its own.

<figure class="tg-screen"><a href="/images/product/start/en-2-claude.webp" target="_blank" rel="noopener"><img src="/images/product/start/en-2-claude.webp" width="1362" height="776" alt="Step 2 of the guide with the Claude tab chosen: three lines of guidance and the Open in Claude button" loading="lazy" /></a><figcaption>The Claude tab.</figcaption></figure>

If the Directory is not available on your Claude plan or in your organization, add a custom connector with this address under **Settings → Connectors** in Claude and sign in.

```text
https://vault.thegram.one/mcp
```

## Claude Code and Codex {#agents}

A coding agent connects with an **API key** instead of a sign-in. There are three parts: create the key, keep it on your computer and connect in the terminal.

### A. Create an API key {#key}

1. In step 2 of the guide, choose the **Claude Code** or **Codex** tab and select **Create API key**. Thegram moves to **Settings › AI permissions** and opens the key sheet straight away.
2. Enter a **Name**. A name that says where the key is used, such as "My laptop Claude Code", is easier to tell apart later.
3. Choose a **Lifetime**. It starts at 90 days.
4. Under **Access**, choose **Set separately**, select the storage that should receive records and change it to **Edit**. It starts at **Read**. With Read, your AI can look things up but cannot save.
5. Select **Create**.

<figure class="tg-screen tg-screen-narrow"><a href="/images/product/start/en-2-key-new.webp" target="_blank" rel="noopener"><img src="/images/product/start/en-2-key-new.webp" width="1020" height="1470" alt="The Create API key sheet: Name, Lifetime (30 days, 90 days, Choose a date, Never expires) and Access with Set separately chosen and Read, Edit and All for My first storage" loading="lazy" /></a><figcaption>Choose Edit on the right of the storage. Read is viewing, Edit is creating and changing, All includes deleting.</figcaption></figure>

6. On the "Key issued" sheet, select **Copy**. The key is shown only once, on this sheet.
7. Select **Back to the guide**.

<figure class="tg-screen tg-screen-narrow"><a href="/images/product/start/en-2-key-issued.webp" target="_blank" rel="noopener"><img src="/images/product/start/en-2-key-issued.webp" width="1020" height="1090" alt="The Key issued sheet: the key value with a Copy button, the name, requested access and lifetime, and the Done and Back to the guide buttons" loading="lazy" /></a><figcaption>The key is shown once. Copy it, then select Back to the guide.</figcaption></figure>

### B. Keep the key on your computer {#env}

Store the key you copied in an environment variable named `THEGRAM_API_KEY`. Do this yourself, in your own terminal. Do not paste the key into a conversation with an AI, type it after a command or commit it to a repository.

With the default macOS shell (zsh), add one line at the end of the `.zshrc` file in your home folder and open a new terminal.

```sh
export THEGRAM_API_KEY="paste the key here"
```

If you use a secret manager, you can store it there under the same name.

### C. Connect in the terminal {#commands}

The easiest way is to let the agent follow the canonical installation guide. Send this to Claude Code or Codex.

```text
Connect Thegram by following https://thegram.one/install/agents.md
```

To do it yourself, run the commands for your tool in the terminal.

Claude Code:

```sh
claude mcp remove --scope user thegram >/dev/null 2>&1 || true
claude mcp add --scope user --transport http thegram https://vault.thegram.one/mcp --header 'Authorization: Bearer ${THEGRAM_API_KEY}'
claude plugin marketplace add thegram-one/thegram-plugin || claude plugin marketplace update thegram-cloud
claude plugin install thegram-cloud@thegram-cloud
```

Codex:

```sh
codex mcp remove thegram >/dev/null 2>&1 || true
codex mcp add thegram --url https://vault.thegram.one/mcp --bearer-token-env-var THEGRAM_API_KEY
```

The commands pass the name `THEGRAM_API_KEY`, not the key itself, so the key never shows on screen or in a conversation. Codex needs the Thegram skill added separately. The [canonical installation guide](https://thegram.one/install/#coding-agents) explains how.

These commands match the canonical installation guide as of 26 November 2026. Commands can change, so check the [canonical installation guide](https://thegram.one/install/#coding-agents) before you run them. It also has the commands for OpenCode and OMP.

When you are done, start a **new session**. Installing does not change a session that is already running.

## Check that your AI can write to the storage {#access}

Connecting does not let your AI use every storage. A new storage starts with AI access set to **None**.

1. In Thegram, open **Settings › AI permissions**.
2. Select the AI you just connected, or the API key you created.
3. Check that the storage that should receive records is set to **Edit**, and change it if it is not.

With Read only, your AI can look things up but cannot save. The instructions in the next chapter have your AI write records into the storage, so it needs **Edit**.

## How you know it worked {#done}

- Step 2 of the guide shows **Done**, and the line under its title names the connected AI, for example "ChatGPT connected". If you connected with an API key, it reads "1 API keys created".
- In a new conversation or session, ask the question below. The answer names your storage.

```text
Show me the storages I can use in Thegram. Do not create or change anything.
```

## If you are stuck {#help}

- **You came back and it still says "Waiting for the connection".** Check that you finished both the sign-in and the approval on the AI's side. If you did, reload the guide.
- **Your AI says it cannot see the storage, or access was denied.** Go through [Check that your AI can write to the storage](#access) again.
- **The API key is rejected.** In **Settings › AI permissions**, check the key's lifetime and the storages it may reach. If you lost or revoked the key, create a new one. A key value cannot be shown again.
- **You use another AI, such as Grok or Muse.** Select **Connect another AI** at the bottom of step 2, or see the [canonical installation guide](https://thegram.one/install/).
- For anything else, see [When an AI won't connect](/help/connection/).

Next chapter: [3. Give your AI instructions](/start/instructions/)
