chore: initial commit

This commit is contained in:
你的用户名
2025-11-01 21:58:31 +08:00
commit 0406b5664f
101 changed files with 20458 additions and 0 deletions

29
test_claude_api3.py Normal file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env python3
import os
import anthropic
# 加载环境变量
with open("/home/atai/telegram-bot/.env") as f:
for line in f:
line = line.strip()
if line and not line.startswith("#") and "=" in line:
key, value = line.split("=", 1)
os.environ[key] = value
try:
client = anthropic.Anthropic(
api_key=os.environ.get('ANTHROPIC_AUTH_TOKEN'),
base_url=os.environ.get('ANTHROPIC_BASE_URL', 'https://api.anthropic.com')
)
print("测试模型: claude-sonnet-4-20250514")
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=100,
messages=[{"role": "user", "content": "你好,请用一句话介绍自己"}]
)
print(f"✅ API调用成功!")
print(f"响应: {response.content[0].text}")
except Exception as e:
print(f"❌ 错误: {e}")