@thib3113/litellm-sdk
v0.1.0
Published
TypeScript client for the LiteLLM Proxy API. Primarily designed for personal use.
Maintainers
Readme
@thib3113/litellm-sdk
⚠️ Personal use: This package is primarily designed for personal use with a self-hosted LiteLLM Proxy. The API may change at any time without notice. Use at your own risk.
TypeScript client for the LiteLLM Proxy REST API, with types auto-generated from the official LiteLLM schema.
Installation
npm install @thib3113/litellm-sdk
# or
pnpm add @thib3113/litellm-sdkUsage
import { createClient } from "@thib3113/litellm-sdk";
const llm = createClient({
baseURL: "http://llm.example.com",
adminKey: process.env.LITELLM_ADMIN_KEY,
});
// List model deployments
const models = await llm.modelInfo({});
// Create a new model deployment
await llm.createModel({
model_name: "my-model",
litellm_params: { model: "gpt-4o", api_key: "sk-..." },
model_info: {},
});
// Chat completion
const res = await llm.chat({ model: "my-model", messages: [{ role: "user", content: "Hello" }] });Régénérer les types
Les types sont synchronisés depuis le repo officiel LiteLLM — pas besoin d'une instance locale.
# Dernière release LiteLLM (auto-détectée via GitHub API)
pnpm generate
# Version précise
pnpm generate -- --version v1.98.0
# Offline (réutilise le fichier commité)
pnpm generate -- --offlineVariables d'environnement
| Variable | Description | Default |
|---|---|---|
| LITELLM_BASE_URL | LiteLLM proxy base URL | http://localhost:4000 |
| LITELLM_ADMIN_KEY | Master/admin key | — |
| LITELLM_API_KEY | User API key | — |
| LITELLM_VERSION | Tag LiteLLM pour pnpm generate | dernière release |
License
MIT
