← All applications · Connect apps section on /docs
AnthropicManual setup
Python (anthropic)
SDK chính thức Anthropic trỏ base_url Vietrouter.
Base URL to paste
Paste exactly one of two formats — wrong URL yields 404 (not 401).
https://vietrouter.com.vnPrerequisites
- pip install anthropic
- Biến môi trường sk-mtm-...
Recommended model: claude-fable-5
Quick way — command / config
from anthropic import Anthropic
client = Anthropic(api_key="sk-mtm-...", base_url="https://vietrouter.com.vn")
msg = client.messages.create(
model="claude-fable-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(msg.content[0].text)Where to place file / fill Settings
Environment variableany
shell / .env
export sk-mtm-...=sk-mtm-... # Trong code: api_key="sk-mtm-...", base_url="https://vietrouter.com.vn"
Verify connection
- Chạy script
- Thấy x-mientaymedia-cost-vnd trên response headers nếu log HTTP
Troubleshooting
| Symptom | Reason | How to handle |
|---|---|---|
| 404 | base_url có thừa /v1. | Dùng https://vietrouter.com.vn (SDK tự thêm /v1/messages). |