Skip to main content

A unified Python client to normalize interfaces across major LLM providers (OpenAI, Anthropic, Gemini).

Project description

onellmclient

统一主要 LLM 提供商(OpenAI、Anthropic、Gemini)接口格式的 Python 客户端。

  • 运行时零强制依赖;通过 extras 按需安装各家 SDK。
  • 提供统一的 Client 接口以便上层应用透明切换供应商。

安装

使用 uv(推荐):

uv venv
uv pip install -e .
# 或安装某家 SDK:
uv pip install -e .[openai]
uv pip install -e .[anthropic]
uv pip install -e .[gemini]
uv pip install -e .[all]

构建与发布

使用 uv 构建 sdist 与 wheel:

uv build
ls dist/

发布到 TestPyPI:

uv tool install twine  # 首次需要安装
uv run twine upload --repository testpypi dist/*
# 安装测试:
uv pip install -i https://test.pypi.org/simple/ onellmclient==0.1.0

发布到 PyPI(确认版本号已递增且能在 TestPyPI 正常安装后):

uv run twine upload dist/*

使用

from onellmclient import Client

client = Client(openai={"api_key": "..."})
resp = client.completion(
    provider="openai", model="gpt-4o-mini", messages=[{"role":"user","content":"hi"}]
)
print(resp)

开源协议

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onellmclient-0.1.0.tar.gz (50.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onellmclient-0.1.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file onellmclient-0.1.0.tar.gz.

File metadata

  • Download URL: onellmclient-0.1.0.tar.gz
  • Upload date:
  • Size: 50.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for onellmclient-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3dbdae97c53d9e7daf80b231b9526c234d075dda876fe63215dad362d0578340
MD5 c7e2601ca6f9f5342013eb8dd6c9c5f4
BLAKE2b-256 ea1ea9e0526f2b521fb1eed51cee2e71123d5287f929876aee0de0c13995992d

See more details on using hashes here.

File details

Details for the file onellmclient-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: onellmclient-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for onellmclient-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0071fcd4052642ff8fb324729c29f418f7db2c8148d5afb51e510a27918154d4
MD5 5d508bd346ffd9dba8fc3b0fd94efd64
BLAKE2b-256 97470e7114c81baaa1c8e43876cb99af3ab5b7992e437077e0cb34a62f4ec15f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page