Reverse-engineered Python API for chat.ant-ling.com — compatible with the OpenAI Python SDK and Claude Code / Anthropic SDK.
- Native routes — faithful replicas of all 7 chat.ant-ling.com endpoints
- OpenAI adapter —
/v1/chat/completions,/v1/models(drop-in replacement) - Anthropic adapter —
/v1/messages,/v1/messages?beta=true(Claude Code compatible) - Proxy mode — forwards to the real server with cookie auth
- Standalone mode — mock responses for testing (no upstream needed)
# Clone and start
git clone https://github.com/mir-ashiq/antling-api.git
cd antling-api
docker compose up --build
# Test
Invoke-RestMethod -Uri "http://localhost:8000/v1/models"# 1. Install dependencies
pip install -r requirements.txt
# 2. Start the server (standalone/mock mode)
uvicorn antling_api.server:app --reload --port 8000
# 3. Test it
Invoke-RestMethod -Uri "http://localhost:8000/v1/models"The real chat.ant-ling.com API uses two auth mechanisms:
| Mechanism | Type | Required | How to get it |
|---|---|---|---|
TLingSESSIONID |
Cookie (JWT) | ✅ Yes | Browser DevTools → Network → Cookie header |
tenant-id |
HTTP Header | ✅ Yes | Browser DevTools → Network → Request Headers |
To set up proxy mode:
- Open chat.ant-ling.com in your browser and log in
- Open DevTools → Network tab → click any request
- Copy the full
Cookieheader value - Paste it in
.envasANTLING_SESSION_COOKIE
# .env
ANTLING_BASE_URL=https://chat.ant-ling.com
ANTLING_SESSION_COOKIE=TLingSESSIONID=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.xxxx; jsh_t_c_e=xxxx; spanner=xxxx
ANTLING_TENANT_ID=20260523LTJY01501627from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="sk-no-key-required",
)
# Non-streaming
response = client.chat.completions.create(
model="Ring-2.6-1T",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
# Streaming
for chunk in client.chat.completions.create(
model="Ring-2.6-1T",
messages=[{"role": "user", "content": "Hello!"}],
stream=True,
):
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Add to your environment:
$env:ANTHROPIC_BASE_URL="http://localhost:8000"
$env:ANTHROPIC_API_KEY="sk-no-key-required"
$env:ANTHROPIC_MODEL="Ring-2.6-1T"Or in ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "http://localhost:8000",
"ANTHROPIC_API_KEY": "sk-no-key-required",
"ANTHROPIC_MODEL": "Ring-2.6-1T"
}
}from anthropic import Anthropic
client = Anthropic(
base_url="http://localhost:8000",
api_key="sk-no-key-required",
)
response = client.messages.create(
model="Ring-2.6-1T",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.content[0].text)# Create conversation
Invoke-RestMethod -Uri "http://localhost:8000/meta/conversation/create" `
-Method POST -ContentType "application/json" `
-Body '{"query":"Hello world"}'
# List models
Invoke-RestMethod -Uri "http://localhost:8000/meta/model/list"
# Get messages
Invoke-RestMethod -Uri "http://localhost:8000/meta/message/messages?conversationId=xxx¤tPage=1&pageSize=20"| Method | Path | Description |
|---|---|---|
GET |
/meta/model/list |
List available models |
POST |
/meta/conversation/create |
Create new conversation |
POST |
/api/v1/chat |
Send message (SSE stream) |
GET |
/meta/message/messages |
Get messages (paginated) |
GET |
/meta/conversation/modelCustomParam |
Get model config |
POST |
/meta/conversation/updateModelCustomParam |
Update model config |
POST |
/meta/conversation/{id}/title |
Auto-generate title |
| Method | Path | Description |
|---|---|---|
GET |
/v1/models |
List models |
POST |
/v1/chat/completions |
Chat completions (streaming + non-streaming) |
| Method | Path | Description |
|---|---|---|
GET |
/v1/models |
List models |
POST |
/v1/messages |
Messages (streaming + non-streaming) |
antling_api/
├── __init__.py # Package init
├── config.py # Configuration & env vars
├── models.py # Pydantic models (native + OpenAI + Anthropic)
├── upstream.py # Proxy forwarding to real server
└── server.py # FastAPI app with all routes
client_example.py # Demo: OpenAI SDK + Anthropic SDK usage
.env.example # Environment template
requirements.txt # Dependencies
pyproject.toml # Project metadata
MIT