mem0ai/mem0

feat(ts-sdk): add xAI (Grok) LLM provider

Open

#5760 aperta il 23 giu 2026

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Python (6343 fork)batch import
enhancementgood first issuehelp wantedsdk-typescriptsize:S

Metriche repository

Star
 (55.741 star)
Metriche merge PR
 (Merge medio 6g 11h) (208 PR mergiate in 30 g)

Descrizione

Summary

The Python SDK supports xAI (Grok) as an LLM provider, but the TypeScript OSS SDK (mem0ai/oss) does not. Add it to bring the TS SDK to parity.

Python reference mem0/llms/xai.py
Registered in (Python) mem0/utils/factory.py (LLMFactory)
Target file (TypeScript) mem0-ts/src/oss/src/llms/xai.ts
Suggested implementation OpenAI-compatible — subclass OpenAILLM with baseURL=https://api.x.ai/v1.

Requirements

  • Implement XAILLM in mem0-ts/src/oss/src/llms/xai.ts, extending LLM (mem0-ts/src/oss/src/llms/base.ts) and mirroring the Python provider's behavior (generateResponse / generateChat).
  • Register the "xai" provider in mem0-ts/src/oss/src/utils/factory.ts (LLMFactory).
  • Add config typing in mem0-ts/src/oss/src/types/.
  • Add a unit test under mem0-ts/src/oss/src/tests/.
  • No new dependency — reuse the existing openai client with a custom baseURL.
  • Update docs under docs/ if this provider is user-facing.

Reference pattern

Mirror an existing TS provider: llms/deepseek.ts (OpenAI-compatible) or llms/openai.ts.

Notes

xAI's Grok API is OpenAI-compatible. Match the default model in mem0/llms/xai.py.


Part of the TypeScript ↔ Python SDK provider-parity effort. One provider per issue (atomic).

Guida contributor