
Research
/Security News
jscrambler npm Package Compromised in Supply Chain Attack
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.
@rocketnew/llm-sdk
Advanced tools
Universal LLM SDK for JavaScript/TypeScript - OpenAI, Anthropic, Gemini, Perplexity and more
Universal LLM SDK for JavaScript/TypeScript.
npm i @rocketnew/llm-sdk
Basic
import { completion } from '@rocket/rocketllm';
const response = await completion({
model: 'gpt-4',
messages: [{ role: 'user', content: 'Hello!' }]
});
Streaming
const stream = await completion({
model: 'gpt-4',
messages: [{ role: 'user', content: 'Count to 5' }],
stream: true
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
Tool Calling
const response = await completion({
model: 'gpt-4',
messages: [{ role: 'user', content: 'What is the weather in Paris?' }],
tools: [{
type: 'function',
function: {
name: 'get_weather',
description: 'Get weather for a location',
parameters: {
type: 'object',
properties: {
location: { type: 'string' }
},
required: ['location']
}
}
}]
});
JSON Mode
const response = await completion({
model: 'gpt-4',
messages: [{ role: 'user', content: 'List 3 colors in JSON' }],
response_format: { type: 'json_object' }
});
Vision
const response = await completion({
model: 'gpt-4-vision-preview',
messages: [{
role: 'user',
content: [
{ type: 'text', text: 'Describe this image' },
{ type: 'image_url', image_url: 'https://example.com/image.jpg' }
]
}]
});
Basic
const response = await completion({
model: 'claude-3-5-sonnet-20241022',
messages: [{ role: 'user', content: 'Hello!' }]
});
Streaming
const stream = await completion({
model: 'claude-3-7-sonnet-20250219',
messages: [{ role: 'user', content: 'Write a poem' }],
stream: true
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
Tool Calling
const response = await completion({
model: 'cclaude-3-7-sonnet-20250219',
messages: [{ role: 'user', content: 'Calculate 25 * 4' }],
tools: [{
type: 'function',
function: {
name: 'calculate',
parameters: {
type: 'object',
properties: {
operation: { type: 'string' },
a: { type: 'number' },
b: { type: 'number' }
}
}
}
}]
});
Extended Thinking
const response = await completion({
model: 'claude-3-7-sonnet-20250219',
messages: [{ role: 'user', content: 'Solve this complex problem...' }],
thinking: { type: 'enabled', budget_tokens: 2000 }
});
// Access thinking blocks
console.log(response.choices[0].message.thinking_blocks);
Reasoning Effort
const response = await completion({
model: 'claude-3-7-sonnet-20250219',
messages: [{ role: 'user', content: 'Explain quantum computing' }],
reasoning_effort: 'high' // 'minimal' | 'low' | 'medium' | 'high'
});
Web Search
const response = await completion({
model: 'claude-3-7-sonnet-20250219',
messages: [{ role: 'user', content: 'What are the latest AI news?' }],
web_search_options: {
search_context_size: 'medium' // 'low' | 'medium' | 'high'
}
});
JSON Mode
const response = await completion({
model: 'claude-3-7-sonnet-20250219,
messages: [{ role: 'user', content: 'List 3 colors' }],
response_format: { type: 'json_object' }
});
Basic
const response = await completion({
model: 'gemini/gemini-2.5-flash-lite',
messages: [{ role: 'user', content: 'Hello!' }]
});
Streaming
const stream = await completion({
model: 'gemini/gemini-2.5-flash-lite',
messages: [{ role: 'user', content: 'Explain AI' }],
stream: true
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
Tool Calling
const response = await completion({
model: 'gemini/gemini-2.5-flash-lite',
messages: [{ role: 'user', content: 'Get weather for Tokyo' }],
tools: [{
type: 'function',
function: {
name: 'get_weather',
parameters: {
type: 'object',
properties: {
location: { type: 'string' }
}
}
}
}]
});
Reasoning
const response = await completion({
model: 'gemini/gemini-2.5-flash-lite',
messages: [{ role: 'user', content: 'Solve this logic puzzle...' }],
reasoning: true
});
Vision
const response = await completion({
model: 'gemini/gemini-2.5-flash-lite',
messages: [{
role: 'user',
content: [
{ type: 'text', text: 'What is in this image?' },
{ type: 'image_url', image_url: 'https://example.com/photo.jpg' }
]
}]
});
JSON Mode
const response = await completion({
model: 'gemini/gemini-2.5-flash-lite',
messages: [{ role: 'user', content: 'List 3 countries' }],
response_format: { type: 'json_object' }
});
Basic
const response = await completion({
model: 'llama-3.1-sonar-small-128k-online',
messages: [{ role: 'user', content: 'What is TypeScript?' }]
});
Streaming
const stream = await completion({
model: 'llama-3.1-sonar-small-128k-online',
messages: [{ role: 'user', content: 'Explain React' }],
stream: true
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
With Citations
const response = await completion({
model: 'llama-3.1-sonar-small-128k-online',
messages: [{ role: 'user', content: 'Latest AI developments?' }]
});
// Response includes citations
console.log(response.choices[0].message.content);
Made with ❤️ by Rocket Team
FAQs
Universal LLM SDK for JavaScript/TypeScript - OpenAI, Anthropic, Gemini, Perplexity and more
The npm package @rocketnew/llm-sdk receives a total of 2,362 weekly downloads. As such, @rocketnew/llm-sdk popularity was classified as popular.
We found that @rocketnew/llm-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.

Research
/Security News
A malicious .NET package is typosquatting the Braintree SDK to steal live payment card data, merchant API keys, and host secrets from production apps.

Security News
/Research
Compromised Injective SDK npm version 1.20.21 exfiltrates wallet private keys and mnemonics through fake telemetry functionality.