JavaScript and TypeScript are served by the same npm package. TypeScript is not a separate SDK and needs no separate installation: types ship with the package.
Python SDK
Requirements
- Python 3.11+: the SDK uses modern Python features including
asyncio, type hints, and structural pattern matching - pip 21.0+, Poetry 1.2+, or uv 0.4+ for package management
- An active Synap account: Sign up at synap.maximem.ai
Install
The package name uses a hyphen (
maximem-synap) but the import name uses an underscore (maximem_synap). Install with pip install maximem-synap, then from maximem_synap import MaximemSynapSDK in your code.httpx: async HTTP client used by the SDKpydantic: data validation and settings managementcryptography: credential handling- Additional transport dependencies pulled in automatically; no extra install needed.
Configure
Set your API key. See environment variables for all options.Verify
Run this script to verify your installation and connectivity:verify_synap.py
Async-first design
The Python SDK is async-first. All SDK methods that interact with Synap Cloud are For frameworks that already run an event loop (FastAPI, Sanic, aiohttp), use the SDK directly without wrapping.
async and must be called with await inside an async function.If you’re integrating with a synchronous codebase, use asyncio.run() to bridge the gap:JavaScript and TypeScript SDK
One package serves both:@maximem/synap-js-sdk. Type definitions ship with it, so TypeScript is typed the moment you install and needs no extra step.
Requirements
- Node.js 20+
- An active Synap account: Sign up at synap.maximem.ai
Install
Writing plain JavaScript, not TypeScript?
Writing plain JavaScript, not TypeScript?
Nothing changes. There is no separate JavaScript build, no
typescript
dependency to add, no tsconfig.json to create, and no compile step.
npm install and you are done.The bundled type definitions are inert at runtime, so they cost you nothing.
Most editors read them anyway, which means you get autocomplete and inline
parameter help in a plain .js file without opting into TypeScript.Use require() or import depending on how your project is written; see
module format. The examples below are labelled ts, but
they use no type annotations, so they are valid JavaScript exactly as written.
Swap the import line for a require() if your project is CommonJS. The one
section that is genuinely TypeScript-only is
exported types, which you can skip.Configure
Set your API key. See environment variables for all options.client_id and instance_id are resolved from the key when you call initialize(), so you do not need to plumb them separately.
Verify
Check the install and your credentials in one go:verify-synap.mjs
Module format
The package ships both ES modules and CommonJS, with types for each. Import it whichever way your project is written:Because a dual-format dependency graph can hand you two copies of the same class, every error also carries a stable
.code string. Branch on error.code rather than instanceof when you cannot guarantee a single copy. See typed error handling.Where it runs
The anticipation stream needs raw TCP and
node:http2, which Edge runtimes and Workers do not provide. Importing the SDK there is safe: the stream lives behind the @maximem/synap-js-sdk/grpc subpath and is only ever loaded lazily, so it never enters an Edge bundle.
Bun and Deno have both, so the stream is plausible on each, but bidirectional streaming has not been verified there.
tsconfig requirements
None specific to this package. It is verified against TypeScript 5.7 and 7.0 withmoduleResolution set to node, node16, nodenext and bundler, and it typechecks under strict, exactOptionalPropertyTypes and noUncheckedIndexedAccess.
A minimal configuration:
tsconfig.json
Next: using it
Installation is done. For the client surface, the cross-scope fetch, LLM tool definitions, typed errors and the anticipation stream, see Using the JavaScript SDK.Vercel AI SDK Middleware
If your application uses the Vercel AI SDK, the@maximem/synap-vercel-adk middleware wraps any compatible model and injects Synap context automatically, with no changes to your existing generateText / streamText calls.
ai >=3.0.0 as a peer dependency. TypeScript types are included.
It runs on the Next.js Edge Runtime for context fetching and memory writes, which use
fetch only. You do not need to pin export const runtime = "nodejs" for those.The one exception is the optional gRPC anticipation stream, which needs @grpc/grpc-js and therefore a Node.js runtime. It is loaded lazily, so importing the package on Edge is safe; only enabling the stream requires Node.js.Environment variables
The SDK reads configuration from environment variables. This is the recommended approach for production deployments.All languages
string
required
Your API key for SDK authentication. Generated in the Dashboard: navigate to your instance and click Generate API Key. Starts with
synap_.string
Records which instance you are on. Optional; the dashboard gives you it alongside the API key so you can paste both in one go. Starts with
inst_.string
Logging verbosity for the SDK. Accepts standard logging levels:
DEBUG, INFO, WARNING, ERROR, CRITICAL. Defaults to INFO.string
API base URL. Set it when you run a self-hosted deployment; otherwise leave it unset and the SDK uses Synap Cloud.
string
Optional. Skips one identity round trip during
initialize(). Resolved from the API key when omitted.Anticipation stream
Only needed when you use the anticipation stream, and only when your deployment is not the default.string
Stream host. Defaults to the same deployment your API calls go to.
string
Stream port. Defaults to
443.string
Set to
0 for a plaintext connection. Only sensible against a local or tunnelled deployment.Setting them
Credential storage
The SDK reads the API key fromSYNAP_API_KEY (or the api_key / apiKey constructor argument) on every startup. There is no on-disk credential cache; the key lives wherever your secrets manager or environment configuration puts it.
Troubleshooting
Python: ImportError: No module named 'maximem_synap'
Python: ImportError: No module named 'maximem_synap'
Verify the package is installed in your active Python environment:If using a virtual environment, make sure it’s activated. If using Poetry, prefix commands with
poetry run.JS/TS: No Synap API key found
JS/TS: No Synap API key found
The client could not resolve a credential. Set
SYNAP_API_KEY in the
environment, or pass apiKey to the constructor:JS/TS: Cannot find module '@grpc/grpc-js'
JS/TS: Cannot find module '@grpc/grpc-js'
The anticipation stream needs two optional peers that are not installed by
default, because most applications never open a stream:Everything except
instance.listen() works without them.JS/TS: the stream will not open on Edge or Workers
JS/TS: the stream will not open on Edge or Workers
It cannot. The stream needs raw TCP and
node:http2, which those runtimes
do not provide. Context fetching and memory writes work there normally; only
the stream is unavailable. See where it runs.JS/TS: requests are going to the wrong deployment
JS/TS: requests are going to the wrong deployment
Check
SYNAP_BASE_URL. When it is unset the SDK uses Synap Cloud, and an
explicit baseUrl in the constructor beats the environment. If you point
the HTTP base at one deployment, point SYNAP_GRPC_HOST at the same one.Connection refused or timeout during initialization
Connection refused or timeout during initialization
Check that:
- Your outbound network connectivity to Synap Cloud is permitted.
- If behind a corporate proxy, configure
HTTPS_PROXYin your environment. - Your
SYNAP_API_KEYis correct and the key is active in the dashboard.
API key rejected
API key rejected
If the SDK reports an authentication failure:
- Confirm
SYNAP_API_KEYstarts withsynap_and is not wrapped in quotes in your shell - Check the key is still active in the Dashboard (Instance → API Keys)
- If the key was revoked, generate a new one and update your
.envor secrets manager
Next steps
Authentication
Configure API key authentication, multiple keys per instance, and key rotation.
Integration
Connect Synap to your application framework and infrastructure.
SDK Initialization
Explore all SDK initialization options, including custom credential providers.