{"slug": "getting-started-with-neurolink-your-first-ai-app-in-5-minutes", "title": "Getting Started with NeuroLink: Your First AI App in 5 Minutes", "summary": "NeuroLink, an AI SDK from Juspay, enables developers to add AI capabilities to applications in under five minutes with just a few lines of TypeScript. The SDK abstracts provider complexities, supporting OpenAI, Google, Anthropic, and others, and requires no prior AI experience. A simple generate() call returns AI responses along with token usage and response time metrics.", "body_md": "You've heard about AI SDKs but aren't sure where to start. Let's fix that.\n\nImagine you want to add AI to your app -- maybe a chatbot, maybe a smart search feature. You might think you need days of setup, a PhD in machine learning, and three different API accounts. The truth is, you can get a working AI call running in under 5 minutes with NeuroLink. No prior AI experience needed.\n\nNeuroLink (`@juspay/neurolink`\n\n) handles all the complicated provider stuff behind the scenes. You just write a few lines of TypeScript, and it works with any major AI provider -- OpenAI, Google, Anthropic, and more.\n\nIn this post, you will learn:\n\n``` php\nflowchart LR\n    A[\"npm install<br/>@juspay/neurolink\"] --> B[\"Configure<br/>.env API key\"]\n    B --> C[\"Import &<br/>Instantiate\"]\n    C --> D[\"Call<br/>generate()\"]\n    D --> E[\"AI Response\"]\n    style A fill:#0f4c75,stroke:#1b262c,color:#fff\n    style B fill:#0f4c75,stroke:#1b262c,color:#fff\n    style C fill:#3282b8,stroke:#1b262c,color:#fff\n    style D fill:#3282b8,stroke:#1b262c,color:#fff\n    style E fill:#00b4d8,stroke:#1b262c,color:#fff\n```\n\nBefore you begin, make sure you have the following:\n\n`node --version`\n\n.\n\nTip:Not sure which provider to pick? Think of it like choosing a phone carrier -- they all do the same basic thing, just with different pricing. OpenAI (`gpt-4o`\n\n) has the biggest community, while Google AI Studio (`gemini-2.5-flash`\n\n) lets you get started for free.\n\n{: .prompt-tip }\n\nStart with a fresh directory and initialize a Node.js project configured for ES modules:\n\n```\nmkdir my-ai-app && cd my-ai-app\nnpm init -y\n```\n\nUpdate your `package.json`\n\nto enable ES module support:\n\n```\n{\n  \"name\": \"my-ai-app\",\n  \"type\": \"module\",\n  \"scripts\": {\n    \"start\": \"npx tsx src/index.ts\"\n  }\n}\n```\n\nInstall the SDK with a single command:\n\n```\nnpm install @juspay/neurolink\n```\n\nIf you are using TypeScript (recommended), also install tsx for running TypeScript directly:\n\n```\nnpm install -D tsx typescript\n```\n\nCreate a `tsconfig.json`\n\nat the project root:\n\n```\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"bundler\",\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"outDir\": \"./dist\"\n  },\n  \"include\": [\"src/**/*\"]\n}\n```\n\nCreate a `.env`\n\nfile at the project root with your provider's API key. NeuroLink auto-loads dotenv, so no additional configuration is needed:\n\n```\nOPENAI_API_KEY=sk-your-key-here\n\n# For Anthropic\nANTHROPIC_API_KEY=sk-ant-your-key-here\n\n# For Google AI Studio\nGOOGLE_AI_API_KEY=your-google-key-here\n\n# For Google Vertex AI\nVERTEX_PROJECT_ID=your-gcp-project-id\n```\n\nYou only need one provider key to get started. Add more later when you want to explore multi-provider features.\n\nWarning:Your`.env`\n\nfile contains secret API keys -- treat it like a password. Never commit it to Git. Add`.env`\n\nto your`.gitignore`\n\nfile right away.\n\n{: .prompt-warning }\n\nCreate `src/index.ts`\n\nand write your first AI generation:\n\n``` js\nimport { NeuroLink } from '@juspay/neurolink';\n\nconst neurolink = new NeuroLink();\n\nconst result = await neurolink.generate({\n  input: { text: 'Explain quantum computing in simple terms' },\n  provider: 'openai',\n  model: 'gpt-4o'\n});\n\nconsole.log(result.content);\nconsole.log(`Tokens used: ${result.usage?.total}`);\nconsole.log(`Response time: ${result.responseTime}ms`);\n```\n\nRun it:\n\n```\nnpm start\n```\n\nThat is it. Five lines of meaningful code, and you have a working AI application.\n\nLet us break down what each part does.\n\n** GenerateOptions** -- the object you pass to\n\n`generate()`\n\n:| Field | Type | Description |\n|---|---|---|\n`input.text` |\n`string` |\nThe prompt or question for the AI model |\n`provider` |\n`string` |\nWhich AI provider to use (e.g., `'openai'` , `'anthropic'` , `'vertex'` ) |\n`model` |\n`string` |\nThe specific model to use (e.g., `'gpt-4o'` , `'claude-sonnet-4-5-20250929'` ) |\n`temperature` |\n`number` |\nCreativity control: 0 = deterministic, 1 = creative (optional) |\n`maxTokens` |\n`number` |\nMaximum tokens in the response (optional) |\n`systemPrompt` |\n`string` |\nInstructions that shape the AI's behavior (optional) |\n\n** GenerateResult** -- the object you get back:\n\n| Field | Type | Description |\n|---|---|---|\n`content` |\n`string` |\nThe AI's response text |\n`provider` |\n`string` |\nWhich provider was used |\n`model` |\n`string` |\nWhich model was used |\n`usage.total` |\n`number` |\nTotal tokens consumed |\n`usage.input` |\n`number` |\nTokens in the input prompt |\n`usage.output` |\n`number` |\nTokens in the output response |\n`responseTime` |\n`number` |\nTime in milliseconds |\n\nNote:Token usage fields use`total`\n\n,`input`\n\n, and`output`\n\n-- not`totalTokens`\n\nor`inputTokens`\n\n. This is a deliberate normalization across providers.\n\n{: .prompt-info }\n\nHere is the power of a unified SDK. The same code works with any provider -- just change the `provider`\n\nand `model`\n\nstrings:\n\n``` js\nimport { NeuroLink } from '@juspay/neurolink';\n\nconst neurolink = new NeuroLink();\n\n// OpenAI\nconst openaiResult = await neurolink.generate({\n  input: { text: 'What is machine learning?' },\n  provider: 'openai',\n  model: 'gpt-4o'\n});\n\n// Anthropic Claude\nconst anthropicResult = await neurolink.generate({\n  input: { text: 'What is machine learning?' },\n  provider: 'anthropic',\n  model: 'claude-sonnet-4-5-20250929'\n});\n\n// Google Vertex AI\nconst vertexResult = await neurolink.generate({\n  input: { text: 'What is machine learning?' },\n  provider: 'vertex',\n  model: 'gemini-3-flash'\n});\n\n// AWS Bedrock\nconst bedrockResult = await neurolink.generate({\n  input: { text: 'What is machine learning?' },\n  provider: 'bedrock',\n  model: 'anthropic.claude-3-sonnet-20240229-v1:0'\n});\n```\n\nNote:Model names and IDs in code examples reflect versions available at time of writing. Model availability, naming conventions, and pricing change frequently. Always verify current model IDs with your provider's documentation before deploying to production.\n\n{: .prompt-info }\n\nEvery call returns the same `GenerateResult`\n\ntype. Your application code that processes the response does not need to change at all.\n\n``` php\nflowchart TD\n    A[\"neurolink.generate()\"] --> B{\"provider?\"}\n    B -->|\"openai\"| C[\"OpenAI GPT-4o\"]\n    B -->|\"anthropic\"| D[\"Claude Sonnet\"]\n    B -->|\"vertex\"| E[\"Gemini Flash\"]\n    B -->|\"bedrock\"| F[\"AWS Bedrock\"]\n    B -->|\"ollama\"| G[\"Local LLM\"]\n    C --> H[\"Same GenerateResult\"]\n    D --> H\n    E --> H\n    F --> H\n    G --> H\n    style A fill:#0f4c75,stroke:#1b262c,color:#fff\n    style B fill:#3282b8,stroke:#1b262c,color:#fff\n    style H fill:#00b4d8,stroke:#1b262c,color:#fff\n```\n\nIf you do not want to hardcode a provider, `createBestAIProvider()`\n\nscans your environment variables and automatically selects the first available provider:\n\n``` js\nimport { createBestAIProvider } from '@juspay/neurolink';\n\n// Automatically uses the provider with a configured API key\nconst provider = await createBestAIProvider();\nconst result = await provider.generate({\n  input: { text: 'What is machine learning?' }\n});\n\nconsole.log(result.content);\n```\n\nThis is especially useful for libraries and shared modules where you do not want to assume which provider your user has configured.\n\nHere is the complete list of providers from the `AIProviderName`\n\nenum:\n\n| Provider | Config Key | Environment Variable |\n|---|---|---|\n| OpenAI | `openai` |\n`OPENAI_API_KEY` |\n| Anthropic | `anthropic` |\n`ANTHROPIC_API_KEY` |\n| Google Vertex AI | `vertex` |\n`VERTEX_PROJECT_ID` |\n| AWS Bedrock | `bedrock` |\nAWS credentials |\n| Azure OpenAI | `azure` |\n`AZURE_OPENAI_API_KEY` |\n| Google AI Studio | `google-ai` |\n`GOOGLE_AI_API_KEY` |\n| Mistral | `mistral` |\n`MISTRAL_API_KEY` |\n| Ollama | `ollama` |\n(local, no key needed) |\n| LiteLLM | `litellm` |\n`LITELLM_API_KEY` |\n| Hugging Face | `huggingface` |\n`HUGGINGFACE_API_KEY` |\n| AWS SageMaker | `sagemaker` |\nAWS credentials |\n| OpenRouter | `openrouter` |\n`OPENROUTER_API_KEY` |\n| OpenAI-Compatible | `openai-compatible` |\nConfigurable |\n\nFor chat interfaces and real-time applications, you want tokens to appear as they are generated rather than waiting for the complete response. Switch from `generate()`\n\nto `stream()`\n\n:\n\n``` js\nimport { NeuroLink } from '@juspay/neurolink';\n\nconst neurolink = new NeuroLink();\n\nconst result = await neurolink.stream({\n  input: { text: 'Write a haiku about TypeScript' },\n  provider: 'anthropic',\n  model: 'claude-sonnet-4-5-20250929',\n  systemPrompt: 'You are a creative poet.',\n  temperature: 1.0\n});\n\nfor await (const chunk of result.stream) {\n  if ('content' in chunk) {\n    process.stdout.write(chunk.content);\n  }\n}\n```\n\nThe `result.stream`\n\nasync iterator delivers text chunks as they arrive from the provider. This works identically across all 13 providers -- NeuroLink normalizes the different streaming protocols (SSE, WebSocket, HTTP chunking) into a single consistent interface.\n\nNote:The streaming property is`result.stream`\n\n, not`result.textStream`\n\n. This is consistent across all NeuroLink streaming operations.\n\n{: .prompt-info }\n\nIf you are building a web frontend, you can pipe the stream directly to a response:\n\n``` js\n// In an Express/Hono route handler\napp.post('/chat', async (req, res) => {\n  const neurolink = new NeuroLink();\n  const result = await neurolink.stream({\n    input: { text: req.body.message },\n    provider: 'openai',\n    model: 'gpt-4o'\n  });\n\n  res.setHeader('Content-Type', 'text/event-stream');\n  for await (const chunk of result.stream) {\n    res.write(`data: ${JSON.stringify({ text: chunk })}\\n\\n`);\n  }\n  res.end();\n});\n```\n\nSystem prompts let you shape the AI's behavior and personality. They work with both `generate()`\n\nand `stream()`\n\n:\n\n``` js\nimport { NeuroLink } from '@juspay/neurolink';\n\nconst neurolink = new NeuroLink();\n\n// A helpful coding assistant\nconst result = await neurolink.generate({\n  input: { text: 'How do I handle errors in async/await?' },\n  provider: 'openai',\n  model: 'gpt-4o',\n  systemPrompt: 'You are a senior TypeScript developer. Provide concise, practical answers with code examples. Always mention edge cases.',\n  temperature: 0.3  // Lower temperature for more deterministic, technical answers\n});\n\nconsole.log(result.content);\n```\n\nThe `temperature`\n\nparameter controls the creativity of the output:\n\nFor production applications, you want resilience. If your primary provider has an outage, you need a fallback:\n\n``` js\nimport { createAIProviderWithFallback } from '@juspay/neurolink';\n\nconst { primary, fallback } = await createAIProviderWithFallback(\n  'openai',   // Primary provider\n  'bedrock'   // Fallback provider\n);\n\ntry {\n  const result = await primary.generate({ input: { text: 'Hello!' } });\n  console.log(result.content);\n} catch (error) {\n  const result = await fallback.generate({ input: { text: 'Hello!' } });\n  console.log('Fallback:', result.content);\n}\n```\n\nThis pattern ensures your application stays available even when individual providers experience issues. You can configure as many fallback layers as you need.\n\nCongratulations -- you just built your first AI application! Let's recap what you accomplished:\n\n`npm install @juspay/neurolink`\n\n`.env`\n\n`generate()`\n\n`stream()`\n\nThat was not so scary, right? Now you have a solid foundation to build on. Here are some fun next steps depending on what interests you:\n\nStar the [NeuroLink GitHub repository](https://github.com/juspay/neurolink), join the discussions, and let us know what you build. The [npm package](https://www.npmjs.com/package/@juspay/neurolink) is available now.\n\n**Related posts:**", "url": "https://wpnews.pro/news/getting-started-with-neurolink-your-first-ai-app-in-5-minutes", "canonical_source": "https://dev.to/neurolink/getting-started-with-neurolink-your-first-ai-app-in-5-minutes-3i6c", "published_at": "2026-07-04 04:02:27+00:00", "updated_at": "2026-07-04 04:19:19.050951+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "large-language-models", "ai-tools"], "entities": ["NeuroLink", "Juspay", "OpenAI", "Google", "Anthropic", "TypeScript"], "alternates": {"html": "https://wpnews.pro/news/getting-started-with-neurolink-your-first-ai-app-in-5-minutes", "markdown": "https://wpnews.pro/news/getting-started-with-neurolink-your-first-ai-app-in-5-minutes.md", "text": "https://wpnews.pro/news/getting-started-with-neurolink-your-first-ai-app-in-5-minutes.txt", "jsonld": "https://wpnews.pro/news/getting-started-with-neurolink-your-first-ai-app-in-5-minutes.jsonld"}}