← All applications · Connect apps section on /docs
Anthropic + OpenAIManual setup
LangChain
ChatAnthropic / ChatOpenAI trỏ Vietrouter.
Base URL to paste
Paste exactly one of two formats — wrong URL yields 404 (not 401).
https://vietrouter.com.vnPrerequisites
- pip install langchain-anthropic langchain-openai
Recommended model: claude-fable-5
Quick way — command / config
from langchain_anthropic import ChatAnthropic
llm = ChatAnthropic(
model="claude-fable-5",
anthropic_api_key="sk-mtm-...",
anthropic_api_url="https://vietrouter.com.vn",
max_tokens=1024,
)
print(llm.invoke("Hello!").content)Where to place file / fill Settings
Environment variableany
project .env
ANTHROPIC_API_KEY + ANTHROPIC_BASE_URL hoặc truyền vào constructor.
Verify connection
- Chạy invoke một lần
Troubleshooting
| Symptom | Reason | How to handle |
|---|---|---|
| 404 | anthropic_api_url kèm /v1. | Dùng https://vietrouter.com.vn. |