Skip to main content

Provider Integration Documentation

Implementation guides for extending NeuroLink with new providers, new modalities, and new capability surfaces.

Two reading paths

This folder contains two kinds of document:

  1. Implementation journals (00-14) — the historical record of specific shipped features (DeepSeek/NIM/LM Studio/llama.cpp providers, voice/speech integration). Useful as concrete worked examples and when you want to know exactly what was done in a particular release.
  2. How-to guides (15-22 + CHECKLIST) — the canonical, generalized playbook for adding a new provider or modality of any kind. Use these when implementing something new.

If you're adding code today, start with CHECKLIST.md (decision tree → matching guide).


Quick decision tree

What are you adding?

├─ A new LLM / chat provider
│ → 15-adding-llm-provider.md

├─ A new voice handler
│ ├─ TTS (Text-to-Speech) → 16-adding-tts-provider.md
│ ├─ STT (Speech-to-Text) → 17-adding-stt-provider.md
│ └─ Realtime (bidirectional) → 18-adding-realtime-provider.md

├─ A new video provider
│ → 19-adding-video-provider.md (REQUIRES one-time refactor first)

├─ A new image-gen provider or model
│ → 20-adding-image-gen-provider.md

├─ An entirely new modality (Avatar, Music, 3D, …)
│ → 21-adding-new-modality.md

└─ A multi-modal provider (Replicate, Together AI, …)
→ 22-adding-multimodal-provider.md

For a fast pre-flight checklist you can paste into your PR description, see CHECKLIST.md.


Document index

How-to guides (the playbook)

DocScopeWhen to read
15-adding-llm-provider.mdNew chat / text-generation providerAdding xAI Grok, Groq, Cohere, Together, Fireworks, Perplexity, Cloudflare Workers AI, etc.
16-adding-tts-provider.mdNew text-to-speech handlerAdding Fish Audio, Cartesia, Murf, PlayHT, Sarvam TTS
17-adding-stt-provider.mdNew speech-to-text handlerAdding AssemblyAI, Gladia, Rev.ai, Speechmatics
18-adding-realtime-provider.mdNew bidirectional voice handlerAdding Hume EVI, Resemble.ai realtime, custom WebSocket protocols
19-adding-video-provider.mdNew video-generation provider (incl. one-time refactor)Adding Kling, Runway, Pika, Luma, Wan-Alpha (via Replicate)
20-adding-image-gen-provider.mdNew image-gen provider or modelAdding Stability, FLUX direct, Ideogram, Recraft, or new models on existing providers
21-adding-new-modality.mdA brand-new modality categoryAdding Avatar (D-ID, HeyGen), Music (Beatoven, Lyria, ElevenLabs Music), 3D, SFX, etc.
22-adding-multimodal-provider.mdA provider spanning multiple modalitiesAdding Replicate, Together AI, Fireworks AI, Cloudflare Workers AI
CHECKLIST.mdPasteable PR checklistEvery PR — pick the §A-§H section that matches
SAFETY-PRIMITIVES.mdCross-cutting safety helpers referenceWhenever you download external URLs, log responses, or wrap streaming with OTel spans

Implementation journals (the worked examples)

These document specific shipped features and serve as concrete references for the patterns generalized in 15-22.

