https://api.stali.vn

← Tất cả ứng dụng · Mục lục trên /docs

AnthropicCấu hình tay

Python (anthropic)

SDK chính thức Anthropic trỏ base_url Stali.

URL gốc phải dán

Dán đúng một trong hai kiểu — sai sẽ ra 404 (không phải 401).

https://api.stali.vn

Chuẩn bị

  1. pip install anthropic
  2. Biến môi trường STALI_API_KEY

Model khuyến nghị: claude-fable-5

Cách nhanh — lệnh / cấu hình

from anthropic import Anthropic

client = Anthropic(api_key="sk-stali-...", base_url="https://api.stali.vn")
msg = client.messages.create(
    model="claude-fable-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Xin chào!"}],
)
print(msg.content[0].text)

Bỏ file / điền Settings ở đâu

Biến môi trườngany
shell / .env
export STALI_API_KEY=sk-stali-...
# Trong code: api_key=os.environ["STALI_API_KEY"], base_url="https://api.stali.vn"

Kiểm tra đã chạy đúng

  1. Chạy script
  2. Thấy x-stali-cost-vnd trên response headers nếu log HTTP

Lỗi thường gặp

Triệu chứngNguyên nhânCách xử lý
404base_url có thừa /v1.Dùng https://api.stali.vn (SDK tự thêm /v1/messages).

Liên quan

Python (openai) · Node.js

Hỗ trợ TelegramZalo support