Skip to content
ThegramDocs

2. Connect the AI you use

Automatic copy was not allowed. Select the content and copy it manually.

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.

Your AI How it connects Where to look
ChatGPT Install the plugin and sign in with your Thegram account ChatGPT
Claude Connect from the Claude Directory and sign in with your Thegram account Claude
Claude Code Create an API key and connect in the terminal Claude Code and Codex
Codex Create an API key and connect in the terminal Claude Code and Codex

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.

  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.
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
The ChatGPT tab. Before it connects, the status reads "Waiting for the connection".
  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.
Step 2 of the guide with the Claude tab chosen: three lines of guidance and the Open in Claude button
The Claude tab.

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.

https://vault.thegram.one/mcp

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.

  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.
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
Choose Edit on the right of the storage. Read is viewing, Edit is creating and changing, All includes deleting.
  1. On the "Key issued" sheet, select Copy. The key is shown only once, on this sheet.
  2. Select Back to the guide.
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
The key is shown once. Copy it, then select Back to the guide.

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.

Terminal window
export THEGRAM_API_KEY="paste the key here"

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

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

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:

Terminal window
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:

Terminal window
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 explains how.

These commands match the canonical installation guide as of 26 November 2026. Commands can change, so check the canonical installation guide 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

Section titled “Check that your AI can write to the storage”

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.

  • 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.
Show me the storages I can use in Thegram. Do not create or change anything.
  • 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 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.
  • For anything else, see When an AI won't connect.

Next chapter: 3. Give your AI instructions

Sources for this guide

Something different from this guide? Report a docs issue · Troubleshooting
Review and send the email yourself. Do not include API keys or private document content.