Skip to main content

Lite LLM Client

This project made for very light llm client. the main idea is do not use any llm client library.

setup

How to pass API_KEY

  1. use parameter of LLMConfig
from lite_llm_client import LiteLLMClient, OpenAIConfig, LLMMessage, LLMMessageRole

client = LiteLLMClient(OpenAIConfig(api_key="YOUR API KEY"))
answer = client.chat_completions(messages=[LLMMessage(role=LLMMessage.USER, content="hello ai?")])

print(answer)
  1. use .env
    • rename .env_example to .env
    • replace YOUR KEY to real api_key
OPENAI_API_KEY=YOUR KEY
ANTHROPIC_API_KEY=YOUR KEY
GEMINI_API_KEY=YOUR KEY

Known issue

  • gemini path may not stable. guide code has /v1beta/.... sometimes gemini returns http 500 error

Roadmap

Future version

  • support multimodal (image and text)
  • apply opentelemetry in async functions

0.2.0

  • 2025-01-11 support json mode(OpenAI)
  • 2024-11-01 apply opentelemetry in sync functions

0.1.2

  • 2024-10-25 fix exception when use new model name as str type

0.1.0

  • 2024-07-21 support OpenAI
  • 2024-07-25 support Anthropic
  • 2024-07-27 add options for inference
  • 2024-07-28 support Gemini
  • 2024-07-30 support streaming (OpenAI). simple SSE implement.
  • 2024-07-31 support streaming (Anthropic).
  • 2024-08-01 support streaming (Gemini). unstable google gemini.
  • 2024-08-13 support inference result(token count, stop readon)

Reference

Metadata

Release files for lite-llm-client 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lite-llm-client 0.2.0
File Size Uploaded Provenance
lite_llm_client-0.2.0.tar.gz 13.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for lite-llm-client 0.2.0
File Interpreter ABI Platform
lite_llm_client-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.4 kB

Release files / lite_llm_client-0.2.0.tar.gz

Download URL lite_llm_client-0.2.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ccb1f6b605cd733476d64e922e167d930995b3b0c4a000f2be5a518a70209bb9
BLAKE2b-256 checksum
How to use checksums
4363c42905bcc05a7ba2116f2eef99f7b3d2715d4d8ee73127270d8e264b37b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Release files / lite_llm_client-0.2.0-py3-none-any.whl

Download URL lite_llm_client-0.2.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b20b1065b58a276f5de64035312bf23afcb147f0ccb53701051741128a65fb9e
BLAKE2b-256 checksum
How to use checksums
66703dd0771ca9aefdaa14d671264656d79531c42bd749a30c7162a9d05dfd36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Security for lite-llm-client 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page