Skip to content

Getting started

From zero to a streaming, memory-backed chat response in three requests.

Updated View as Markdown

Truememory’s AI Gateway is OpenAI-compatible: if your code can call OpenAI, pointing it at Truememory is a base-URL change. This page gets you from nothing to a streaming, memory-backed response.

1. Get your two inputs

  • Base URL — Truememory is deployed per environment; the docs use the placeholder https://your-tie-host. Ask whoever operates your deployment for your gateway URL.
  • A credential — either a user token (sign a user in through Truememory Auth and use the returned JWT) or, from a backend, the shared service secret (AUTH_SECRET, issued by the platform team) with X-On-Behalf-Of to act for a user.

2. First request

curl -X POST https://your-tie-host/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{
    "model": "anthropic/claude-sonnet-4-6",
    "messages": [{"role": "user", "content": "Hello! Who are you?"}]
  }'

That’s a complete integration: the response comes back in OpenAI’s shape, and if the user has an active persona or existing memory, both were injected automatically — you never manage them per request.

3. Stream it

Add "stream": true and read Server-Sent Events; content arrives in choices[0].delta.content and the stream ends with data: [DONE]:

curl -N -X POST https://your-tie-host/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{
    "model": "anthropic/claude-sonnet-4-6",
    "stream": true,
    "messages": [{"role": "user", "content": "Tell me a two-line poem."}]
  }'

4. Keep the conversation

Pass a thread_id (any stable string you generate) and Truememory persists the conversation so follow-up requests have context:

curl -X POST https://your-tie-host/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{
    "model": "anthropic/claude-sonnet-4-6",
    "thread_id": "0f2e5f3a-demo-thread",
    "messages": [{"role": "user", "content": "Remember this number: 42"}]
  }'

Where to next

You want Go to
Every request parameter, tools, caching, compression Unified API
A named AI companion with a personality Personas
Long-term memory across sessions and apps Agent Memory
Ground answers in your documents Knowledge Packs
Speech, images, real-time voice Audio · Images · Voice
Which models you can use Model catalog
Navigation

Type to search…

↑↓ navigate↵ selectEsc close