update: Readme

This commit is contained in:
Dhravya Shah 2025-09-13 22:09:40 -07:00
parent a17655460f
commit 90fd19f215
60 changed files with 41 additions and 3986 deletions

View file

@ -1,84 +0,0 @@
---
description:
globs:
alwaysApply: true
---
# Documentation MDX Format
All documentation files use MDX format with a specific structure:
## Frontmatter
Every documentation file must begin with frontmatter:
```mdx
---
title: "Page Title"
description: "Brief description of the page content"
icon: "icon-name" # Optional, uses Lucide icons
sidebarTitle: "Optional Sidebar Title" # Optional
---
```
Example: @features/query-rewriting.mdx
## Components
Use the following components to enhance documentation:
### Accordion
For collapsible sections:
```mdx
<Accordion title="Section Title" defaultOpen icon="sparkles">
Content goes here...
</Accordion>
```
Example: @creation/supported-types.mdx
### Notes and Warnings
For important information:
```mdx
<Note>
Important information goes here.
</Note>
<Warning>
Critical warning goes here.
</Warning>
```
Example: @creation/adding-memories.mdx
### Code Examples
For multi-language code examples:
```mdx
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/endpoint \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY'
```
```typescript Typescript
await client.method({
parameter: "value"
})
```
```python Python
client.method(
parameter="value"
)
```
</CodeGroup>
```
Example: @essentials/authentication.mdx

View file

@ -1 +0,0 @@
# supermemory Docs

View file

@ -1,57 +0,0 @@
---
title: "Product Updates"
description: "New updates and improvements"
mode: "center"
---
<Update label="2025-04-30" description="Major Platform Updates">
- **Enhanced Documentation:** Comprehensive API references with detailed examples
- **Developer Platform Improvements:** Fully revamped developer experience
- **Reliability:** Significantly reduced error rates
- **Categories Support:** New categorization system for better content organization
- **Custom Document Cleaning:** Advanced controls for document processing
- **Auto Content Type Detection:** Improved content handling across formats
</Update>
<Update label="2025-04-28" description="Google Drive Provider Added">
- **Google Drive Provider:** Added support for Google Drive provider.
</Update>
<Update label="2025-04-27" description="More Improvements">
- **Optional summaries in search:** Choose to include document summaries in your search results.
- **Better document ranking:** Document similarity scoring is now more accurate.
</Update>
<Update label="2025-04-25" description="Recent Improvements">
- **Improved scoring:** Our scoring was previously too low for every document due to fused ranking methods. This is now much better, and you'll see a better distribution of rankings.
- **Chunk and Document thresholds:** You can now set your own thresholds in the search body for more control.
- **Smaller chunk sizes:** Chunk sizes are now more sensible and generally smaller.
- **onlyMatchingChunks works as expected:** This now removes all context chunks with a score of 0 (previously added for chatbot context). Let us know if you notice any issues!
- **Intra-document chunk querying:** You can now query within the chunks of a single document for more focused results.
</Update>
<Update label="2025-04-24" description="Query Rewriting & User Profiling">
- **Query rewriting:** We now rewrite queries for better search results and intent matching.
- **User profiling:** Personalized search results based on user profiles.
</Update>
<Update label="2025-04-18" description="Ingestion Pipeline Revamp">
- **Completely revamped ingestion pipeline:** Now works perfectly for images, videos, and PDFs—even if the links dont end with .pdf or image extensions. We automatically fetch and parse the content!
- **Website ingestion:** Website links are now much more stable and reliable.
</Update>
<Update label="2025-04-14" description="Weekend Launches">
- **Teams in dashboard:** Invite team members with permission control!
- **Advanced analytics:** Better analytics and observability.
- **Faster ingestion and search:** Even faster search experience.
- **Higher reliability for website URL ingestion.**
- **supermemory MCP!**
- **Unreleased v1 landing page!**
</Update>
<Update label="2025-02-01" description="v0.1.1">
- You can now search for memories in multiple spaces at once.
- All endpoints have been updated to `/v1` for better versioning
- Improved documentation and examples
- Interactive [API Playground](https://supermemory.ai/docs/api-reference)
</Update>

View file

@ -1,243 +0,0 @@
---
title: 'Self Hosting'
description: 'Deploy your own instance of the supermemory API on Cloudflare Workers'
---
<Warning>
This guide is intended for **enterprise customers only** who have specifically opted for self-hosting as part of their enterprise plan. If you're on a standard plan, please use our hosted API at [console.supermemory.ai](https://console.supermemory.ai).
</Warning>
## Prerequisites
Before you start, you'll need to gather several API keys and set up accounts with various services. This comprehensive guide will walk you through obtaining each required component.
### Enterprise Deployment Package
Your enterprise deployment package is provided by the supermemory team and contains:
- Your unique Host ID (`NEXT_PUBLIC_HOST_ID`)
- The compiled JavaScript bundle
- The deployment script
Contact your supermemory enterprise representative to receive your deployment package.
### Cloudflare
#### Create Account
1. Go to [cloudflare.com](https://dash.cloudflare.com/sign-up) and create an account
3. Your **Account ID** is the long randon string in the URL bar
#### Create API Token
1. Navigate to [Cloudflare API Tokens](https://dash.cloudflare.com/?to=/:account/api-tokens)
2. Click **"Create Token"**
3. Use the **"Custom token"** template
4. Configure the token with these permissions:
- **Account:AI Gateway:Edit**
- **Account:Hyperdrive:Edit**
- **Account:Workers KV Storage:Edit**
- **Account:Workers R2 Storage:Edit**
7. Click **"Continue to summary"** → **"Create Token"**
8. **Important**: Copy and securely store the token immediately (it won't be shown again)
#### Enable Workers
1. In your Cloudflare dashboard, go to **Workers & Pages**
2. If prompted, accept the Workers terms of service
3. Choose a subdomain for your workers (e.g., `yourcompany.workers.dev`)
Your `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` are now ready.
### Database
You'll need to provide a PostgreSQL connection string via the `DATABASE_URL` environment variable.
The database must:
- Support the **pgvector extension** for vector operations
- Be accessible from Cloudflare Workers
- Support SSL connections
- Allow connections from Cloudflare's IP ranges
Your connection string should follow this format:
```
postgresql://username:password@hostname:port/database
```
### LLM Providers
#### OpenAI
1. Go to [platform.openai.com](https://platform.openai.com)
2. Sign in or create an account
3. Navigate to **API Keys** in the left sidebar
4. Click **"Create new secret key"**
5. Name your key (e.g., "supermemory Self-Hosted")
6. Copy the key and store it securely
7. Add billing information if you haven't already
#### Anthropic
1. Go to [console.anthropic.com](https://console.anthropic.com)
2. Create an account and complete verification
3. Navigate to **API Keys**
4. Click **"Create Key"**
5. Name your key and copy it securely
#### Gemini
1. Go to [Google AI Studio](https://aistudio.google.com)
2. Sign in with your Google account
3. Click **"Get API key"** → **"Create API key"**
4. Choose an existing Google Cloud project or create a new one
5. Copy your API key
#### Groq
1. Go to [console.groq.com](https://console.groq.com)
2. Sign up for an account
3. Navigate to **API Keys**
4. Click **"Create API Key"**
5. Name your key and copy it
{/* TODO: Add OAuth documentation */}
{/* ### Authentication Providers
#### GitHub OAuth (Optional)
1. Go to [GitHub Developer Settings](https://github.com/settings/developers)
2. Click **"New OAuth App"**
3. Fill in the application details:
- **Application name**: Your app name
- **Homepage URL**: Your API domain (e.g., `https://api.yourdomain.com`)
- **Authorization callback URL**: `https://api.yourdomain.com/api/auth/callback/github`
4. Click **"Register application"**
5. Note the **Client ID** and generate a **Client Secret**
6. Use these for `AUTH_GITHUB_ID` and `AUTH_GITHUB_SECRET`
#### Google OAuth (Optional)
1. Go to [Google Cloud Console](https://console.cloud.google.com)
2. Create a new project or select an existing one
3. Enable the **Google+ API**
4. Go to **Credentials** → **Create Credentials** → **OAuth client ID**
5. Choose **Web application**
6. Add your domain to **Authorized JavaScript origins**
7. Add `https://api.yourdomain.com/api/auth/callback/google` to **Authorized redirect URIs**
8. Copy the **Client ID** and **Client secret**
9. Use these for `AUTH_GOOGLE_ID` and `AUTH_GOOGLE_SECRET` */}
### Email Service Setup
#### Resend
1. Go to [resend.com](https://resend.com) and create an account
2. Navigate to **API Keys**
3. Click **"Create API Key"**
4. Name your key (e.g., "supermemory Production")
5. Copy the key for `RESEND_API_KEY`
6. Verify your sending domain in the **Domains** section
### Connectors (Optional)
#### Google Drive
1. Go to [Google Cloud Console](https://console.cloud.google.com)
2. Create or select a project
3. Enable the **Google Drive API**
4. Go to **Credentials** → **Create Credentials** → **OAuth client ID**
5. Configure the OAuth consent screen if required
6. Choose **Web application**
7. Add authorized redirect URIs for your domain
8. Copy `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`
#### Microsoft OneDrive
1. Go to [Azure Portal](https://portal.azure.com)
2. Navigate to **Microsoft Entra ID** → **App registrations**
3. Click **"New registration"**
4. Name your app and set redirect URI
5. Go to **Certificates & secrets** → **New client secret**
6. Copy the **Application (client) ID** and **Client secret**
7. Use for `MICROSOFT_CLIENT_ID` and `MICROSOFT_CLIENT_SECRET`
#### Notion
1. Go to [Notion Developers](https://developers.notion.com)
2. Click **"Create new integration"**
3. Fill in the integration details
4. Copy the **Internal Integration Token**
5. Set up OAuth if needed for user connections
6. Use for `NOTION_CLIENT_ID` and `NOTION_CLIENT_SECRET`
---
## Setup deployment files
Extract the deployment package provided by the supermemory team to your preferred directory:
```bash
# Extract the deployment package
$ unzip supermemory-enterprise-deployment.zip
$ cd supermemory-deployment
```
---
## Configure environment variables
The deployment script reads **all** environment variables from your shell at runtime. We ship an example file that lists the full set supported by the worker.
```bash
# Copy the template and start editing
$ cp packages/alchemy/env.example .env
# Open the file in your editor of choice and fill in the blanks
$ $EDITOR .env
```
Below is a quick reference.
**Required** values are mandatory for a successful deploy leave optional ones empty if you don't need the related feature.
| Name | Required? | Description |
|------|-----------|-------------|
| `NODE_ENV` | ✅ | `development`, `staging` or `production`. |
| `NEXT_PUBLIC_HOST_ID` | ✅ | Your unique Host ID provided by the supermemory team. |
| `BETTER_AUTH_SECRET` | ✅ | Random 32-byte string run `openssl rand -base64 32`. |
| `BETTER_AUTH_URL` | ✅ | Public base URL for the API (no trailing `/`). Example: `https://api.example.com`. |
| `DATABASE_URL` | ✅ | Postgres connection string (e.g. `postgres://user:pass@host:5432/db`). |
| `CLOUDFLARE_ACCOUNT_ID` | ✅ | Your Cloudflare account ID. |
| `CLOUDFLARE_API_TOKEN` | ✅ | Token created in *Prerequisites*. |
| `OPENAI_API_KEY` | ✅ | Key from [platform.openai.com](https://platform.openai.com). |
| `RESEND_API_KEY` | ✅ | E-mail provider key if you plan to send e-mails. |
| `ANTHROPIC_API_KEY` | | Needed to use Claude models. |
| `GEMINI_API_KEY` | | Key for Google Gemini models. |
| `GROQ_API_KEY` | | Key for Groq models. |
| `AUTH_GITHUB_ID` / `AUTH_GITHUB_SECRET` | | Enable GitHub OAuth login. |
| `AUTH_GOOGLE_ID` / `AUTH_GOOGLE_SECRET` | | Enable Google OAuth login. |
| `GOOGLE_CLIENT_ID` / `GOOGLE_CLIENT_SECRET` | | Needed for Google Drive connector. |
| `MICROSOFT_CLIENT_ID` / `MICROSOFT_CLIENT_SECRET` | | Needed for OneDrive connector. |
| `NOTION_CLIENT_ID` / `NOTION_CLIENT_SECRET` | | Needed for Notion connector. |
| `CLOUDFLARE_AI_GATEWAY_NAME` / `CLOUDFLARE_AI_GATEWAY_TOKEN` | | Only if you want to route requests through an AI Gateway. |
| `SENTRY_DSN` | | If you use Sentry for error reporting. |
---
## Deploy
With your `.env` in place, run the deployment script:
```bash
# Run the deployment script provided in your package
$ bun ./deploy.ts
```
---
## Updating Your Deployment
To update your supermemory deployment, follow the same process as the initial deployment described in the **Deploy** section above. You can reuse your existing `.env` file and add/remove any new environment variables as needed.
---

View file

@ -1,180 +0,0 @@
{
"$schema": "https://mintlify.com/docs.json",
"api": {
"examples": {
"defaults": "required",
"languages": ["javascript", "python", "curl"]
},
"openapi": "https://localhost:8787/v3/openapi"
},
"colors": {
"dark": "#1E3A8A",
"light": "#3B82F6",
"primary": "#1E3A8A"
},
"contextual": {
"options": ["copy", "view", "chatgpt", "claude"]
},
"favicon": "/favicon.png",
"fonts": {
"body": {
"family": "Space Grotesk",
"format": "woff2"
},
"heading": {
"family": "Space Grotesk",
"format": "woff2"
}
},
"footer": {
"socials": {
"github": "https://github.com/supermemoryai",
"linkedin": "https://linkedin.com/company/supermemoryai",
"x": "https://x.com/supermemoryai"
}
},
"icons": { "library": "lucide" },
"logo": {
"dark": "/logo/dark.svg",
"light": "/logo/light.svg"
},
"name": "supermemory | Memory API for the AI era",
"navbar": {
"links": [
{
"href": "mailto:dhravya@supermemory.com",
"label": "Support"
}
],
"primary": {
"href": "https://console.supermemory.ai",
"label": "Dashboard",
"type": "button"
}
},
"navigation": {
"tabs": [
{
"pages": ["introduction"],
"tab": "Welcome"
},
{
"anchors": [
{
"anchor": "Your Dashboard",
"href": "https://console.supermemory.ai",
"icon": "play"
},
{
"anchor": "Documentation",
"pages": [
{
"group": "Memory API",
"pages": [
"memory-api/introduction",
"memory-api/overview",
"memory-api/creation/adding-memories",
"memory-api/searching/searching-memories",
{
"group": "Features",
"pages": [
"memory-api/features/auto-multi-modal",
"memory-api/features/filtering",
"memory-api/features/content-cleaner",
"memory-api/features/query-rewriting",
"memory-api/features/reranking"
]
},
{
"group": "Connectors Sync",
"pages": [
"memory-api/connectors/overview",
"memory-api/connectors/creating-connection",
"api-reference/connections/list-connections",
"api-reference/connections/delete-connection",
"/api-reference/connections/sync-connection",
"memory-api/connectors/google-drive",
{
"group": "Advanced",
"pages": [
"memory-api/connectors/advanced/bring-your-own-key"
]
}
]
}
]
},
{
"group": "Model Enhancer",
"pages": [
"model-enhancement/context-extender",
"model-enhancement/getting-started",
"model-enhancement/identifying-users"
]
},
{
"group": "Overview",
"pages": ["overview/use-cases", "overview/why-supermemory"]
},
{
"group": "Deployment",
"pages": ["deployment/self-hosting"]
}
]
}
],
"tab": "Documentation"
},
{
"anchors": [
{
"anchor": "SDKs",
"pages": ["memory-api/sdks/typescript", "memory-api/sdks/python"]
}
],
"tab": "SDKs"
},
{
"anchors": [
{
"anchor": "API Reference",
"icon": "unplug",
"openapi": "https://localhost:8787/v3/openapi"
}
],
"tab": "API Reference"
},
{
"anchors": [
{
"anchor": "supermemory MCP",
"pages": [
"supermemory-mcp/introduction",
"supermemory-mcp/setup",
"supermemory-mcp/technology"
]
}
],
"tab": "supermemory MCP"
},
{
"anchors": [
{
"anchor": "Changelog",
"pages": ["changelog/overview"]
}
],
"tab": "Changelog"
}
]
},
"redirects": [
{
"destination": "/introduction",
"permanent": false,
"source": "/"
}
],
"styling": { "eyebrows": "breadcrumbs" },
"theme": "mint"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 909 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 13 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

View file

@ -1,66 +0,0 @@
---
title: "Introduction"
description: "supermemory is the Memory API for the AI era"
mode: "custom"
---
export const HeroCard = ({ imageUrl, title, description, href }) => {
return (
<a className="group flex flex-col h-full rounded-lg overflow-hidden hover:shadow-lg transition-all duration-300 border border-gray-100 dark:border-zinc-800 hover:border-gray-200 dark:hover:border-zinc-700" href={href}>
<div className="overflow-hidden">
<img
src={imageUrl}
className="w-full h-48 object-cover transform group-hover:scale-105 transition-all duration-500"
alt={title}
/>
</div>
<div className="p-6">
<h3 className="text-xl font-semibold text-gray-900 dark:text-zinc-50">{title}</h3>
<p className="mt-3 text-gray-600 dark:text-zinc-400">{description}</p>
</div>
</a>
)
}
<div className="relative pb-12">
<div className="px-4 py-16 lg:py-32 max-w-4xl mx-auto">
<h1 className="text-5xl font-bold text-center text-gray-900 dark:text-zinc-50 tracking-tight">
supermemory <span className="text-primary font-medium">[docs]</span>
</h1>
<p className="max-w-2xl mx-auto px-4 mt-6 text-xl text-center text-gray-600 dark:text-zinc-400 leading-relaxed">
Meet the memory API for the AI era — <span className="font-medium">scalable</span>, <span className="font-medium">powerful</span>, <span className="font-medium">affordable</span>, and <span className="font-medium">production-ready</span>.
</p>
<div className="mt-16 lg:mt-20 grid sm:grid-cols-2 gap-8">
<HeroCard
imageUrl="https://imagedelivery.net/_Zs8NCbSWCQ8-iurXrWjBg/40fe287e-b392-4bd6-9fc5-128ef674ca00/public"
title="Memory APIs"
description="Ingest content at scale, in any format. Search and retrieve information with ease."
href="/memory-api/introduction"
/>
<HeroCard
imageUrl="https://imagedelivery.net/_Zs8NCbSWCQ8-iurXrWjBg/abcc107d-7271-4acf-a9a2-90ad7a6f2000/public"
title="Connectors"
description="Sync your content with your favorite tools and platforms seamlessly."
href="/memory-api/connectors/overview"
/>
<HeroCard
imageUrl="https://imagedelivery.net/_Zs8NCbSWCQ8-iurXrWjBg/eda8b2fd-9633-4e93-c6bd-10b44be75e00/public"
title="Model Enhancer"
description="Supercharge your LLM with supermemory's intelligent context management."
href="/model-enhancement/getting-started"
/>
<HeroCard
imageUrl="https://imagedelivery.net/_Zs8NCbSWCQ8-iurXrWjBg/9af9572c-9f8d-42d8-f7d0-503a5f87a300/public"
title="supermemory MCP"
description="Carry your memories with you, using supermemory MCP integration."
href="/supermemory-mcp/introduction"
/>
</div>
</div>
</div>

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 206 168"><path fill="#EFEFEF" d="M205.864 66.263h-76.401V0h-24.684v71.897c0 7.636 3.021 14.97 8.391 20.373l62.383 62.777 17.454-17.564-46.076-46.365h58.948v-24.84l-.015-.015ZM12.872 30.517l46.075 46.365H0v24.84h76.4v66.264h24.685V96.089c0-7.637-3.021-14.97-8.39-20.374l-62.37-62.762-17.453 17.564Z"/></svg>

Before

Width:  |  Height:  |  Size: 371 B

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 206 168"><path fill="#EFEFEF" d="M205.864 66.263h-76.401V0h-24.684v71.897c0 7.636 3.021 14.97 8.391 20.373l62.383 62.777 17.454-17.564-46.076-46.365h58.948v-24.84l-.015-.015ZM12.872 30.517l46.075 46.365H0v24.84h76.4v66.264h24.685V96.089c0-7.637-3.021-14.97-8.39-20.374l-62.37-62.762-17.453 17.564Z"/></svg>

Before

Width:  |  Height:  |  Size: 371 B

View file

@ -1,138 +0,0 @@
---
title: 'Bring Your Own Key (BYOK)'
description: 'Configure your own OAuth application credentials for enhanced security and control'
---
By default, supermemory uses its own OAuth applications to connect to third-party providers. However, you can configure your own OAuth application credentials for enhanced security and control. This is particularly useful for enterprise customers who want to maintain control over their data access.
<Danger>
Some providers like Google Drive require extensive verification and approval before you can use custom keys.
</Danger>
### Setting up Custom Provider Keys
To configure custom OAuth credentials for your organization, use the `PATCH /v3/settings` endpoint:
1. Set up your OAuth application on the provider's developer console.
Google: https://console.developers.google.com/apis/credentials/oauthclient \
Notion: https://www.notion.so/my-integrations \
OneDrive: https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsMenu
2. If using Google drive,
- Select the application type as `Web application`
- **Enable the Google drive api in "APIs and Services" in the Cloud Console**
3. Configure the redirect URL, set it to:
```
https://api.supermemory.ai/v3/connections/auth/callback/{provider}
```
For example, if you are using Google Drive, the redirect URL would be:
```
https://api.supermemory.ai/v3/connections/auth/callback/google-drive
```
4. Configure the client ID and client secret in the `PATCH /v3/settings` endpoint.
<CodeGroup>
```typescript Typescript
import Supermemory from 'supermemory';
const client = new Supermemory({
apiKey: process.env['SUPERMEMORY_API_KEY'],
});
// Example: Configure Google Drive custom OAuth credentials
const settings = await client.settings.update({
googleCustomKeyEnabled: true,
googleDriveClientId: "your-google-client-id",
googleDriveClientSecret: "your-google-client-secret"
});
// Example: Configure Notion custom OAuth credentials
const settings = await client.settings.update({
notionCustomKeyEnabled: true,
notionClientId: "your-notion-client-id",
notionClientSecret: "your-notion-client-secret"
});
// Example: Configure OneDrive custom OAuth credentials
const settings = await client.settings.update({
onedriveCustomKeyEnabled: true,
onedriveClientId: "your-onedrive-client-id",
onedriveClientSecret: "your-onedrive-client-secret"
});
```
```python Python
from supermemory import supermemory
client = supermemory(
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
)
# Example: Configure Google Drive custom OAuth credentials
settings = client.settings.update(
google_custom_key_enabled=True,
google_client_id="your-google-client-id",
google_client_secret="your-google-client-secret"
)
# Example: Configure Notion custom OAuth credentials
settings = client.settings.update(
notion_custom_key_enabled=True,
notion_client_id="your-notion-client-id",
notion_client_secret="your-notion-client-secret"
)
# Example: Configure OneDrive custom OAuth credentials
settings = client.settings.update(
onedrive_custom_key_enabled=True,
onedrive_client_id="your-onedrive-client-id",
onedrive_client_secret="your-onedrive-client-secret"
)
```
```bash cURL
# Example: Configure Google Drive custom OAuth credentials
curl --request PATCH \
--url https://api.supermemory.ai/v3/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"googleDriveCustomKeyEnabled": true,
"googleDriveClientId": "your-google-client-id",
"googleDriveClientSecret": "your-google-client-secret"
}'
# Example: Configure Notion custom OAuth credentials
curl --request PATCH \
--url https://api.supermemory.ai/v3/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"notionCustomKeyEnabled": true,
"notionClientId": "your-notion-client-id",
"notionClientSecret": "your-notion-client-secret"
}'
# Example: Configure OneDrive custom OAuth credentials
curl --request PATCH \
--url https://api.supermemory.ai/v3/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"onedriveCustomKeyEnabled": true,
"onedriveClientId": "your-onedrive-client-id",
"onedriveClientSecret": "your-onedrive-client-secret"
}'
```
</CodeGroup>
<Warning>
Once you enable custom keys for a provider, all new connections for that provider will use your custom OAuth application. Existing connections WILL need to be re-authorized.
</Warning>

View file

@ -1,85 +0,0 @@
---
title: 'Creating connections'
description: 'Create a connection to sync your content with supermemory'
---
To create a connection, just make a `POST` request to `/v3/connections/{provider}`
<CodeGroup>
```typescript Typescript
import Supermemory from 'supermemory';
const client = new Supermemory({
apiKey: process.env['SUPERMEMORY_API_KEY'], // This is the default and can be omitted
});
const connection = await client.connections.create('notion');
console.debug(connection.authLink);
```
```python Python
import requests
url = "https://api.supermemory.ai/v3/connections/{provider}"
payload = {
"redirectUrl": "<string>",
"containerTags": ["<string>"],
"metadata": {},
"documentLimit": 5000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
```
```bash cURL
curl --request POST \
--url https://api.supermemory.ai/v3/connections/{provider} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"redirectUrl": "<string>",
"containerTags": [
"<string>"
],
"metadata": {},
"documentLimit": 5000
}'
```
</CodeGroup>
### Parameters
- `provider`: The provider to connect to. Currently supported providers are `notion`, `google-drive`, `one-drive`
- `redirectUrl`: The URL to redirect to after the connection is created (your app URL)
- `containerTags`: Optional. For partitioning users, organizations, etc. in your app.
- Example: `["user_123", "project_alpha"]`
- `metadata`: Optional. Any metadata you want to associate with the connection.
- This metadata is added to every document synced from this connection.
- `documentLimit`: Optional. The maximum number of documents to sync from this connection.
- Default: 10,000
- This can be used to limit costs and sync a set number of documents for a specific user.
## Response
supermemory sends a response with the following schema:
```json
{
"id": "<string>",
"authLink": "<string>",
"expiresIn": "<string>",
"redirectsTo": "<string>"
}
```
You can use the `authLink` to redirect the user to the provider's login page.
Next up, managing connections.

View file

@ -1,27 +0,0 @@
---
title: 'Google Drive'
description: 'Sync your Google Drive content with supermemory'
---
supermemory syncs Google Drive documents automatically and instantaneously.
## Supported file types
- Google Docs
- Google Slides
- Google Sheets
## Conversions
To import items, supermemory converts documents into markdown, and then ingests them into supermemory.
This conversion is lossy, and some formatting may be lost.
## Sync frequency
supermemory syncs documents:
- **A document is modified or created (Webhook recieved)**
- Note that not all providers are synced via webhook (Instant sync right now)
- `Google-Drive` and `Notion` documents are synced instantaneously
- Every **four hours**
- On **Manual Sync** (API call)
- You can call `/v3/connections/{provider}/sync` to sync documents manually

View file

@ -1,26 +0,0 @@
---
title: 'Connectors Overview'
sidebarTitle: 'Overview'
description: 'Sync external connections like Google Drive, Notion, OneDrive with supermemory'
---
supermemory can sync external connections like Google Drive, Notion, OneDrive with more coming soon.
### The Flow
1. Make a `POST` request to `/v3/connections/{provider}`
2. supermemory will return an `authLink` which you can redirect the user to
3. The user will be redirected to the provider's login page
4. User is redirected back to your app's `redirectUrl`
![Connectors Flow](/images/connectors-flow.png)
## Sync frequency
supermemory syncs documents:
- **A document is modified or created (Webhook recieved)**
- Note that not all providers are synced via webhook (Instant sync right now)
- `Google-Drive` and `Notion` documents are synced instantaneously
- Every **four hours**
- On **Manual Sync** (API call)
- You can call `/v3/connections/{provider}/sync` to sync documents manually

View file

@ -1,389 +0,0 @@
---
title: "Adding Memories"
description: "Learn how to add content to supermemory"
icon: "plus"
---
<Accordion title="Best Practices" icon="sparkles">
1. **Content Organization**
- **Use `containerTags` for grouping/partitioning**
- Optional tags (array of strings) to group memories.
- Can be a user ID, project ID, or any other identifier.
- Allows filtering for memories that share specific tags.
- Example: `["user_123", "project_alpha"]`
Read more about [filtering](/memory-api/features/filtering)
2. **Performance Tips**
- **Batch Operations**
- You can add multiple items in parallel
- Use different `containerTags` for different spaces
- Don't wait for processing to complete unless needed
- **Search Optimization**
```json
{
"q": "error logs",
"documentThreshold": 0.7, // Higher = more precise
"limit": 5, // Keep it small
"onlyMatchingChunks": true // Skip extra context if not needed
}
```
3. **URL Content**
- Send clean URLs without tracking parameters
- Use article URLs, not homepage URLs
- Check URL accessibility before sending
</Accordion>
## Basic Usage
To add a memory, send a POST request to `/add` with your content:
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/memories \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
--data '{
"customId": "xyz-my-db-id",
"content": "This is the content of my memory",
"metadata": {
"category": "technology",
"tag_1": "ai",
"tag_2": "machine-learning",
},
"containerTags": ["user_123", "project_xyz"]
}'
```
```typescript Typescript
await client.memory.create({
customId: "xyz-mydb-id",
content: "This is the content of my memory",
metadata: {
category: "technology",
tag_1": "ai",
tag_2": "machine-learning",
},
containerTags: ["user_123", "project_xyz"]
})
```
```python Python
client.memory.create(
customId="xyz-mydb-id",
content="documents related to python",
metadata={
"category": "datascience",
"tag_1": "ai",
"tag_2": "machine-learning",
},
containerTags=["user_123", "project_xyz"]
)
```
</CodeGroup>
The API will return a response with an ID and initial status:
```json
{
"id": "mem_abc123",
"status": "queued"
}
```
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/memories \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
-d '{
"content": "https://example.com/article",
"metadata": {
"source": "web", # Just example metadata
"category": "technology" # NOT required
},
"containerTags": ["user_456", "research_papers"]
}'
```
```typescript Typescript
await client.memory.create({
content: "https://example.com/article",
userId: "user_456",
metadata: {
source: "web", // Just example metadata
category: "technology", // NOT required
},
containerTags: ["user_456", "research_papers"],
});
```
```python Python
client.memory.create(
content="https://example.com/article",
userId="user_456",
metadata={
"source": "web",
"category": "technology"
},
containerTags=["user_456", "research_papers"]
)
```
</CodeGroup>
{/\* <Note>
TODO: Supported content types
</Note> */}
## Metadata and Organization
You can add rich metadata to organize your content:
```json
{
"metadata": {
"source": "string", // String
"priority": 1234, // Custom numeric field
"custom_field": "any" // Any custom field
}
}
```
{/\* <Note>
TODO: Filtering by metadata
</Note> */}
## Partitioning by user
You can attribute and partition your data by providing a `userId`:
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/memories \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
-d '{
"content": "This is space-specific content",
"userId": "space_123",
"metadata": {
"category": "space-content"
}
}'
```
```typescript Typescript
await client.memory.create({
content: "This is space-specific content",
userId: "space_123",
metadata: {
category: "space-content",
},
});
```
```python Python
client.memory.create(
content="This is space-specific content",
userId="space_123",
metadata={
"category": "space-content"
}
)
```
</CodeGroup>
<Note>
When searching, if you provide a `userId`, only memories from that space will
be returned.
</Note>
## Grouping
You can group memories by providing an array of `containerTags`:
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/memories \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
-d '{
"content": "This is space-specific content",
"containerTags": ["user_123", "project_xyz"]
}'
```
```typescript Typescript
await client.memory.create({
content: "This is space-specific content",
containerTags: ["user_123", "project_xyz"],
});
```
```python Python
client.memory.create(
content="This is space-specific content",
containerTags=["user_123", "project_xyz"]
)
```
</CodeGroup>
{/\* <Note>
TODO: Processing Statuses
</Note> */}
## Checking Status
Check status using the memory ID:
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/memories/mem_abc123 \
--request GET \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY'
```
```typescript Typescript
await client.memory.get("mem_abc123");
```
```python Python
client.memory.get("mem_abc123")
```
</CodeGroup>
<Warning>
Memories are deleted after 2 minutes if an irrecoverable error occurs.
</Warning>
## File Uploads
For file uploads, use the dedicated file upload endpoint. You can include `containerTags` directly in the form data:
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/memories/file \
--request POST \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
--form 'file=@/path/to/your/file.pdf' \
--form 'containerTags=["user_123", "project_xyz"]'
```
```typescript Typescript
const formData = new FormData();
formData.append("file", fileBlob);
formData.append("containerTags", JSON.stringify(["user_123", "project_xyz"]));
const response = await fetch("https://api.supermemory.ai/v3/memories/file", {
method: "POST",
headers: {
Authorization: "Bearer SUPERMEMORY_API_KEY",
},
body: formData,
});
```
```python Python
import requests
import json
with open('/path/to/your/file.pdf', 'rb') as f:
files = {'file': f}
data = {'containerTags': json.dumps(["user_123", "project_xyz"])}
response = requests.post(
'https://api.supermemory.ai/v3/memories/file',
headers={'Authorization': 'Bearer SUPERMEMORY_API_KEY'},
files=files,
data=data
)
```
</CodeGroup>
### Adding Additional Metadata to Files
If you need to add additional metadata (like title or description) after upload, you can use the PATCH endpoint:
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/memories/MEMORY_ID \
--request PATCH \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
--data '{
"metadata": {
"title": "My Document",
"description": "Important project document"
}
}'
```
```typescript Typescript
await fetch(`https://api.supermemory.ai/v3/memories/${memoryId}`, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer SUPERMEMORY_API_KEY",
},
body: JSON.stringify({
metadata: {
title: "My Document",
description: "Important project document",
},
}),
});
```
```python Python
import requests
requests.patch(
f'https://api.supermemory.ai/v3/memories/{memory_id}',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer SUPERMEMORY_API_KEY'
},
json={
'metadata': {
'title': 'My Document',
'description': 'Important project document'
}
}
)
```
</CodeGroup>
<Note>
The file upload endpoint returns immediately with a memory ID and processing
status. The file will be processed asynchronously, and you can check its
status using the GET endpoint.
</Note>
## Next Steps
Explore more advanced features in our [API Reference](/api-reference/manage-memories/add-memory)

View file

@ -1,14 +0,0 @@
---
title: "Processing Status"
description: "Learn about the stages of content processing"
---
After adding content, you can check its processing status:
1. `queued`: Content is queued for processing
2. `extracting`: Extracting content from source
3. `chunking`: Splitting content into semantic chunks
4. `embedding`: Generating vector embeddings
5. `indexing`: Adding to search index
6. `done`: Processing complete
7. `failed`: Processing failed

View file

@ -1,181 +0,0 @@
---
title: "Auto Multi Modal"
description: "supermemory automatically detects the content type of the document you are adding."
icon: "sparkles"
---
supermemory is natively multi-modal, and can automatically detect the content type of the document you are adding.
We use the best of breed tools to extract content from URLs, and process it for optimal memory storage.
## Automatic Content Type Detection
supermemory automatically detects the content type of the document you're adding. Simply pass your content to the API, and supermemory will handle the rest.
<Tabs>
<Tab title="How It Works">
The content detection system analyzes:
- URL patterns and domains
- File extensions and MIME types
- Content structure and metadata
- Headers and response types
</Tab>
<Tab title="Best Practices">
<Accordion title="Content Type Best Practices" defaultOpen icon="sparkles">
1. **Type Selection**
- Use `note` for simple text
- Use `webpage` for online content
- Use native types when possible
2. **URL Content**
- Send clean URLs without tracking parameters
- Use article URLs, not homepage URLs
- Check URL accessibility before sending
</Accordion>
</Tab>
</Tabs>
### Quick Implementation
All you need to do is pass the content to the `/memories` endpoint:
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/memories \
--request POST \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
-d '{"content": "https://example.com/article"}'
```
```typescript
await client.add.create({
content: "https://example.com/article",
});
```
```python
client.add.create(
content="https://example.com/article"
)
```
</CodeGroup>
<Note>
supermemory uses [Markdowner](https://md.dhr.wtf) to extract content from
URLs.
</Note>
## Supported Content Types
supermemory supports a wide range of content formats to ensure versatility in memory creation:
<Grid cols={2}>
<Card title="Text Content" icon="document-text">
- `note`: Plain text notes and documents
- Directly processes raw text content
- Automatically chunks content for optimal retrieval
- Preserves formatting and structure
</Card>
<Card title="Web Content" icon="globe">
- `webpage`: Web pages (just provide the URL)
- Intelligently extracts main content
- Preserves important metadata (title, description, images)
- Extracts OpenGraph metadata when available
- `tweet`: Twitter content
- Captures tweet text, media, and metadata
- Preserves thread structure if applicable
</Card>
<Card title="Document Types" icon="document">
- `pdf`: PDF files
- Extracts text content while maintaining structure
- Handles both searchable PDFs and scanned documents with OCR
- Preserves page breaks and formatting
- `google_doc`: Google Documents
- Seamlessly integrates with Google Docs API
- Maintains document formatting and structure
- Auto-updates when source document changes
- `notion_doc`: Notion pages
- Extracts content while preserving Notion's block structure
- Handles rich text formatting and embedded content
</Card>
<Card title="Media Types" icon="photo">
- `image`: Images with text content
- Advanced OCR for text extraction
- Visual content analysis and description
- `video`: Video content
- Transcription and content extraction
- Key frame analysis
</Card>
</Grid>
## Processing Pipeline
<Steps>
<Step title="Content Detection">
supermemory automatically identifies the content type based on the input provided.
</Step>
<Step title="Content Extraction">
Type-specific extractors process the content with: - Specialized parsing for
each format - Error handling with retries - Rate limit management
</Step>
<Step title="AI Enhancement">
```typescript
interface ProcessedContent {
content: string; // Extracted text
summary?: string; // AI-generated summary
tags?: string[]; // Extracted tags
categories?: string[]; // Content categories
}
```
</Step>
<Step title="Chunking & Indexing">
- Sentence-level splitting
- 2-sentence overlap
- Context preservation
- Semantic coherence
</Step>
</Steps>
## Technical Specifications
### Size Limits
| Content Type | Max Size |
| ------------ | -------- |
| Text/Note | 1MB |
| PDF | 10MB |
| Image | 5MB |
| Video | 100MB |
| Web Page | N/A |
| Google Doc | N/A |
| Notion Page | N/A |
| Tweet | N/A |
### Processing Time
| Content Type | Processing Time |
| ------------ | --------------- |
| Text/Note | Almost instant |
| PDF | 1-5 seconds |
| Image | 2-10 seconds |
| Video | 10+ seconds |
| Web Page | 1-3 seconds |
| Google Doc | N/A |
| Notion Page | N/A |
| Tweet | N/A |

View file

@ -1,86 +0,0 @@
---
title: "Cleaning and Categorizing"
description: "Document Cleaning Summaries in supermemory"
icon: "washing-machine"
---
supermemory provides advanced configuration options to customize your content processing pipeline. At its core is an AI-powered system that can automatically analyze, categorize, and filter your content based on your specific needs.
## Configuration Schema
```json
{
"shouldLLMFilter": true,
"categories": ["feature-request", "bug-report", "positive", "negative"],
"filterPrompt": "Analyze feedback sentiment and identify feature requests",
"includeItems": ["critical", "high-priority"],
"excludeItems": ["spam", "irrelevant"]
}
```
## Core Settings
### shouldLLMFilter
- **Type**: `boolean`
- **Required**: No (defaults to `false`)
- **Description**: Master switch for AI-powered content analysis. Must be enabled to use any of the advanced filtering features.
### categories
- **Type**: `string[]`
- **Limits**: Each category must be 1-50 characters
- **Required**: No
- **Description**: Define custom categories for content classification. When specified, the AI will only use these categories. If not specified, it will generate 3-5 relevant categories automatically.
### filterPrompt
- **Type**: `string`
- **Limits**: 1-750 characters
- **Required**: No
- **Description**: Custom instructions for the AI on how to analyze and categorize content. Use this to guide the categorization process based on your specific needs.
### includeItems & excludeItems
- **Type**: `string[]`
- **Limits**: Each item must be 1-20 characters
- **Required**: No
- **Description**: Fine-tune content filtering by specifying items to explicitly include or exclude during processing.
## Content Processing Pipeline
When content is ingested with LLM filtering enabled:
1. **Initial Processing**
- Content is extracted and normalized
- Basic metadata (title, description) is captured
2. **AI Analysis**
- Content is analyzed based on your `filterPrompt`
- Categories are assigned (either from your predefined list or auto-generated)
- Tags are evaluated and scored
3. **Chunking & Indexing**
- Content is split into semantic chunks
- Each chunk is embedded for efficient search
- Metadata and classifications are stored
## Example Use Cases
### 1. Customer Feedback System
```json
{
"shouldLLMFilter": true,
"categories": ["positive", "negative", "neutral"],
"filterPrompt": "Analyze customer sentiment and identify key themes",
}
```
### 2. Content Moderation
```json
{
"shouldLLMFilter": true,
"categories": ["safe", "needs-review", "flagged"],
"filterPrompt": "Identify potentially inappropriate or sensitive content",
"excludeItems": ["spam", "offensive"],
"includeItems": ["user-generated"]
}
```
> **Important**: All filtering features (`categories`, `filterPrompt`, `includeItems`, `excludeItems`) require `shouldLLMFilter` to be enabled. Attempting to use these features without enabling `shouldLLMFilter` will result in a 400 error.

View file

@ -1,266 +0,0 @@
---
title: "Filtering"
description: "Learn how to filter content while searching from supermemory"
icon: "list-filter-plus"
---
## Container Tag
Container tag is an identifier for your end users, to group memories together..
This can be:
- A user using your product
- An organization using a SaaS
A project ID, or even a dynamic one like `user_project_etc`
We recommend using single containerTag in all API requests.
The graph is built on top of the Container Tags. For example, each user / tag in your supermemory account will have one single graph built for them.
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/search \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
--data '{
"q": "machine learning",
"containerTags": ["user_123"]
}'
```
```typescript Typescript
await client.search.execute({
q: "machine learning",
containerTags: ["user_123"],
});
```
```python Python
client.search.execute(
q="machine learning",
containerTags=["user_123"]
)
```
</CodeGroup>
## Metadata
Sometimes, you might want to add metadata and do advanced filtering based on it.
Using metadata filtering, you can search based on:
- AND and OR conditions
- String matching
- Numeric matching
- Date matching
- Time range queries
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/search \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
--data '{
"q": "machine learning",
"filters": {
"AND": [
{
"key": "category",
"value": "technology",
"negate": false
},
{
"filterType": "numeric",
"key": "readingTime",
"value": "5",
"negate": false,
"numericOperator": "<="
}
]
}
}'
```
```typescript Typescript
await client.search.execute({
q: "machine learning",
filters: {
AND: [
{
key: "category",
value: "technology",
negate: false,
},
{
filterType: "numeric",
key: "readingTime",
value: "5",
negate: false,
numericOperator: "<=",
},
],
},
});
```
```python Python
client.search.execute(
q="machine learning",
filters={
"AND": [
{
"key": "category",
"value": "technology",
"negate": false
},
{
"filterType": "numeric",
"key": "readingTime",
"value": "5",
"negate": false,
"numericOperator": "<="
}
]
}
)
```
</CodeGroup>
## Array Contains Filtering
You can filter memories by array values using the `array_contains` filter type. This is particularly useful for filtering by participants or other array-based metadata.
First, create a memory with participants in the metadata:
<CodeGroup>
```bash cURL
curl --location 'https://api.supermemory.ai/v3/memories' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
--data '{
"content": "quarterly planning meeting discussion",
"metadata": {
"participants": ["john.doe", "sarah.smith", "mike.wilson"]
}
}'
```
```typescript Typescript
await client.memories.create({
content: "quarterly planning meeting discussion",
metadata: {
participants: ["john.doe", "sarah.smith", "mike.wilson"]
}
});
```
```python Python
client.memories.create(
content="quarterly planning meeting discussion",
metadata={
"participants": ["john.doe", "sarah.smith", "mike.wilson"]
}
)
```
</CodeGroup>
Then search using the `array_contains` filter:
<CodeGroup>
```bash cURL
curl --location 'https://api.supermemory.ai/v3/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
--data '{
"q": "meeting",
"filters": {
"AND": [
{
"key": "participants",
"value": "john.doe",
"filterType": "array_contains"
}
]
},
"limit": 5
}'
```
```typescript Typescript
await client.search.execute({
q: "meeting",
filters: {
AND: [
{
key: "participants",
value: "john.doe",
filterType: "array_contains"
}
]
},
limit: 5
});
```
```python Python
client.search.execute(
q="meeting",
filters={
"AND": [
{
"key": "participants",
"value": "john.doe",
"filterType": "array_contains"
}
]
},
limit=5
)
```
</CodeGroup>
## Document
You can also find chunks within a specific, large document.
This can be particularly useful for extremely large documents like Books, Podcasts, etc.
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/search \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
--data '{
"q": "machine learning",
"docId": "doc_123"
}'
```
```typescript Typescript
await client.search.execute({
q: "machine learning",
docId: "doc_123",
});
```
```python Python
client.search.execute(
q="machine learning",
docId="doc_123"
)
```
</CodeGroup>

View file

@ -1,50 +0,0 @@
---
title: "Query Rewriting"
description: "Query Rewriting in supermemory"
icon: "blend"
---
Query Rewriting is a feature that allows you to rewrite queries to make them more accurate.
![Query Rewriting](/images/query-rewriting.png)
### Usage
In supermemory, you can enable query rewriting by setting the `rewriteQuery` parameter to `true` in the search API.
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/search \
--request POST \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
--header 'Content-Type: application/json' \
-d '{
"q": "What is the capital of France?",
"rewriteQuery": true
}'
```
```typescript
await client.search.create({
q: "What is the capital of France?",
rewriteQuery: true,
});
```
```python
client.search.create(
q="What is the capital of France?",
rewriteQuery=True
)
```
</CodeGroup>
### Notes and limitations
- supermemory generates multiple rewrites, and runs the search through all of them.
- The results are then merged and returned to you.
- There is no additional costs associated with query rewriting.
- While query rewriting makes the quality much better, it also **incurs additional latency**.
- All other features like filtering, hybrid search, recency bias, etc. work with rewritten results as well.

