오픈소스 · v2.3.1 · MPL-2.0 · NODE.JS >= 22
모든 LLM 프로바이더를 단 하나의 호출 규약으로.
@ubinity/node-llm은 OpenAI, 호환 서버(DeepSeek·Qwen·Ollama), Anthropic, Google Gemini / Vertex AI를 단일 요청·응답·에러 계약(NodeLlmError)으로 통합하는 경량 Node.js(>=22) 라이브러리입니다. API 키와 공식 구독 CLI 호출을 모두 지원합니다.
$ npm install @ubinity/node-llm const { completion } = require('@ubinity/node-llm');
// Same calling contract for API keys or official subscriptions
const reply = await completion({
model: 'anthropic/claude-haiku-4-5',
auth: 'subscription', // or omit for API key
timeout: 120000,
messages: [
{ role: 'system', content: 'Answer in one concise sentence.' },
{ role: 'user', content: 'What is a vendored dependency?' }
]
});
console.log(reply.auth, reply.choices[0].message.content); 핵심 설계 특징
API 키 및 공식 구독(auth: "subscription") 양방향 지원
선택적 peer SDK를 통한 API 키 호출은 물론, Claude Code·Codex·Antigravity CLI 공식 클라이언트를 통한 구독 호출(환경변수 격리 및 Windows WSL 지원)을 제공합니다.
조용한 무시 없는 엄격한 계약
미지원 파라미터는 묵살하지 않고 즉시 타입화된 NodeLlmError("unsupported")를 반환합니다.
프로덕션 복원력 내장
Retry-After 준수 지수 백오프 재시도, AbortSignal/타임아웃, LRU 클라이언트 재사용, 프롬프트 캐싱, 추론 effort 스케일, Tool Calling 정규화를 포함합니다.
Supported Model Prefixes & Auth Modes
| Model Prefix | Protocol | Auth Modes |
|---|---|---|
| openai/ · gpt* | openai | API key or Codex CLI (subscription) |
| deepseek/ · qwen/ · dashscope/ | openai | API key |
| ollama/ · custom baseURL | openai | None / optional |
| anthropic/ · claude* | anthropic | API key or Claude Code CLI (subscription) |
| gemini/ · google/ | API key or Antigravity CLI (subscription) | |
| vertex_ai/ | vertex_ai | Google Cloud credentials |
| antigravity/<id> | subscription | Antigravity CLI (subscription only) |
명시적 설계 경계 (Contract v1)
- Node.js 22 이상이 필요하며 각 프로바이더 SDK는 optional peerDependencies입니다.
- 단일 완결 응답 계약이며 stream: true 및 복수 응답(n > 1)은 v1에서 명시적으로 거부됩니다.
- 전체 API 문서와 변경 이력은 GitHub 저장소를 기준으로 관리됩니다.
Built with the same deterministic engineering principles behind Ubinity Prompt Vault and Ubinity Ledger .