Welcome to the NeuroLink Cookbook! This collection of recipes provides practical, copy-paste ready solutions for common use cases and challenges when building with NeuroLink.
Each recipe follows a consistent structure:
- Problem: What challenge does this solve?
- Solution: High-level approach
- Code: Complete, working TypeScript example
- Explanation: Step-by-step breakdown
- Variations: Alternative approaches
- See Also: Related recipes and documentation
- Basic Streaming - Stream AI responses in real time with the
result.streampattern - Multimodal Images - Send images to vision models for analysis, OCR, and comparison
- Provider Switching - Switch providers at runtime, compare outputs, and implement fallback
- Embeddings Basics - Generate embeddings, compare similarity, and build semantic search
- Streaming with Retry Logic - Handle network interruptions and implement automatic retry for streaming responses
- Error Recovery Patterns - Graceful degradation and error handling strategies
- Multi-Provider Fallback - Automatically switch providers when one fails
- Cost Optimization - Minimize token usage and API costs
- Rate Limit Handling - Manage rate limits across providers
- Batch Processing - Efficiently process multiple requests
- Context Window Management - Handle large conversations within token limits
- Conversation Summarization - Automatically summarize long conversations
- Structured Output with JSON Schema - Extract structured data with type safety
- Tool Chaining - Chain multiple MCP tool calls together
- AutoResearch Quickstart - Set up an autonomous AI experiment loop in under 5 minutes
- Find your use case: Browse the categories above
- Copy the code: All examples are production-ready
- Customize: Adapt the code to your specific needs
- Test: Verify the solution works in your environment
Most recipes assume you have:
- NeuroLink installed:
npm install @juspay/neurolink - At least one provider configured (API keys in
.env) - Basic TypeScript/JavaScript knowledge
Found a common pattern not covered here? Contribute a recipe!