Skip to main content
Memory Crystal implements tier-based rate limiting to ensure fair usage and protect infrastructure. Limits are per-user and per-minute.

Tier Limits

Rate limits are enforced per user, per minute, based on their subscription tier.

Per-Endpoint Budgets

Different endpoints have different costs based on computational complexity:

Low Cost (1 credit)

  • GET /api/mcp/stats — no search
  • GET /api/knowledge-bases — list only
  • POST /api/mcp/recent-messages — retrieval only
  • POST /api/mcp/checkpoint — write only
  • POST /api/mcp/forget — delete only
  • POST /api/mcp/trace — lookup only

Medium Cost (5 credits)

  • POST /api/mcp/search-messages — lexical search
  • POST /api/mcp/capture — write + embedding
  • POST /api/knowledge-bases — create KB
  • POST /api/knowledge-bases/:id/import — batch import (cost scales with chunk count)

High Cost (10 credits)

  • POST /api/mcp/recall — vector search (embedding query)
  • POST /api/knowledge-bases/:id/query — KB vector search
  • POST /api/mcp/edit — update + re-embedding
What does this mean? A Free tier user (100 req/min) can make:
  • 100 calls to low-cost endpoints per minute
  • 20 calls to medium-cost endpoints per minute
  • 10 calls to high-cost endpoints per minute
Costs are counted against a shared pool, so a mix of calls reduces overall throughput.

Rate Limit Headers

Every response includes rate limit information:

Handling Rate Limits

Response: 429 Too Many Requests

When you exceed the limit:

Retry Strategy

Implement exponential backoff:

Python Example

Optimization Strategies

1. Batch Requests

Instead of 10 individual recall requests, batch them:

2. Use Low-Cost Endpoints

Prefer crystal_recent over crystal_recall when recent context is sufficient:

3. Cache Results Locally

Don’t repeat the same query within a minute:

4. Increase Tier

If you consistently hit limits:

Monitoring Rate Limit Usage

Check Current Usage

Parse Headers After Each Request

Output:

Set up Alerts

Monitor X-RateLimit-Remaining in your logs. Alert when it falls below 20% of limit:

Burst Handling

Memory Crystal allows brief bursts above the per-minute average:
  • Soft limit (90% of tier): Warning only
  • Hard limit (100% of tier): Rate-limited (429)
This means you can have short spikes without penalty, but sustained high usage will hit the limit.

Special Cases

Shared API Keys

If multiple users or services share one API key:
  1. All requests count against the same tier limit
  2. One heavy user can starve others
  3. Solution: Use separate API keys per user/service

Batch Imports

Large imports are rate-limited per-chunk:

Contact Support

If you need:
  • Higher rate limits for legitimate use
  • Whitelist/priority handling for batch jobs
  • Custom SLA agreements
Reach out to support@memorycrystal.com with:
  • Your tier
  • Current usage pattern
  • Intended use case
  • Requested limits