#!/usr/bin/env python3
import json
import sys
import urllib.request


base_url = sys.argv[1] if len(sys.argv) > 1 else "http://127.0.0.1:9000"
prompt = "Think briefly, then reply with only the number: 17 * 19."
cases = [
    (
        "chat",
        "/v1/chat/completions",
        {
            "model": "deepseek-v4-flash",
            "messages": [{"role": "user", "content": prompt}],
            "reasoning_effort": "low",
            "temperature": 0,
            "max_tokens": 96,
        },
    ),
    (
        "anthropic",
        "/v1/messages",
        {
            "model": "deepseek-v4-flash",
            "messages": [{"role": "user", "content": prompt}],
            "thinking": {"type": "enabled", "budget_tokens": 64},
            "output_config": {"effort": "low"},
            "temperature": 0,
            "max_tokens": 96,
        },
    ),
    (
        "responses",
        "/v1/responses",
        {
            "model": "deepseek-v4-flash",
            "input": prompt,
            "reasoning": {"effort": "low", "summary": "auto"},
            "temperature": 0,
            "max_output_tokens": 96,
        },
    ),
]

for name, path, payload in cases:
    request = urllib.request.Request(
        base_url + path,
        data=json.dumps(payload).encode(),
        headers={"Content-Type": "application/json"},
    )
    with urllib.request.urlopen(request, timeout=120) as response:
        print(name, json.dumps(json.load(response), separators=(",", ":")))
