mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-05-17 12:20:04 +00:00
99 lines
2 KiB
Text
99 lines
2 KiB
Text
---
|
|
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-supermemory--api-key: $SUPERMEMORY_API_KEY" \
|
|
-H 'x-sm-user-id: user_id' \
|
|
-d '{
|
|
"model": "gpt-5",
|
|
"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-supermemory-api-key': process.env.SUPERMEMORY_API_KEY,
|
|
'x-sm-user-id': 'your-user-id'
|
|
}
|
|
});
|
|
|
|
const completion = await openai.chat.completions.create({
|
|
model: "gpt-5",
|
|
/// 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>
|