Back to Supermemory

Getting Started with Model Enhancement

apps/docs/model-enhancement/getting-started.mdx

latest1.9 KB
Original Source

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.

Choose your endpoint

<CodeGroup>
bash
https://api.supermemory.ai/v3/https://api.openai.com/v1/chat/completions
bash
https://api.supermemory.ai/v3/https://generativelanguage.googleapis.com/v1beta/openai
bash
https://api.supermemory.ai/v3/https://api.anthropic.com/v1
bash
https://api.supermemory.ai/v3/https://api.groq.com/openai/v1
bash
https://api.supermemory.ai/v3/<your-provider's-openai-endpoint>
</CodeGroup>

Making your first request

<CodeGroup>
bash
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
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>