View file

@ -1,44 +0,0 @@
---
title: "Reranking"
description: "Reranked search results in supermemory"
icon: "chart-bar-increasing"
---
Reranking is a feature that allows you to rerank search results based on the query.
![Reranking](/images/rerank.png)
### Usage
In supermemory, you can enable answer rewriting by setting the `rerank` parameter to `true` in the search API.
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/search?q=What+is+the+capital+of+France?&rerank=true \
--request GET \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY'
```
```typescript
await client.search.create({
q: "What is the capital of France?",
rerank: true,
});
```
```python
client.search.create(
q="What is the capital of France?",
rerank=True
)
```
</CodeGroup>
### Notes and limitations
- We currently use `bge-reranker-base` model for reranking.
- There is no additional costs associated with reranking.
- While reranking makes the quality much better, it also **incurs additional latency**.
- All other features like filtering, hybrid search, recency bias, etc. work with reranked results as well.

View file

@ -1,43 +0,0 @@
---
title: "Introduction - Memory endpoints"
sidebarTitle: "Introduction"
description: "Ingest content at scale, in any format."
---
**supermemory** automatically **ingests and processes your data**, and makes it searchable.
<Info>
The Memory engine scales linearly - which means we're **incredibly fast and scalable**, while providing one of the more affordable
</Info>
![supermemory](/images/processing.png)
It also gives you features like:
- [Connectors and Syncing](/memory-api/connectors/)
- [Multimodality](/memory-api/features/auto-multi-modal)
- [Advanced Filtering](/memory-api/features/filtering)
- [Reranking](/memory-api/features/reranking)
- [Extracting details from text](/memory-api/features/content-cleaner)
- [Query Rewriting](/memory-api/features/query-rewriting)
... and lots more\!
Check out the following resources to get started:
<CardGroup cols={2}>
<Card title="Quickstart" icon="zap" href="/memory-api/overview">
Get started in 5 minutes
</Card>
<Card title="API Reference" icon="unplug" href="/api-reference">
Learn more about the API
</Card>
<Card title="Use Cases" icon="brain" href="/overview/use-cases">
See what supermemory can do for you
</Card>
<Card title="SDKs" icon="code" href="/memory-api/sdks/">
Learn more about the SDKs
</Card>
</CardGroup>

View file

@ -1,161 +0,0 @@
---
title: "Quickstart - 5 mins"
description: "Learn how to integrate supermemory into your application"
---
## Authentication
Head to [supermemory's Developer Platform](https://console.supermemory.ai) built to help you monitor and manage every aspect of the API.
All API requests require authentication using an API key. Include your API key as follows:
<CodeGroup>
```bash cURL
Authorization: Bearer YOUR_API_KEY
```
```typescript Typescript
// npm install supermemory
const client = new supermemory({
apiKey: "YOUR_API_KEY",
});
```
```python Python
# pip install supermemory
client = supermemory(
api_key="YOUR_API_KEY",
)
```
</CodeGroup>
## Installing the clients
You can use supermemory through the APIs, or using our SDKs
<CodeGroup>
```bash cURL
https://api.supermemory.ai/v3
```
```bash Typescript
npm i supermemory
```
```bash Python
pip install supermemory
```
</CodeGroup>
## Add your first memory
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/memories \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
-d '{"content": "This is the content of my first memory."}'
```
```typescript Typescript
await client.memory.add({
content: "This is the content of my first memory.",
});
```
```python Python
client.memory.add(
content="This is the content of my first memory.",
)
```
</CodeGroup>
This will add a new memory to your supermemory account.
Try it out in the [API Playground](/api-reference/manage-memories/add-memory).
## Content Processing
<Accordion title="Processing steps" icon="sparkles">
When you add content to supermemory, it goes through several processing steps:
1. **Queued**: Initial state when content is submitted
2. **Extracting**: Content is being extracted from the source
3. **Chunking**: Content is being split into semantic chunks
4. **Embedding**: Generating vector embeddings for search
5. **Indexing**: Adding content to the search index
6. **Done**: Processing complete
</Accordion>
<Accordion title="Advanced Chunking" icon="sparkles">
The system uses advanced NLP techniques for optimal chunking:
- Sentence-level splitting for natural boundaries
- Context preservation with overlapping chunks
- Smart handling of long content
- Semantic coherence optimization
</Accordion>
## Search your memories
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/search \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
-d '{"q": "This is the content of my first memory."}'
```
```typescript Typescript
await client.search.execute({
q: "This is the content of my first memory.",
});
```
```python Python
client.search.execute(
q="This is the content of my first memory.",
)
```
</CodeGroup>
Try it out in the [API Playground](/api-reference/search-memories/search-memories).
You can do a lot more with supermemory, and we will walk through everything you need to.
Next, explore the features available in supermemory
<CardGroup cols={2}>
<Card title="Adding memories" icon="plus" href="/memory-api/creation">
Adding memories
</Card>
<Card
title="Searching and filtering"
icon="search"
href="/memory-api/searching"
>
Searching for items
</Card>
<Card
title="Connectors and Syncing"
icon="plug"
href="/memory-api/connectors"
>
Connecting external sources
</Card>
<Card title="Features" icon="sparkles" href="/memory-api/features">
Explore Features
</Card>
</CardGroup>

View file

@ -1,349 +0,0 @@
---
title: 'Python SDK'
sidebarTitle: "Python"
description: 'Learn how to use supermemory with Python'
---
## Installation
```sh
# install from PyPI
pip install --pre supermemory
```
## Usage
```python
import os
from supermemory import Supermemory
client = supermemory(
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
)
response = client.search.execute(
q="documents related to python",
)
print(response.results)
```
While you can provide an `api_key` keyword argument,
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
to add `SUPERMEMORY_API_KEY="My API Key"` to your `.env` file
so that your API Key is not stored in source control.
## Async usage
Simply import `AsyncSupermemory` instead of `supermemory` and use `await` with each API call:
```python
import os
import asyncio
from supermemory import AsyncSupermemory
client = AsyncSupermemory(
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
)
async def main() -> None:
response = await client.search.execute(
q="documents related to python",
)
print(response.results)
asyncio.run(main())
```
Functionality between the synchronous and asynchronous clients is otherwise identical.
## Using types
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
- Serializing back into JSON, `model.to_json()`
- Converting to a dictionary, `model.to_dict()`
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
## File uploads
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
```python
from pathlib import Path
from supermemory import Supermemory
client = supermemory()
client.memories.upload_file(
file=Path("/path/to/file"),
)
```
The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
## Handling errors
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `supermemory.APIConnectionError` is raised.
When the API returns a non-success status code (that is, 4xx or 5xx
response), a subclass of `supermemory.APIStatusError` is raised, containing `status_code` and `response` properties.
All errors inherit from `supermemory.APIError`.
```python
import supermemory
from supermemory import Supermemory
client = supermemory()
try:
client.memories.add(
content="This is a detailed article about machine learning concepts...",
)
except supermemory.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
except supermemory.RateLimitError as e:
print("A 429 status code was received; we should back off a bit.")
except supermemory.APIStatusError as e:
print("Another non-200-range status code was received")
print(e.status_code)
print(e.response)
```
Error codes are as follows:
| Status Code | Error Type |
| ----------- | -------------------------- |
| 400 | `BadRequestError` |
| 401 | `AuthenticationError` |
| 403 | `PermissionDeniedError` |
| 404 | `NotFoundError` |
| 422 | `UnprocessableEntityError` |
| 429 | `RateLimitError` |
| >=500 | `InternalServerError` |
| N/A | `APIConnectionError` |
### Retries
Certain errors are automatically retried 2 times by default, with a short exponential backoff.
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
429 Rate Limit, and >=500 Internal errors are all retried by default.
You can use the `max_retries` option to configure or disable retry settings:
```python
from supermemory import Supermemory
# Configure the default for all requests:
client = supermemory(
# default is 2
max_retries=0,
)
# Or, configure per-request:
client.with_options(max_retries=5).memories.add(
content="This is a detailed article about machine learning concepts...",
)
```
### Timeouts
By default requests time out after 1 minute. You can configure this with a `timeout` option,
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
```python
from supermemory import Supermemory
# Configure the default for all requests:
client = supermemory(
# 20 seconds (default is 1 minute)
timeout=20.0,
)
# More granular control:
client = supermemory(
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
)
# Override per-request:
client.with_options(timeout=5.0).memories.add(
content="This is a detailed article about machine learning concepts...",
)
```
On timeout, an `APITimeoutError` is thrown.
Note that requests that time out are [retried twice by default](#retries).
## Advanced
### Logging
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
You can enable logging by setting the environment variable `SUPERMEMORY_LOG` to `info`.
```shell
$ export SUPERMEMORY_LOG=info
```
Or to `debug` for more verbose logging.
### How to tell whether `None` means `null` or missing
In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:
```py
if response.my_field is None:
if 'my_field' not in response.model_fields_set:
print('Got json like {}, without a "my_field" key present at all.')
else:
print('Got json like {"my_field": null}.')
```
### Accessing raw response data (e.g. headers)
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
```py
from supermemory import Supermemory
client = supermemory()
response = client.memories.with_raw_response.add(
content="This is a detailed article about machine learning concepts...",
)
print(response.headers.get('X-My-Header'))
memory = response.parse() # get the object that `memories.add()` would have returned
print(memory.id)
```
These methods return an [`APIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory/_response.py) object.
The async client returns an [`AsyncAPIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
#### `.with_streaming_response`
The above interface eagerly reads the full response body when you make the request, which may not always be what you want.
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
```python
with client.memories.with_streaming_response.add(
content="This is a detailed article about machine learning concepts...",
) as response:
print(response.headers.get("X-My-Header"))
for line in response.iter_lines():
print(line)
```
The context manager is required so that the response will reliably be closed.
### Making custom/undocumented requests
This library is typed for convenient access to the documented API.
If you need to access undocumented endpoints, params, or response properties, the library can still be used.
#### Undocumented endpoints
To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
http verbs. Options on the client will be respected (such as retries) when making this request.
```py
import httpx
response = client.post(
"/foo",
cast_to=httpx.Response,
body={"my_param": True},
)
print(response.headers.get("x-foo"))
```
#### Undocumented request params
If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
options.
#### Undocumented response properties
To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
can also get all the extra fields on the Pydantic model as a dict with
[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).
### Configuring the HTTP client
You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
- Custom [transports](https://www.python-httpx.org/advanced/transports/)
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
```python
import httpx
from supermemory import Supermemory, DefaultHttpxClient
client = supermemory(
# Or use the `SUPERMEMORY_BASE_URL` env var
base_url="http://my.test.server.example.com:8083",
http_client=DefaultHttpxClient(
proxy="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
)
```
You can also customize the client on a per-request basis by using `with_options()`:
```python
client.with_options(http_client=DefaultHttpxClient(...))
```
### Managing HTTP resources
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
```py
from supermemory import Supermemory
with supermemory() as client:
# make requests here
...
# HTTP client is now closed
```
## Versioning
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
1. Changes that only affect static types, without breaking runtime behavior.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
3. Changes that we do not expect to impact the vast majority of users in practice.
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
We are keen for your feedback; please open an [issue](https://www.github.com/supermemoryai/python-sdk/issues) with questions, bugs, or suggestions.
### Determining the installed version
If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.
You can determine the version that is being used at runtime with:
```py
import supermemory
print(supermemory.__version__)
```
## Requirements
Python 3.8 or higher.

View file

@ -1,391 +0,0 @@
---
title: 'Typescript SDK'
sidebarTitle: "Typescript"
description: 'Learn how to use supermemory with Typescript'
---
## Installation
```sh
npm install supermemory
```
## Usage
```js
import supermemory from 'supermemory';
const client = new supermemory({
apiKey: process.env['SUPERMEMORY_API_KEY'], // This is the default and can be omitted
});
async function main() {
const response = await client.search.execute({ q: 'documents related to python' });
console.debug(response.results);
}
main();
```
### Request & Response types
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
```ts
import supermemory from 'supermemory';
const client = new supermemory({
apiKey: process.env['SUPERMEMORY_API_KEY'], // This is the default and can be omitted
});
async function main() {
const params: supermemory.MemoryAddParams = {
content: 'This is a detailed article about machine learning concepts...',
};
const response: supermemory.MemoryAddResponse = await client.memories.add(params);
}
main();
```
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
## File uploads
Request parameters that correspond to file uploads can be passed in many different forms:
- `File` (or an object with the same structure)
- a `fetch` `Response` (or an object with the same structure)
- an `fs.ReadStream`
- the return value of our `toFile` helper
```ts
import fs from 'fs';
import supermemory, { toFile } from 'supermemory';
const client = new supermemory();
// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
await client.memories.uploadFile({ file: fs.createReadStream('/path/to/file') });
// Or if you have the web `File` API you can pass a `File` instance:
await client.memories.uploadFile({ file: new File(['my bytes'], 'file') });
// You can also pass a `fetch` `Response`:
await client.memories.uploadFile({ file: await fetch('https://somesite/file') });
// Finally, if none of the above are convenient, you can use our `toFile` helper:
await client.memories.uploadFile({ file: await toFile(Buffer.from('my bytes'), 'file') });
await client.memories.uploadFile({ file: await toFile(new Uint8Array([0, 1, 2]), 'file') });
```
## Handling errors
When the library is unable to connect to the API,
or if the API returns a non-success status code (i.e., 4xx or 5xx response),
a subclass of `APIError` will be thrown:
```ts
async function main() {
const response = await client.memories
.add({ content: 'This is a detailed article about machine learning concepts...' })
.catch(async (err) => {
if (err instanceof supermemory.APIError) {
console.debug(err.status); // 400
console.debug(err.name); // BadRequestError
console.debug(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
}
main();
```
Error codes are as follows:
| Status Code | Error Type |
| ----------- | -------------------------- |
| 400 | `BadRequestError` |
| 401 | `AuthenticationError` |
| 403 | `PermissionDeniedError` |
| 404 | `NotFoundError` |
| 422 | `UnprocessableEntityError` |
| 429 | `RateLimitError` |
| >=500 | `InternalServerError` |
| N/A | `APIConnectionError` |
### Retries
Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
429 Rate Limit, and >=500 Internal errors will all be retried by default.
You can use the `maxRetries` option to configure or disable this:
```js
// Configure the default for all requests:
const client = new supermemory({
maxRetries: 0, // default is 2
});
// Or, configure per-request:
await client.memories.add({ content: 'This is a detailed article about machine learning concepts...' }, {
maxRetries: 5,
});
```
### Timeouts
Requests time out after 1 minute by default. You can configure this with a `timeout` option:
```ts
// Configure the default for all requests:
const client = new supermemory({
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
});
// Override per-request:
await client.memories.add({ content: 'This is a detailed article about machine learning concepts...' }, {
timeout: 5 * 1000,
});
```
On timeout, an `APIConnectionTimeoutError` is thrown.
Note that requests which time out will be [retried twice by default](#retries).
## Advanced Usage
### Accessing raw Response data (e.g., headers)
The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.
You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
Unlike `.asResponse()` this method consumes the body, returning once it is parsed.
```ts
const client = new supermemory();
const response = await client.memories
.add({ content: 'This is a detailed article about machine learning concepts...' })
.asResponse();
console.debug(response.headers.get('X-My-Header'));
console.debug(response.statusText); // access the underlying Response object
const { data: response, response: raw } = await client.memories
.add({ content: 'This is a detailed article about machine learning concepts...' })
.withResponse();
console.debug(raw.headers.get('X-My-Header'));
console.debug(response.id);
```
### Logging
<Warning>
All log messages are intended for debugging only. The format and content of log messages may change between releases.
</Warning>
#### Log levels
The log level can be configured in two ways:
1. Via the `SUPERMEMORY_LOG` environment variable
2. Using the `logLevel` client option (overrides the environment variable if set)
```ts
import supermemory from 'supermemory';
const client = new supermemory({
logLevel: 'debug', // Show all log messages
});
```
Available log levels, from most to least verbose:
- `'debug'` - Show debug messages, info, warnings, and errors
- `'info'` - Show info messages, warnings, and errors
- `'warn'` - Show warnings and errors (default)
- `'error'` - Show only errors
- `'off'` - Disable all logging
At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.
Some authentication-related headers are redacted, but sensitive data in request and response bodies
may still be visible.
#### Custom logger
By default, this library logs to `globalThis.console`. You can also provide a custom logger.
Most logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.
When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages
below the configured level will not be sent to your logger.
```ts
import supermemory from 'supermemory';
import pino from 'pino';
const logger = pino();
const client = new supermemory({
logger: logger.child({ name: 'supermemory' }),
logLevel: 'debug', // Send all messages to pino, allowing it to filter
});
```
### Making custom/undocumented requests
This library is typed for convenient access to the documented API. If you need to access undocumented
endpoints, params, or response properties, the library can still be used.
#### Undocumented endpoints
To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
Options on the client, such as retries, will be respected when making these requests.
```ts
await client.post('/some/path', {
body: { some_prop: 'foo' },
query: { some_query_arg: 'bar' },
});
```
#### Undocumented request params
To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
send will be sent as-is.
```ts
client.foo.create({
foo: 'my_param',
bar: 12,
// @ts-expect-error baz is not yet public
baz: 'undocumented option',
});
```
For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
extra param in the body.
If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
options.
#### Undocumented response properties
To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
the response object, or cast the response object to the requisite type. Like the request params, we do not
validate or strip extra properties from the response from the API.
### Customizing the fetch client
By default, this library expects a global `fetch` function is defined.
If you want to use a different `fetch` function, you can either polyfill the global:
```ts
import fetch from 'my-fetch';
globalThis.fetch = fetch;
```
Or pass it to the client:
```ts
import supermemory from 'supermemory';
import fetch from 'my-fetch';
const client = new supermemory({ fetch });
```
### Fetch options
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
```ts
import supermemory from 'supermemory';
const client = new supermemory({
fetchOptions: {
// `RequestInit` options
},
});
```
#### Configuring proxies
To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy options to requests:
```ts
import supermemory from 'supermemory';
import * as undici from 'undici';
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
const client = new supermemory({
fetchOptions: {
dispatcher: proxyAgent,
},
});
```
```ts
import supermemory from 'supermemory';
const client = new supermemory({
fetchOptions: {
proxy: 'http://localhost:8888',
},
});
```
```ts
import supermemory from 'npm:supermemory';
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
const client = new supermemory({
fetchOptions: {
client: httpClient,
},
});
```
## Frequently Asked Questions
## Semantic versioning
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
1. Changes that only affect static types, without breaking runtime behavior.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
3. Changes that we do not expect to impact the vast majority of users in practice.
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
We are keen for your feedback; please open an [issue](https://www.github.com/supermemoryai/sdk-ts/issues) with questions, bugs, or suggestions.
## Requirements
TypeScript >= 4.9 is supported.
The following runtimes are supported:
- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Deno v1.28.0 or higher.
- Bun 1.0 or later.
- Cloudflare Workers.
- Vercel Edge Runtime.
- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
- Nitro v2.6 or greater.
Note that React Native is not supported at this time.
If you are interested in other runtime environments, please open or upvote an issue on GitHub.

View file

@ -1,138 +0,0 @@
---
title: "Searching Memories"
description: "Learn how to search for and retrieve content from supermemory"
---
<Accordion title="Best Practices" defaultOpen icon="sparkles">
1. **Query Formulation**:
- Use natural language queries
- Include relevant keywords
- Be specific but not too verbose
2. **Filtering**:
- Use metadata filters for precision
- Combine multiple filters when needed
- Use appropriate thresholds
3. **Performance**:
- Set appropriate result limits
- Use specific document/chunk filters
- Consider response timing
</Accordion>
## Basic Search
To search through your memories, send a POST request to `/search`:
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/search?q=machine+learning+concepts&limit=10 \
--request GET \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY'
```
```typescript Typescript
await client.search.execute({
q: "machine learning concepts",
limit: 10,
});
```
```python Python
client.search.execute(
q="machine learning concepts",
limit=10
)
```
</CodeGroup>
The API will return relevant matches with their similarity scores:
```json
{
"results": [
{
"documentId": "doc_xyz789",
"chunks": [
{
"content": "Machine learning is a subset of artificial intelligence...",
"isRelevant": true,
"score": 0.85
}
],
"score": 0.95,
"metadata": {
"source": "web",
"category": "technology"
},
"title": "Introduction to Machine Learning"
}
],
"total": 1,
"timing": 123.45
}
```
## Search Parameters
```json
{
"q": "search query", // Required: Search query string
"limit": 10, // Optional: Max results (default: 10)
"documentThreshold": 0.5, // Optional: Min document score (0-1)
"chunkThreshold": 0.5, // Optional: Min chunk score (0-1)
"onlyMatchingChunks": false, // Optional: Skip context chunks
"docId": "doc_id", // Optional: Search in specific doc
"userId": "user_123", // Optional: Search in user's space
"includeSummary": false, // Optional: Include doc summaries
"filters": {
// Optional: Metadata filters
"AND": [
{
"key": "category",
"value": "technology"
}
]
},
"categoriesFilter": [
// Optional: Category filters
"technology",
"science"
]
}
```
## Search Response
The search response includes:
```json
{
"results": [
{
"documentId": "string", // Document ID
"chunks": [
{
// Matching chunks
"content": "string", // Chunk content
"isRelevant": true, // Is directly relevant
"score": 0.95 // Similarity score
}
],
"score": 0.95, // Document score
"metadata": {}, // Document metadata
"title": "string", // Document title
"createdAt": "string", // Creation date
"updatedAt": "string" // Last update date
}
],
"total": 1, // Total results
"timing": 123.45 // Search time (ms)
}
```
## Next Steps
Explore more advanced features in our [API Reference](/api-reference/search-memories/search-memories).

View file

@ -1,233 +0,0 @@
---
title: "supermemory Infinite Chat"
description: "Build chat applications with unlimited context using supermemory's intelligent proxy"
tag: "BETA"
---
import GettingAPIKey from '/snippets/getting-api-key.mdx';
supermemory Infinite Chat is a powerful solution that gives your chat applications unlimited contextual memory. It works as a transparent proxy in front of your existing LLM provider, intelligently managing long conversations without requiring any changes to your application logic.
<img
src="/images/infinite-context.png"
alt="Infinite Context Diagram"
className="rounded-lg shadow-lg"
/>
<Tabs>
<Tab title="Key Features">
<CardGroup cols={2}>
<Card title="Unlimited Context" icon="infinity" color="#4F46E5">
No more token limits - conversations can extend indefinitely
</Card>
<Card title="Zero Latency" icon="bolt" color="#10B981">
Transparent proxying with negligible overhead
</Card>
<Card title="Cost Efficient" icon="coins" color="#F59E0B">
Save up to 70% on token costs for long conversations
</Card>
<Card title="Provider Agnostic" icon="plug" color="#6366F1">
Works with any OpenAI-compatible endpoint
</Card>
</CardGroup>
</Tab>
</Tabs>
## Getting Started
To use the Infinite Chat endpoint, you need to:
### 1. Get a supermemory API key
<GettingAPIKey />
### 2. Add supermemory in front of any **OpenAI-Compatible** API URL
<CodeGroup>
```typescript Typescript
import OpenAI from "openai";
/**
* Initialize the OpenAI client with supermemory proxy
* @param {string} OPENAI_API_KEY - Your OpenAI API key
* @param {string} SUPERMEMORY_API_KEY - Your supermemory API key
* @returns {OpenAI} - Configured OpenAI client
*/
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: "https://api.supermemory.ai/v3/https://api.openai.com/v1",
headers: {
"x-api-key": process.env.SUPERMEMORY_API_KEY,
"x-sm-user-id": "Your_users_id"
},
});
```
```python Python
import openai
import os
# Configure the OpenAI client with supermemory proxy
openai.api_base = "https://api.supermemory.ai/v3/https://api.openai.com/v1"
openai.api_key = os.environ.get("OPENAI_API_KEY") # Your regular OpenAI key
openai.default_headers = {
"x-api-key": os.environ.get("SUPERMEMORY_API_KEY"), # Your supermemory key
}
# Create a chat completion with unlimited context
response = openai.ChatCompletion.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Your message here"}]
)
```
</CodeGroup>
## How It Works
<Steps>
<Step title="Transparent Proxying">
All requests pass through supermemory to your chosen LLM provider with zero latency overhead.
<img
src="/images/transparent-proxy.png"
alt="Transparent Proxy Diagram"
className="my-4 rounded-md shadow"
/>
</Step>
<Step title="Intelligent Chunking">
Long conversations are automatically broken down into optimized segments using our proprietary chunking algorithm that preserves semantic coherence.
</Step>
<Step title="Smart Retrieval">
When conversations exceed token limits (20k+), supermemory intelligently retrieves the most relevant context from previous messages.
</Step>
<Step title="Automatic Token Management">
The system intelligently balances token usage, ensuring optimal performance while minimizing costs.
</Step>
</Steps>
## Performance Benefits
<Accordion title="Reduced Token Usage" defaultOpen icon="coins">
Save up to 70% on token costs for long conversations through intelligent context management and caching.
</Accordion>
<Accordion title="Unlimited Context" icon="infinity">
No more 8k/32k/128k token limits - conversations can extend indefinitely with supermemory's advanced retrieval system.
</Accordion>
<Accordion title="Improved Response Quality" icon="sparkles">
Better context retrieval means more coherent responses even in very long threads, reducing hallucinations and inconsistencies.
</Accordion>
<Accordion title="Zero Performance Penalty" icon="bolt">
The proxy adds negligible latency to your requests, ensuring fast response times for your users.
</Accordion>
## Pricing
<Tabs>
<Tab title="Plans">
<div className="mt-4">
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div className="p-4 border rounded-lg">
<h3 className="text-lg font-bold">Free Tier</h3>
<p className="text-sm text-gray-600 dark:text-gray-300">100k tokens stored at no cost</p>
</div>
<div className="p-4 border rounded-lg">
<h3 className="text-lg font-bold">Standard Plan</h3>
<p className="text-sm text-gray-600 dark:text-gray-300">$20/month fixed cost after exceeding free tier</p>
</div>
<div className="p-4 border rounded-lg">
<h3 className="text-lg font-bold">Usage-Based</h3>
<p className="text-sm text-gray-600 dark:text-gray-300">Each thread includes 20k free tokens, then $1 per million tokens thereafter</p>
</div>
</div>
</div>
</Tab>
<Tab title="Comparison">
<div className="mt-4">
<table className="min-w-full divide-y divide-gray-200">
<thead>
<tr>
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Feature
</th>
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Free
</th>
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Standard
</th>
</tr>
</thead>
<tbody className="divide-y divide-gray-200">
<tr>
<td className="px-6 py-4 whitespace-nowrap text-sm">
Tokens Stored
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm">
100k
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm">
Unlimited
</td>
</tr>
<tr>
<td className="px-6 py-4 whitespace-nowrap text-sm">
Conversations
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm">
10
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm">
Unlimited
</td>
</tr>
</tbody>
</table>
</div>
</Tab>
</Tabs>
## Error Handling
<Note>
supermemory is designed with reliability as the top priority. If any issues occur within the supermemory processing pipeline, the system will automatically fall back to direct forwarding of your request to the LLM provider, ensuring zero downtime for your applications.
</Note>
Each response includes diagnostic headers that provide information about the processing:
| Header | Description |
| -------------------------------- | ---------------------------------------------------------------------- |
| `x-supermemory-conversation-id` | Unique identifier for the conversation thread |
| `x-supermemory-context-modified` | Indicates whether supermemory modified the context ("true" or "false") |
| `x-supermemory-tokens-processed` | Number of tokens processed in this request |
| `x-supermemory-chunks-created` | Number of new chunks created from this conversation |
| `x-supermemory-chunks-deleted` | Number of chunks removed (if any) |
| `x-supermemory-docs-deleted` | Number of documents removed (if any) |
If an error occurs, an additional header `x-supermemory-error` will be included with details about what went wrong. Your request will still be processed by the underlying LLM provider even if supermemory encounters an error.
## Rate Limiting
<Info>
Currently, there are no rate limits specific to supermemory. Your requests are subject only to the rate limits of your underlying LLM provider.
</Info>
## Supported Models
supermemory works with any OpenAI-compatible API, including:
<CardGroup cols={3}>
<Card title="OpenAI" icon="openai">
GPT-3.5, GPT-4, GPT-4o
</Card>
<Card title="Anthropic" icon="user-astronaut">
Claude 3 models
</Card>
<Card title="Other Providers" icon="plug">
Any provider with an OpenAI-compatible endpoint
</Card>
</CardGroup>

View file

@ -1,101 +0,0 @@
---
title: "Getting Started with Model Enhancement"
sidebarTitle: "Quickstart"
description: "Superpower your LLM in one line"
---
import GettingAPIKey from '/snippets/getting-api-key.mdx';
## Get your supermemory API key
<GettingAPIKey />
## Get your LLM provider's API key
Head to your LLM provider's dashboard and get your API key.
- [OpenAI](https://platform.openai.com/api-keys)
- [Gemini](https://aistudio.google.com/apikey)
- [Anthropic](https://console.anthropic.com/account/keys)
- [Groq](https://console.groq.com/keys)
## Choose your endpoint
<CodeGroup>
```bash OpenAI
https://api.supermemory.ai/v3/https://api.openai.com/v1/chat/completions
```
```bash Gemini
https://api.supermemory.ai/v3/https://generativelanguage.googleapis.com/v1beta/openai
```
```bash Anthropic
https://api.supermemory.ai/v3/https://api.anthropic.com/v1
```
```bash Groq
https://api.supermemory.ai/v3/https://api.groq.com/openai/v1
```
```bash Other provider
https://api.supermemory.ai/v3/<your-provider's-openai-endpoint>
```
</CodeGroup>
## Making your first request
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "x-api-key: $SUPERMEMORY_API_KEY" \
-H 'x-sm-user-id: user_id' \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "What is the capital of France?"}
]
}'
```
```
```
```typescript TypeScript
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: 'https://api.supermemory.ai/v3/https://api.openai.com/v1',
defaultHeaders: {
'x-api-key': process.env.SUPERMEMORY_API_KEY,
'x-sm-user-id': 'your-user-id'
}
});
const completion = await openai.chat.completions.create({
model: "gpt-4o",
/// you can also add user here
user: "user",
messages: [
{ role: "user", content: "What is the capital of France?" }
]
});
console.debug(completion.choices[0].message);
```
</CodeGroup>

View file

@ -1,119 +0,0 @@
---
title: "Identifying Users"
description: "Identifying users in supermemory"
---
You can enable built-in cross-conversational memory by sending supermemory a `x-sm-user-id`.
## How supermemory Identifies Users and conversations
supermemory will find the user ID in the following places (in order of priority):
### `x-sm-user-id` header
You can add a default header of x-sm-user-id with any client and model
### `user` in body
For models that support the `user` parameter in the body, such as OpenAI, you can also attach it to the body.
### `userId` in search params
You can also add `?userId=xyz` in the URL search parameters, incase the models don't support it.
## Conversation ID
If a conversation identifier is provided, You do not need to send the entire array of messages to supermemory.
```typescript
// if you provide conversation ID, You do not need to send all the messages every single time. supermemory automatically backfills it.
const client = new OpenAI({
baseURL:
"https://api.supermemory.ai/v3/https://api.openai.com/v1",
defaultHeaders: {
"x-supermemory-api-key":
"SUPERMEMORY_API_KEY",
"x-sm-user-id": `dhravya`,
"x-sm-conversation-id": "conversation-id"
},
})
const messages = [
{"role" : "user", "text": "SOme long thing"},
// .... 50 other messages
{"role" : "user", "text": "new message"},
]
const client.generateText(messages)
// Next time, you dont need to send more.
const messages2 = [{"role" : "user", "text": "What did we talk about in this conversation, and the one we did last year?"}]
const client.generateText(messages2)
```
## Implementation Examples
### Google Gemini
```typescript
const ai = new GoogleGenAI({ apiKey: "YOUR_API_KEY" });
async function main() {
const response = await ai.models.generateContent({
model: "gemini-2.0-flash",
contents: "Explain how AI works in a few words",
config: {
httpOptions: {
headers: {
'x-sm-user-id': "user_123"
}
}
},
});
console.debug(response.text);
}
```
### Anthropic
```typescript
const anthropic = new Anthropic({
apiKey: 'YOUR_API_KEY', // defaults to process.env["ANTHROPIC_API_KEY"]
});
async function main() {
const msg = await anthropic.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, Claude" }],
}, {
// Using headers
headers: {
'x-sm-user-id': "user_123"
}
});
console.debug(msg);
}
```
### OpenAI
```typescript
const openai = new OpenAI({
apiKey: "YOUR_API_KEY"
});
async function main() {
const completion = await openai.chat.completions.create({
messages: [
{ role: "user", content: "Hello, Assistant" }
],
model: "gpt-4o",
user: "user_123"
});
console.debug(completion.choices[0].message);
}
```

View file

@ -1,110 +0,0 @@
---
title: "Use Cases"
description: "What can you do with supermemory?"
mode: "wide"
---
Explore what you can build with supermemory:
<CardGroup cols="3">
<Card title="Chat with ____" icon="message-circle">
Quickly built apps to chat with:
• Your Twitter bookmarks \
• Your PDF documents \
• Your company documentation \
...and more\!
</Card>
<Card title="Smart Search" icon="search">
Search everything with AI:
• Product recommendations \
• Document similarity matching \
• Research paper analysis
...and more\!
</Card>
<Card title="Assistants & Agents" icon="chart-line">
Build agents with infinite context for:
• Email management \
• Meeting summarization \
• Calendar organization \
...and more\!
</Card>
<Card title="Second Brain" icon="brain">
Build your own second brain:
• Organize your notes, ideas, and resources
• Connect concepts across documents
• Never lose track of insights or inspiration
...and more\!
</Card>
<Card title="Content Writing & Brand Voice" icon="pencil-line">
For agencies and creators:
• Maintain consistent tone and style
• Analyze your brands unique voice
• Write with context-aware suggestions
...and more\!
</Card>
<Card title="Healthcare & Medical Records" icon="hospital">
For clinics, hospitals, and researchers:
• Securely summarize patient records
• Extract key info from medical history
• Support clinical decisions with AI
...and more\!
</Card>
<Card title="Community & Support Chatbots" icon="users">
For online communities and businesses:
• Powered by your chat or forum history
• Instant, accurate answers
• Reduce support load
...and more\!
</Card>
<Card title="Education & Study Tools" icon="book">
For students and educators:
• Flashcards and quizzes from your notes
• Search across textbooks and lectures
• Personalized study assistants
...and more\!
</Card>
<Card title="Legal & Compliance Search" icon="scale">
For law firms and compliance teams:
• Search through contracts and case law
• Extract clauses, obligations, and risks
• Keep up with regulatory changes
...and more\!
</Card>
<Card title="Enterprise Knowledge Hubs" icon="briefcase-business">
For companies and teams:
• Centralize all internal documentation
• Search across wikis, policies, and emails
• Onboard new hires faster
...and more\!
</Card>
</CardGroup>

View file

@ -1,67 +0,0 @@
---
title: "Why supermemory?"
description: "Learn the problems and challenges of building a memory layer, and how supermemory solves them!"
---
### The problem
...so you want to build your own memory layer. Let's go through your decision process:
<Steps>
<Step title="Let's choose a vector database">
<Card title="Found a vector database?">
- Oh no, it's way too expensive. Time to switch.
- Turns out it's painfully slow. Let's try another.
- Great, now it won't scale. Back to square one.
- The maintenance is a nightmare. Need something else.
</Card>
</Step>
<Step title="Now for the embedding model">
<Card title="Unless you have a PhD in AI, good luck figuring out:">
- Which model fits your use case
- What are the performance tradeoffs
- How to keep up with new releases
</Card>
</Step>
<Step title="Time to build the memory layer">
<CardGroup cols="1">
<Card title="So many types of content">
- Websites: How do you handle JavaScript? What about rate limits?
- PDFs: OCR keeps failing, text extraction is inconsistent
- Images: Need computer vision models now?
- Audio/Video: Transcription costs add up quickly
</Card>
</CardGroup>
</Step>
</Steps>
And in the middle of all this, you're wondering...
> "When will I actually ship my product?"
### The solution
If you're not a fan of reinventing the wheel, you can use supermemory.
<CardGroup cols="1">
<Card title="Affordable & Easy to Use" icon="banknote">
- Start for free, scale as you grow
- Simple API, deploy in minutes
- No complex setup or maintenance
- Clear, predictable pricing
</Card>
<Card title="Simple Connectors" icon="plug">
- Notion, Google Drive, Slack
- Web scraping and PDF processing
- Email and calendar sync
- Custom connector SDK
</Card>
<Card title="Production Ready" icon="activity">
- Enterprise-grade security
- Sub-200ms latency at scale
- Automatic failover and redundancy
- 99.9% uptime guarantee
</Card>
</CardGroup>
Stop reinventing the wheel. Focus on building your product while we handle the memory infrastructure.

View file

@ -1,34 +0,0 @@
Head to [supermemory's Developer Platform](https://console.supermemory.ai) built to help you monitor and manage every aspect of the API.
<Accordion title="Getting an API Key" icon="sparkles">
<Steps>
<Step title="Create an account" icon="circle-user">
An account will automatically be created on your first login.
![Dev Platform Login Pn](/images/dev-platform-login.png)
</Step>
<Step title="Create an API Key" icon="key">
<Steps>
<Step title="Navigate to API Keys">
![Dev Platform Api Keys Pn](/images/dev-platform-api-keys.png)
Click `Create API Key`
</Step>
<Step title="Choose Name and Expiry (Optional)">
![Dev Platform Create Key Pn](/images/dev-platform-create-key.png)
Click `Create`
</Step>
<Step title="Copy New Key">
![Dev Platform Copy Key Pn](/images/dev-platform-copy-key.png)
Click <Icon icon="clipboard" /> to copy
</Step>
</Steps>
</Step>
</Steps>
</Accordion>
Done\! You can now use your API key to authenticate requests to the supermemory API.
Next up, let's add your first memory.

View file

@ -1,74 +0,0 @@
---
title: 'About supermemory MCP'
description: 'Carry your memories with you, using supermemory MCP'
---
supermemory MCP is a lightweight **consumer-facing** component that allows you to carry your memories with you across any AI platform. It serves as a universal memory layer that enables Large Language Models (LLMs) to maintain persistent context and memories across different applications and sessions, solving the fundamental limitation of AI assistants forgetting everything between conversations.
## What supermemory MCP is and how it works
**supermemory MCP** functions as an open-source, universal memory system that bridges the gap between isolated AI applications through the Model Context Protocol (MCP). It operates as a **meta MCP server** that creates individual server instances for each user, providing seamless memory persistence across any MCP-compatible LLM client including ChatGPT, Claude, Windsurf, Cursor, and VS Code.
The system works by running as an MCP server that communicates with MCP-compatible clients, storing and retrieving contextual information through the robust supermemory API infrastructure. When users interact with any connected AI application, the system automatically captures relevant information and makes it available to all other connected platforms through **semantic search and intelligent retrieval**.
It is also a great example of how you can use supermemory to build your own consumer-facing applications.
<Card title="supermemory MCP code" icon="github" href="https://github.com/supermemoryai/supermemory-mcp">
Code behind the scenes
</Card>
### Key consumer benefits
- **No login requirements**: Access granted via unique, private URLs that serve as both identifier and API key
- **Completely free**: Fully functional hosted service available at no cost
- **One-command setup**: Single CLI installation: `npx install-mcp [URL] --client [CLIENT]`
- **Universal compatibility**: Works seamlessly across multiple LLM clients and platforms
### Core workflow process
1. User interacts with any MCP-compatible AI client
2. The client connects to supermemory MCP server via a unique, private URL
3. During conversations, relevant information is stored using the `addToSupermemory` action
4. When context is needed, the `searchSupermemory` action retrieves relevant memories
5. The AI assistant accesses this persistent context regardless of which platform is being used
## Building applications with supermemory
supermemory MCP demonstrates building consumer applications with supermemory through its **API-first architecture**. The system acts as a "customer" of the underlying supermemory API infrastructure, showcasing how developers can leverage the platform to create their own memory-enabled applications.
### Supported platforms
- **Claude Desktop**: Direct SSE connection support
- **Cursor IDE**: Global MCP server configuration via `~/.cursor/mcp.json`
- **Windsurf**: Seamless integration for AI-powered development
- **VS Code**: Compatible with various AI coding extensions
- **Cline/Roo-Cline**: Full MCP protocol support
- **Any MCP-compatible application**: Universal compatibility through standard protocol implementation
## Security and privacy considerations
### Security model
- **URL-based authentication**: Random URLs serve as access keys, eliminating traditional login complexity
- **Session isolation**: Complete user data separation through unique URL paths
- **Self-hosting option**: Full control over data and infrastructure for privacy-conscious users
- **No authentication overhead**: Simplified access without traditional username/password systems
### Privacy features
- **Data isolation**: User memories completely separated by unique URLs
- **Local control option**: Self-hosting capability for enterprise or sensitive use cases
- **Secure infrastructure**: Built on Cloudflare's enterprise-grade security platform
## Future developments and ecosystem
The project represents a **breakthrough in AI memory portability**, with ongoing developments including:
- **Infinite Chat API**: Enhanced inline memory management with conversation history
- **Expanded client support**: More MCP clients adding SSE connection capabilities
- **Enterprise features**: Advanced security and compliance options for business use
- **Integration expansion**: Potential connections to Google Drive, Notion, OneDrive, and other productivity platforms
supermemory MCP successfully demonstrates how to build compelling consumer-facing applications using supermemory's infrastructure, achieving massive adoption through exceptional user experience design combined with robust technical architecture. Its success validates the market demand for universal AI memory solutions and provides a compelling template for developers building their own memory-enabled applications.

View file

@ -1,67 +0,0 @@
---
title: 'Setup and usage'
description: 'How to set up and use supermemory MCP'
---
### Hosted setup (recommended)
1. **Visit** https://mcp.supermemory.ai
2. **Receive** automatically generated unique URL (e.g., `https://mcp.supermemory.ai/TN-IKxAcDdHWTJkMhtGLF/sse`)
3. **Select** your MCP client from the dropdown menu
4. **Copy** the generated installation command
5. **Run** the command: `npx install-mcp [YOUR_URL] --client [CLIENT_NAME]`
Or follow the client configuration example below.
### Self-hosted configuration
For users requiring complete data control:
1. **Obtain API key** from https://console.supermemory.ai
2. **Create `.env` file** with `SUPERMEMORY_API_KEY=your_key`
3. **Clone repository**: `git clone https://github.com/supermemoryai/supermemory-mcp.git`
4. **Configure MCP client** to connect to local server instance
### Client configuration example
1. For Clients that support `url` configuration:
```json
{
"mcpServers": {
"supermemory": {
"transport": "sse",
"url": "https://mcp.supermemory.ai/[USER_ID]/sse"
}
}
}
```
2. Using `supergateway` with `npx`:
```json
{
"command": "npx",
"args": ["-y", "supergateway", "--sse", "YOUR_URL"]
}
```
3. Using `supergateway` with `docker`:
The equivalent MCP command would be:
```json
{
"mcpServers": {
"supermachineExampleDocker": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"supercorp/supergateway",
"--sse",
"YOUR_SUPERMEMORY_URL"
]
}
}
}
```

View file

@ -1,48 +0,0 @@
---
title: 'Technical implementation details'
description: 'Technical implementation details of supermemory MCP'
---
The technical architecture prioritizes **simplicity and user experience** while maintaining robust functionality. Built as what the creators describe as "the simplest thing you'll see" - essentially a React Router application making fetch calls to the supermemory API - the entire system was developed and shipped in approximately 5 hours of actual work time.
### Architecture components
- **Backend API**: Built on top of the supermemory API (https://api.supermemory.ai/v3)
- **Transport Layer**: Uses Server-Sent Events (SSE) for real-time communication
- **Dynamic Server Generation**: Creates unique MCP server instances for each user via URL path parameters
- **Session Management**: Maintains complete user isolation through unique URLs
- **Infrastructure**: Hosted on Cloudflare using Durable Objects for persistent, long-running connections
The system leverages **Cloudflare's infrastructure** with CPU-based billing, making it highly efficient since memory connections spend most time waiting between interactions rather than actively processing, resulting in minimal CPU usage despite potentially running for millions of milliseconds.
## The two main components explained
### addToSupermemory action
This component **stores user information, preferences, and behavioral patterns** with sophisticated triggering mechanisms:
**Trigger methods:**
- **Explicit commands**: Direct user instructions like "remember this"
- **Implicit detection**: Automatic identification of significant user traits, preferences, or patterns during conversations
**Data types captured:**
- Technical preferences and details (e.g., "My primary programming language is Python")
- Project information and context (e.g., "I'm currently working on a project named 'Apollo'")
- User behaviors and emotional responses
- Personal facts, preferences, and decision-making patterns
- Rich context including technical details and examples
### searchSupermemory action
This component **retrieves relevant information** from stored memories using advanced search capabilities:
**Activation triggers:**
- Explicit user requests for historical information
- Contextual situations where past user choices would be helpful for current decisions
- Automatic context enhancement based on conversation flow
**Search capabilities:**
- **Semantic matching**: Finds relevant details across related experiences using vector search
- **Pattern recognition**: Identifies behavioral patterns and preferences
- **Cross-session retrieval**: Accesses memories from previous conversations and platforms
- **Intelligent filtering**: Returns most relevant context based on current conversation needs

View file

@ -26,29 +26,20 @@ Choose **one** of the following approaches (they cannot be used together):
The infinite chat provider allows you to connect to various LLM providers with supermemory's context management.
```typescript
import { createSupermemoryInfiniteChat } from '@supermemory/ai-sdk'
import { generateText } from 'ai'
// Using a named provider
const supermemory = createSupermemoryInfiniteChat('your-supermemory-api-key', {
providerName: 'openai',
providerApiKey: 'your-openai-api-key',
headers: {
// Optional additional headers
}
})
// Using a custom provider URL
const supermemory = createSupermemoryInfiniteChat('your-supermemory-api-key', {
providerUrl: 'https://your-custom-provider.com/v1/chat/completions',
providerApiKey: 'your-provider-api-key',
const supermemoryOpenai = createOpenAI({
baseUrl: 'https://api.supermemory.ai/v3/https://api.openai.com/v1',
apiKey: 'your-provider-api-key',
headers: {
// Optional additional headers
'x-supermemory-api-key': 'supermemory-api-key',
'x-sm-conversation-id': 'conversation-id'
}
})
const result = await generateText({
model: supermemory('gpt-4-turbo'),
model: supermemoryOpenai('gpt-4-turbo'),
messages: [
{ role: 'user', content: 'Hello, how are you?' }
]
@ -58,35 +49,37 @@ const result = await generateText({
### Complete Infinite Chat Example
```typescript
import { createSupermemoryInfiniteChat } from '@supermemory/ai-sdk'
import { generateText } from 'ai'
const supermemoryApiKey = process.env.SUPERMEMORY_API_KEY!
const openaiApiKey = process.env.OPENAI_API_KEY!
// Initialize infinite chat provider
const supermemory = createSupermemoryInfiniteChat(supermemoryApiKey, {
providerName: 'openai',
providerApiKey: openaiApiKey,
headers: {}
const supermemoryOpenai = createOpenAI({
baseUrl: 'https://api.supermemory.ai/v3/https://api.openai.com/v1',
apiKey: 'your-provider-api-key',
headers: {
'x-supermemory-api-key': 'supermemory-api-key',
'x-sm-conversation-id': 'conversation-id'
}
})
async function chat(userMessage: string) {
const result = await generateText({
model: supermemory('gpt-4-turbo'),
model: supermemoryOpenai('gpt-4-turbo'),
messages: [
{
role: 'system',
content: 'You are a helpful assistant with unlimited context.'
{
role: 'system',
content: 'You are a helpful assistant with unlimited context.'
},
{
role: 'user',
content: userMessage
{
role: 'user',
content: userMessage
}
]
// No tools - infinite chat handles context automatically
})
return result.text
}
```
@ -126,7 +119,7 @@ const result = await generateText({
...supermemoryTools('your-supermemory-api-key', {
// Optional: specify a base URL for self-hosted instances
baseUrl: 'https://api.supermemory.com',
// Use either projectId OR containerTags, not both
projectId: 'your-project-id',
// OR
@ -150,13 +143,13 @@ async function chatWithTools(userMessage: string) {
const result = await generateText({
model: openai('gpt-4-turbo'), // Use standard provider
messages: [
{
role: 'system',
content: 'You are a helpful assistant with access to user memories.'
{
role: 'system',
content: 'You are a helpful assistant with access to user memories.'
},
{
role: 'user',
content: userMessage
{
role: 'user',
content: userMessage
}
],
tools: {
@ -166,7 +159,7 @@ async function chatWithTools(userMessage: string) {
},
maxToolRoundtrips: 5
})
return result.text
}
```
@ -177,10 +170,10 @@ async function chatWithTools(userMessage: string) {
interface SupermemoryConfig {
// Optional: Base URL for API calls (default: https://api.supermemory.com)
baseUrl?: string
// Container tags for organizing memories (cannot be used with projectId)
containerTags?: string[]
// Project ID for scoping memories (cannot be used with containerTags)
projectId?: string
}
@ -234,10 +227,10 @@ const fetchResult = await tools.fetchMemory.execute({
For more flexibility, you can import and use individual tools:
```typescript
import {
searchMemoriesTool,
addMemoryTool,
fetchMemoryTool
import {
searchMemoriesTool,
addMemoryTool,
fetchMemoryTool
} from '@supermemory/ai-sdk'
const searchTool = searchMemoriesTool('your-api-key', {
@ -310,4 +303,4 @@ MIT
## Support
Email our [24/7 Founder/CEO/Support Executive](dhravya@supermemory.com)
Email our [24/7 Founder/CEO/Support Executive](dhravya@supermemory.com)

View file

@ -7,13 +7,13 @@ This package provides supermemory tools for both AI SDK and OpenAI function call
## Installation
```bash
npm install @supermemory/ai-sdk
npm install @supermemory/tools
# or
bun add @supermemory/ai-sdk
bun add @supermemory/tools
# or
pnpm add @supermemory/ai-sdk
pnpm add @supermemory/tools
# or
yarn add @supermemory/ai-sdk
yarn add @supermemory/tools
```
## Usage
@ -152,4 +152,4 @@ Adds a new memory to the system.
```env
SUPERMEMORY_API_KEY=your_supermemory_api_key
SUPERMEMORY_BASE_URL=https://your-custom-url # optional
```
```