LiteLLM với Muapi
LiteLLM gọi trực tiếp API trò chuyện tương thích OpenAI của Muapi hoặc định tuyến qua LiteLLM Proxy.
Gọi trực tiếp bằng Python
Cài LiteLLM và chọn ID mô hình văn bản trong danh sách Muapi. Thay ID ví dụ bằng mô hình đang khả dụng.
pip install litellm
export MUAPI_API_KEY="your-key"
import os
from litellm import completion
response = completion(
model="openai/qwen-3-8-27b-obliterated",
api_base="https://api.muapi.ai/v1",
api_key=os.environ["MUAPI_API_KEY"],
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)
Cấu hình LiteLLM Proxy
Tạo config.yaml theo mẫu rồi chạy proxy. Giữ khóa Muapi trên máy chủ và không ghi khóa vào tệp YAML.
model_list:
- model_name: muapi-chat
litellm_params:
model: openai/qwen-3-8-27b-obliterated
api_base: https://api.muapi.ai/v1
api_key: os.environ/MUAPI_API_KEY
export MUAPI_API_KEY="your-key"
litellm --config config.yaml
Lưu ý
Muapi nhận POST /v1/chat/completions; api_base là https://api.muapi.ai/v1. Chỉ mô hình có capabilities.tools: true mới hỗ trợ gọi hàm. Cấu hình này dành cho chat; tạo ảnh dùng API riêng. Xem tài liệu nhà cung cấp OpenAI-compatible của LiteLLM.