← All applications · Connect apps section on /docs
AnthropicManual setup
Python (anthropic)
Python (anthropic): set the base URL and API key in integration code.
Published instructions · App version: unverified
Chat, ping, invoke and content-generation examples may send real billable requests. Check the model, balance, rate and minimum before running them. GET /v1/models checks authentication and the catalogue only. Set up environment variables safely
Base URL to paste
OpenAI SDKs generally use a URL ending in /v1; Anthropic SDKs use the root URL. Avoid adding /v1 twice. Protocol compatibility does not guarantee every provider feature.
https://thapi.cloudPrerequisites
- pip install anthropic
- The STALI_API_KEY environment variable
Recommended model: claude-fable-5
Quick way — command / config
import os
from anthropic import Anthropic
client = Anthropic(api_key=os.environ["STALI_API_KEY"], base_url="https://thapi.cloud")
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
STALI_API_KEY
Set STALI_API_KEY in the Python process environment using Quick start. A .env file is not loaded automatically; keep keys out of Git.
Verify connection
- Run the script
- x-thapi-cost-vnd appears in the response headers when HTTP logging is enabled
Troubleshooting
| Symptom | Reason | How to handle |
|---|---|---|
| 404 | base_url has an extra /v1. | Dùng https://thapi.cloud (SDK tự thêm /v1/messages). |