DocTopicCommit
00-architecture.mdPatterns common to every provider (BaseProvider, Factory + Registry, providerConfig, AI SDK wrapping, type-engineering rules)
01-shared-changes.mdMaster diff list for everything outside src/lib/providers/<name>.ts (worked example for the four cloud-OpenAI-compat providers)c829f4de
02-deepseek.mdDeepSeek implementation — simplest cloud port; first to readc829f4de
03-nvidia-nim.mdNVIDIA NIM implementation — most complex (extra body params, retry-on-400)c829f4de
04-lm-studio.mdLM Studio implementation — local server with model auto-discoveryc829f4de
05-llamacpp.mdllama.cpp implementation — clone of LM Studio with /health validationc829f4de
06-testing.mdTest additions and validation strategy for the four cloud providersc829f4de
07-implementation-order.mdOrdered task list, milestone gates, risk mitigationsc829f4de
08-feature-matrix.mdCapability matrix across the four cloud providersc829f4de
09-test-suite-spec.mdThe test/continuous-test-suite-new-providers.ts specificationc829f4de
10-test-results-final.mdFinal test results for the four cloud providersc829f4de
11-test-failure-investigation.mdFailure-investigation trail (the 80% input-budget bug, etc.)c829f4de
12-pr-analysis.mdPR analysisc829f4de
13-code-review.mdCode review notesc829f4de
14-voice-speech-integration.mdVoice/speech integration journal — TTS (3 providers), STT (4 providers), Realtime (2 providers)27a31c32

Critical rules (quick reference)

These rules are baked into the codebase and enforced by ESLint. Violating any of them blocks CI.

#RuleEnforced by
1Dynamic imports inside the registry only(convention; failure surfaces as circular-dep error at build)
2Types in canonical src/lib/types/ locationneurolink/no-local-type-alias
5Backward compatibility — public API additive only(convention; reviewer-enforced)
6formatProviderError must return, never throw(convention; loud at runtime)
7Use type, never interfaceneurolink/no-interface
8No "Types" suffix in type filenamesneurolink/no-types-suffix-filename
9Globally unique exported type names (use prefixes)neurolink/unique-type-names
10Types barrel uses export * onlyneurolink/types-barrel-exports-only
11No local types/ directoriesneurolink/no-local-types-folder
12No type re-exports from non-type filesneurolink/no-type-export-outside-types
13Internal types imported from barrel onlyneurolink/barrel-type-imports

Full text and rationale lives in the project CLAUDE.md. The how-to guides (15-22) reference these rules where relevant.


Reference commits

When in doubt, look at how it was done before:

CommitAddsBest for
c829f4deDeepSeek, NVIDIA NIM, LM Studio, llama.cppMulti-provider PRs that share infrastructure (§01-shared-changes pattern)
27a31c32Voice/Speech (3 TTS + 4 STT + 2 Realtime)New modality with multiple providers (handler-registry pattern)
8918f8efLiteLLM providerSingle-provider PR with full documentation (41 files)
3041d26fOpenAI CompatibleMinimal-comprehensive provider (cleanest 11-file diff)
9ef4ebeeAmazon SageMakerMulti-file provider directory (only when truly needed)

Status of major shipped work

AreaStatus
LLM providers (21+)Stable — xAI Grok, Groq, Cohere, Together AI, Fireworks, Perplexity, Cloudflare, Voyage, Jina, Replicate + all previous cloud/local
TTS handlers (6)Stable — Google, OpenAI, ElevenLabs, Azure, Cartesia, Fish Audio
STT handlers (4)Stable — OpenAI Whisper, Deepgram, Google, Azure
Realtime handlers (2)Registered, partial SDK surface — OpenAI Realtime, Gemini Live
Image gen (7+ providers)Stable — Stability AI, Ideogram, Recraft, OpenAI image-gen, plus Vertex / Anthropic / Bedrock pathways (see 20-adding-image-gen-provider.md)
Video gen (4 providers)Stable — Vertex Veo, Kling (via PiAPI), Runway, Replicate (see 19-adding-video-provider.md)
AvatarImplemented — D-ID, HeyGen, Replicate MuseTalk (see 21-adding-new-modality.md)
MusicImplemented — Google Lyria, Beatoven, ElevenLabs Music, Replicate MusicGen (see 21-adding-new-modality.md)
Multi-modal providersImplemented — Replicate spans LLM + video + avatar + music (see 22-adding-multimodal-provider.md)

If you're picking up any of the "Not implemented" items, the matching how-to guide has the full plan.


Need help?