Skip to main content

English | 中文

License Python

My LLM SDK

My LLM SDK

一套代码,调用多家模型。

用同一套 client.generate() 调用 Gemini / Qwen / Doubao / DeepSeek。
内置预算控制、429 自动重试、Ledger 记账与用量统计。


🚀 快速上手

# 1. 安装
pip install my-llm-sdk

# 2. 初始化项目 (生成 config.yaml)
llm-sdk init

# 3. 编辑 config.yaml,填入你的 API Key
# api_keys:
#   google: "YOUR_KEY"

# 4. 快速调用
llm-sdk generate --model gemini-2.5-flash --prompt "Hello World"

✨ 核心功能

功能 说明
统一接口 一套 client.generate() 调用所有厂商
多模型支持 Gemini, Qwen, Doubao, DeepSeek
多模态 图片生成 / TTS / ASR / Vision
预算控制 请求前检查消费,超额自动拒绝
自动重试 429/超时退避重试
Async + Streaming generate_async / stream_async

📚 详细用法

Provider 支持能力 文档
Google Gemini 文本 / Vision / 图片生成 / TTS guide/providers/google.md
Qwen (DashScope) 文本 / Vision / 图片 / TTS / ASR guide/providers/qwen.md
Volcengine (Doubao) 文本 / DeepSeek / 图片 / 视频 guide/providers/volcengine.md

🔧 配置

config.yaml(本地,勿提交 Git)

api_keys:
  google: "AIzaSy..."
  dashscope: "sk-..."
  volcengine: "your-key"
daily_spend_limit: 5.0

模块化配置

SDK 自动加载 llm.project.d/*.yaml 中的模型定义:

my-project/
├── llm.project.yaml       # 主配置
└── llm.project.d/
    ├── google.yaml        # Gemini 模型
    ├── qwen.yaml          # Qwen 模型
    └── volcengine.yaml    # Doubao 模型

📊 CLI 命令

# 今日消耗
llm-sdk budget status

# 消耗趋势
llm-sdk budget report --days 7

# 消耗排行
llm-sdk budget top --by model

🧪 测试

# 回归测试(跳过音频测试)
pytest tests/

# 包含音频测试
pytest tests/ -m "audio"

# E2E 完整测试(图像生成 + Vision + 翻译)
python tests/e2e_full_suite.py

# 统一 Benchmark(文本 + 延迟 + 图像)
python scripts/benchmark_unified.py

# 仅文本 Benchmark
python scripts/benchmark_unified.py --skip-image

🗺️ Roadmap

  • 核心管控与预算拦截
  • Async + Streaming
  • 多模态支持 (Vision / TTS / ASR / Image Gen)
  • Volcengine Provider (Doubao / DeepSeek)
  • 运维报表与 CLI 工具
  • 发布到 PyPI

🤝 贡献

  1. Fork 本仓库
  2. 在 src/my_llm_sdk/providers/ 添加新 Provider
  3. 提交 PR

📄 License

Apache 2.0

Metadata

Release files for my-llm-sdk 0.9.3

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

Source distribution (sdist)

Source distribution for my-llm-sdk 0.9.3
File Size Uploaded Provenance
my_llm_sdk-0.9.3.tar.gz 528.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for my-llm-sdk 0.9.3
File Interpreter ABI Platform
my_llm_sdk-0.9.3-py3-none-any.whl Python 3 none any Details

Total release size: 591.1 kB

Release files / my_llm_sdk-0.9.3.tar.gz

Download URL my_llm_sdk-0.9.3.tar.gz
Size 528.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f387bc16e5f8a59c9ae7a4c881878a10a7e92163ff6aa86fe83d93cc21fd3c45
BLAKE2b-256 checksum
How to use checksums
d1b36e3af2fc6faedaad57a7c86c3c19874f595c66e2b87c80bb21efbb8effe7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release files / my_llm_sdk-0.9.3-py3-none-any.whl

Download URL my_llm_sdk-0.9.3-py3-none-any.whl
Size 63.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a35ecd07d52154b5bf93f44fa71ad52d2aa49196457f062884ec4b18bd8a2a7b
BLAKE2b-256 checksum
How to use checksums
452103d6d55e7ae08ea9bf4a38f1ee654f684c4f350d30931fd96a5ec1749aa4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Security for my-llm-sdk 0.9.3

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.

Release history Release notifications | RSS feed

This release

0.9.3 This release

2 release files No provenance

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