@simplellm/sdk
v0.5.3
Published
SimpleLLM Node.js SDK — EU-hosted LLM inference, OpenAI-compatible
Maintainers
Readme
@simplellm/sdk
Official Node.js SDK for SimpleLLM — EU-hosted LLM inference.
Install
npm install @simplellm/sdkQuick Start
import { SimpleLLM } from '@simplellm/sdk'
const client = new SimpleLLM({ apiKey: 'YOUR_API_KEY' })
const response = await client.chat.completions.create({
model: 'Qwen3-Coder-30B-A3B-Instruct',
messages: [{ role: 'user', content: 'Hello!' }],
})
console.log(response.choices[0].message.content)Streaming
const stream = await client.chat.completions.create({
model: 'Qwen3-Coder-30B-A3B-Instruct',
messages: [{ role: 'user', content: 'Write a poem' }],
stream: true,
})
for await (const chunk of stream) {
const text = chunk.choices[0]?.delta?.content ?? ''
process.stdout.write(text)
}Speech-to-Text (Whisper)
import { readFileSync } from 'fs'
const transcription = await client.audio.transcriptions.create({
file: readFileSync('audio.mp3'),
model: 'whisper-large-v3',
})
console.log(transcription.text)Image Generation (SDXL)
const image = await client.images.generate({
prompt: 'A cat in space',
model: 'sdxl',
})
console.log(image.data[0].url)Check Account Balance
const usage = await client.usage()
console.log(`Balance: ${usage.balance} SC`)API Key Usage
// Info about the current key
const key = await client.keys.current()
console.log(`Key: ${key.name} (${key.prefix}...)`)
// Usage for the current key
const usage = await client.keys.currentUsage()
console.log(`Requests: ${usage.total_requests}, Cost: ${usage.total_cost_sc} SC`)
// Daily breakdown (last 30 days)
const daily = await client.keys.currentDailyUsage()
for (const day of daily.usage) {
console.log(`${day.date}: ${day.requests} requests, ${day.cost_sc} SC`)
}
// List all keys
const { api_keys } = await client.keys.list()
// Usage for a specific key
const keyUsage = await client.keys.usage(api_keys[0].id)Configuration
const client = new SimpleLLM({
apiKey: 'YOUR_API_KEY', // or set SIMPLELLM_API_KEY env var
baseURL: 'https://api.simplellm.eu', // default
timeout: 120000, // default: 120s
})OpenAI Compatibility
SimpleLLM is fully OpenAI-compatible. You can also use the official OpenAI SDK:
import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://api.simplellm.eu/v1',
apiKey: 'YOUR_API_KEY',
})License
MIT
