neurocli-node
v1.2.2
Published
The official Node.js SDK for the NeuroCLI API.
Maintainers
Readme
NeuroCLI Node.js SDK
The official Node.js SDK for interacting with NeuroCLI and the NeuroCLI Medical Gamma engine. This package provides robust TypeScript support, native fetch backing, streaming, and full API bindings.
Installation
npm install neurocli-sdkQuick Start
import NeuroCLI from 'neurocli-sdk';
const client = new NeuroCLI({
apiKey: process.env.NEUROCLI_API_KEY, // Required
});
async function main() {
const completion = await client.chat.completions.create({
model: 'neurocli medical gamma-0.3',
messages: [{ role: 'user', content: 'What is deep learning?' }],
});
console.log(completion.choices[0].message.content);
}
main();Streaming
The SDK supports native AsyncIterables for easy streaming.
import NeuroCLI from 'neurocli-sdk';
const client = new NeuroCLI({ apiKey: process.env.NEUROCLI_API_KEY });
async function stream() {
const stream = await client.chat.completions.create({
model: 'neurocli medical gamma-0.3',
messages: [{ role: 'user', content: 'Write a long poem.' }],
stream: true,
});
for await (const chunk of stream) {
const content = chunk.choices[0]?.delta?.content || '';
process.stdout.write(content);
}
}
stream();Medical Reasoning (NeuroCLI Medical Gamma)
Access the custom clinical reasoning endpoint:
import NeuroCLI from 'neurocli-sdk';
const client = new NeuroCLI({ apiKey: process.env.NEUROCLI_API_KEY });
async function runMedical() {
const response = await client.medical.reasoning.create({
model: 'neurocli-medical-gamma',
data: "Patient is a 45yo male presenting with acute chest pain...",
});
console.log(response.clinical_summary);
console.log(response.extracted_entities);
}
runMedical();Advanced Options
const client = new NeuroCLI({
apiKey: 'your-api-key',
baseUrl: 'https://custom-domain.com/v1', // Optional
maxRetries: 5, // Automatically retries 429s with exponential backoff (default: 3)
});