Zum Hauptinhalt springen

Documentation Index

Fetch the complete documentation index at: https://docs.aihubmix.com/llms.txt

Use this file to discover all available pages before exploring further.

To simplify how different model providers (OpenAI, Anthropic, Google, DeepSeek, etc.) handle reasoning/thinking, AIHubMix now supports a unified reasoning parameter specification. Developers can use one standard interface to control a model’s thinking effort and retrieve detailed reasoning traces, covering thinking on/off and intensity for Claude, Gemini, GLM-5, Minimax, and more.

Unified Parameter Definition

Enabling Thinking via reasoning

reasoning can be set in the following ways:
{
  "model": "claude-sonnet-4-5",
  "messages": [
    {
      "role": "system",
      "content": "You are an AI assistant"
    },
    {
      "role": "user",
      "content": "Hello?"
    }
  ],
  "reasoning_effort": "low"
}
reasoning_effort accepts the following values:
  • none (recommended): explicitly disable thinking (may not take effect on some forced-thinking models such as minimax-m2.7)
  • minimal: minimize thinking; on some models this disables thinking entirely
  • low (recommended)
  • medium (recommended)
  • high (recommended)
  • xhigh
For models that allow setting thinking intensity, reasoning_effort maps as follows:
effort valuegptclaudegeminidoubao
minimalminimallowMINIMALminimal
lowlowlowLOWlow
mediummediummediumMEDIUMmedium
highhighhighHIGHhigh
xhighxhighmaxHIGHhigh
For models that only support a thinking budget, reasoning_effort is computed as a ratio of MaxOutputTokens:
  • “xhigh”: 0.95,
  • “high”: 0.8,
  • “medium”: 0.5,
  • “low”: 0.2,
  • “minimal”: 0.1,
For models/providers that only support a binary thinking toggle (e.g. DeepSeek, Qwen, GLM, Kimi), reasoning_effort has only two effects:
  • none: disable thinking
  • any other value: enable thinking

(Alternative) Use the effort field inside reasoning:

{
  "model": "claude-sonnet-4-5",
  "messages": [
    {
      "role": "system",
      "content": "You are an AI assistant"
    },
    {
      "role": "user",
      "content": "Hello?"
    }
  ],
  "reasoning": {"effort": "low"}
}

(Alternative) Use the max_tokens field inside reasoning to precisely cap thinking tokens:

{
  "model": "claude-sonnet-4-5",
  "messages": [
    {
      "role": "system",
      "content": "You are an AI assistant"
    },
    {
      "role": "user",
      "content": "Hello?"
    }
  ],
  "reasoning": {"max_tokens":1024}
}

Thinking Response

Thinking results add two fields:
  • reasoning_content: the thinking content as a string.
  • reasoning_details: raw thinking metadata for multi-turn conversations; preserving it improves model quality. The shape is an object — apart from type (fixed), other properties vary per model but are all strings.
Non-streaming response example:
{
  "id": "chatcmpl-msg_01RSXhFMjbZFadHbeV5wA8Qh",
  "model": "claude-sonnet-4-5-20250929",
  "object": "chat.completion",
  "created": 1771840947,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?",
        "reasoning_content": "The user is just saying \"Hello?\" - this is a simple greeting. I should respond in a friendly and welcoming manner, and let them know I'm here to help.",
        "reasoning_details": {
          "type": "thinking",
          "thinking": "The user is just saying \"Hello?\" - this is a simple greeting. I should respond in a friendly and welcoming manner, and let them know I'm here to help.",
          "signature": "Er8CCkYICxgCKkBbWyg5ZeExgqX80Bf5g/2pE/oiuJEhkKhFmMkqcAqeqvKNEIMMqfkY2qm12Vg7dcv+ZMg88VXQ9f8nVK65B9npEgxo8vfdPn1IZBFj0iAaDHnXh4Vk9Czek7MDyCIwOzmEvPUKfM2bg8kwSsxMxgyk6ZZQIUHfPzITEZzge3DH1hrg5DenhuSO8WwEeJpTKqYBnSxK/SP/UEOpiDRJd2gxhAVbxweRQu2qrQTV0E+1kt32KXyuJ2qsOi45gq0LoOX+e9utmXImadFTag+fZ7im1TLOAk5nAQ/yOG72T3SQt/WMFwI+szVmT9M2uc2FVyrpIwM8HyDaH+0mJ457en5SVu32kJdluyIGpcl9LLcqGfJdgV6O3DYsNFzuZYZ5h5VtjhXRXl600PySbNN55wIWzJJY0ECrxxgB"
        }
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 44,
    "completion_tokens": 56,
    "total_tokens": 100,
    "claude_cache_tokens_details": {
      "cache_creation_input_tokens": 0,
      "cache_read_input_tokens": 0,
      "cache_write_5_minutes_input_tokens": 0,
      "cache_write_1_hour_input_tokens": 0
    }
  }
}
Streaming response example:
data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_details":{"type":"thinking"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":"The user is greeting","reasoning_details":{"type":"thinking","thinking":"The user is greeting"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":" me with","reasoning_details":{"type":"thinking","thinking":" me with"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":" \"Hello?\". This is a simple","reasoning_details":{"type":"thinking","thinking":" \"Hello?\". This is a simple"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":" greeting,","reasoning_details":{"type":"thinking","thinking":" greeting,"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":" so I should respond in a friendly and","reasoning_details":{"type":"thinking","thinking":" so I should respond in a friendly and"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":" helpful","reasoning_details":{"type":"thinking","thinking":" helpful"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":" manner","reasoning_details":{"type":"thinking","thinking":" manner"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":". I'll","reasoning_details":{"type":"thinking","thinking":". I'll"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":" gr","reasoning_details":{"type":"thinking","thinking":" gr"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":"eet them back and let","reasoning_details":{"type":"thinking","thinking":"eet them back and let"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":" them know I'm here","reasoning_details":{"type":"thinking","thinking":" them know I'm here"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_content":" to help.","reasoning_details":{"type":"thinking","thinking":" to help."}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_details":{"type":"thinking"}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"","reasoning_details":{"type":"thinking","signature":"EtkCCkYICxgCKkA1InJ3Nd008PJgr4w3LT55M0niYdNg6kJdwXDU4PxzLMI9IYVJM4rDAsY+mXgK1TIY2+QRf1vzF98SN9anTQR4EgzXpyX2O9gMMWYaSDQaDDE2Owvd9BJdFiGTwSIwf+JRijgNbVCGLytiEKN6sc/BQ4Y5cKfMBQC7Bupy2w0AS8gCAZORRAjTqPw6JfTtKsABSTlAYhtWpx7QcgqlpYHzRx5Kklf6UElBMNMs/HBCqTDF7pn6gy08RWiJIUCyqyu7diubqeFgqnkNgg5Rw6FRSMW53zNca3o3IgxD7fgTpVM1LgRJ2lWYy5DiPrsN8Lpj6TdYlo2LRYlatlkGuOCvHIved68c9TIuhV31KOc9dvr6Apyv2SsIrzDDzGFyYqgTHh8YVyWzeHG+XPKOih6s4wHZ5DpyNdXdPq5Af6txC00UnbY7axTQ3ElA3oBAT/9/GAE="}}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"role":"assistant","content":""}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":"Hello! How can"}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":" I help you today?"}}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"chat.completion.chunk","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop"}],"system_fingerprint":"fp-msg_015ZkNJK6y6mNaNukhgKxoah"}

data: {"id":"chatcmpl-msg_015ZkNJK6y6mNaNukhgKxoah","object":"","created":1771845184,"model":"claude-sonnet-4-5-20250929","choices":[],"usage":{"prompt_tokens":44,"completion_tokens":63,"total_tokens":107,"claude_cache_tokens_details":{"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_write_5_minutes_input_tokens":0,"cache_write_1_hour_input_tokens":0}}}

data: [DONE]

Multi-turn Conversations

To preserve thinking content across multiple turns, pass reasoning_details straight through to the next turn — this helps the model reason more thoroughly after receiving tool-call results. For streaming responses, concatenate the non-type fields of consecutive reasoning_details chunks with the same type, then re-attach the type field before passing to the next turn.

Non-streaming Reference Example

Reference code
import json
import logging
import http.client
import ssl
from urllib.parse import urlparse

logging.basicConfig(level=logging.DEBUG, format="%(asctime)s %(levelname)s %(message)s")
logger = logging.getLogger(__name__)

BASE_URL = "https://aihubmix.com"
API_KEY = "sk-***"
MODEL = "claude-sonnet-4-6"
EFFORT = "low"

def send_request(path, data):
    """Send HTTP POST request and return JSON response"""
    parsed = urlparse(BASE_URL)
    host = parsed.netloc
    use_https = parsed.scheme == 'https'

    if use_https:
        context = ssl.create_default_context()
        context.check_hostname = False
        context.verify_mode = ssl.CERT_NONE
        conn = http.client.HTTPSConnection(host, context=context)
    else:
        conn = http.client.HTTPConnection(host)

    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {API_KEY}"
    }

    json_data = json.dumps(data)

    try:
        conn.request("POST", path, json_data, headers)
        response = conn.getresponse()
        response_data = json.loads(response.read().decode('utf-8'))

        if response.status != 200:
            logger.error(f"HTTP Error: {response.status}")
            logger.error(response_data)
            raise Exception(f"HTTP {response.status}: {response_data}")

        return response_data
    finally:
        conn.close()

# Define tools once and reuse
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get current weather",
        "parameters": {
            "type": "object",
            "properties": {
                "location": {"type": "string"}
            },
            "required": ["location"]
        }
    }
}]

# ===== Turn 1 =====
req1 = {
    "model": MODEL,
    "messages": [
        {"role": "user", "content": "What's the weather like in Boston and Beijing? Then recommend what to wear."}
    ],
    "parallel_tool_calls": True,
    "reasoning_effort": EFFORT,
    "tools": tools
}

logger.debug("[Turn 1] Request:\n%s", json.dumps(req1, indent=2, default=str))

response_data = send_request("/v1/chat/completions", req1)

logger.debug("[Turn 1] Response:\n%s", json.dumps(response_data, indent=2, default=str))

# Extract the assistant message
message = response_data["choices"][0]["message"]

# ===== Turn 2 =====
# Build messages with all tool call responses
messages = [
    {"role": "user", "content": "What's the weather like in Boston and Beijing? Then recommend what to wear."},
    message
]

# Add tool responses for all tool calls
for tool_call in message.get("tool_calls", []):
    messages.append({
        "role": "tool",
        "tool_call_id": tool_call["id"],
        "content": '{"temperature": 45, "condition": "rainy", "humidity": 85}'
    })

req2 = {
    "model": MODEL,
    "messages": messages,
    "parallel_tool_calls": True,
    "reasoning_effort": EFFORT,
    "tools": tools
}

logger.debug("[Turn 2] Request:\n%s", json.dumps(req2, indent=2, default=str))

response_data2 = send_request("/v1/chat/completions", req2)

logger.debug("[Turn 2] Response:\n%s", json.dumps(response_data2, indent=2, default=str))
Reference output
2026-04-12 15:04:10,370 DEBUG [Turn 1] Request:
{
  "model": "claude-sonnet-4-6",
  "messages": [
    {
      "role": "user",
      "content": "What's the weather like in Boston and Beijing? Then recommend what to wear."
    }
  ],
  "parallel_tool_calls": true,
  "reasoning_effort": "low",
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string"
            }
          },
          "required": [
            "location"
          ]
        }
      }
    }
  ]
}


2026-04-12 15:04:13,528 DEBUG [Turn 1] Response:
{
  "id": "chatcmpl-msg_01U5aVScUcBHPZRm3KsJZkux",
  "model": "claude-sonnet-4-6",
  "object": "chat.completion",
  "created": 1775977453,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Sure! Let me check the weather in both cities at the same time!",
        "reasoning_content": "Let me get weather for both cities simultaneously.",
        "reasoning_details": {
          "type": "thinking",
          "thinking": "Let me get weather for both cities simultaneously.",
          "signature": "Eu8BClsIDBgCKkDZd7aZm59FCfvnO9XsFaQfTfhr+CiB/jpZAHHFU2pfSlZneYfF5/mV2FDmm+f19/I4oixVk0CrxTDcD8VpU7ULMhFjbGF1ZGUtc29ubmV0LTQtNjgAEgxj7ktUelYOB0toCBEaDF5tUjSLUbud1CsT/CIw7zwSrL7Ouf5HhoUf/K6px1ENA3/AyDsVoEYldXmhtLQylLTcUtZVi1eV8wcdp+mzKkLrgzTjxq8+JtRcJym/KJYHoa3CPhcAgCd9nJoF3OGcuCnY4sfF2EF0+g0d2WPyWI/k7F4I3y3q0ZGKnNo4JV84YJIYAQ=="
        },
        "tool_calls": [
          {
            "id": "toolu_01Uf7t8TeTQBQji8YmFRGxXy",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": "{\"location\":\"Boston\"}"
            }
          },
          {
            "id": "toolu_01GMW4HDcCdEEPQi2TAqnLqJ",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": "{\"location\":\"Beijing\"}"
            }
          }
        ]
      },
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 571,
    "completion_tokens": 129,
    "total_tokens": 700,
    "claude_cache_tokens_details": {
      "cache_creation_input_tokens": 0,
      "cache_read_input_tokens": 0,
      "cache_write_5_minutes_input_tokens": 0,
      "cache_write_1_hour_input_tokens": 0
    }
  }
}
2026-04-12 15:04:13,528 DEBUG [Turn 2] Request:
{
  "model": "claude-sonnet-4-6",
  "messages": [
    {
      "role": "user",
      "content": "What's the weather like in Boston and Beijing? Then recommend what to wear."
    },
    {
      "role": "assistant",
      "content": "Sure! Let me check the weather in both cities at the same time!",
      "reasoning_content": "Let me get weather for both cities simultaneously.",
      "reasoning_details": {
        "type": "thinking",
        "thinking": "Let me get weather for both cities simultaneously.",
        "signature": "Eu8BClsIDBgCKkDZd7aZm59FCfvnO9XsFaQfTfhr+CiB/jpZAHHFU2pfSlZneYfF5/mV2FDmm+f19/I4oixVk0CrxTDcD8VpU7ULMhFjbGF1ZGUtc29ubmV0LTQtNjgAEgxj7ktUelYOB0toCBEaDF5tUjSLUbud1CsT/CIw7zwSrL7Ouf5HhoUf/K6px1ENA3/AyDsVoEYldXmhtLQylLTcUtZVi1eV8wcdp+mzKkLrgzTjxq8+JtRcJym/KJYHoa3CPhcAgCd9nJoF3OGcuCnY4sfF2EF0+g0d2WPyWI/k7F4I3y3q0ZGKnNo4JV84YJIYAQ=="
      },
      "tool_calls": [
        {
          "id": "toolu_01Uf7t8TeTQBQji8YmFRGxXy",
          "type": "function",
          "function": {
            "name": "get_weather",
            "arguments": "{\"location\":\"Boston\"}"
          }
        },
        {
          "id": "toolu_01GMW4HDcCdEEPQi2TAqnLqJ",
          "type": "function",
          "function": {
            "name": "get_weather",
            "arguments": "{\"location\":\"Beijing\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "tool_call_id": "toolu_01Uf7t8TeTQBQji8YmFRGxXy",
      "content": "{\"temperature\": 45, \"condition\": \"rainy\", \"humidity\": 85}"
    },
    {
      "role": "tool",
      "tool_call_id": "toolu_01GMW4HDcCdEEPQi2TAqnLqJ",
      "content": "{\"temperature\": 45, \"condition\": \"rainy\", \"humidity\": 85}"
    }
  ],
  "parallel_tool_calls": true,
  "reasoning_effort": "low",
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string"
            }
          },
          "required": [
            "location"
          ]
        }
      }
    }
  ]
}



2026-04-12 15:04:20,866 DEBUG [Turn 2] Response:
{
  "id": "chatcmpl-msg_01Pp25hirYgzKuyEKsdQ3dqn",
  "model": "claude-sonnet-4-6",
  "object": "chat.completion",
  "created": 1775977461,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Interestingly, both cities are experiencing very similar weather right now! Here's a summary and outfit recommendations:\n\n---\n\n### 🌧️ Boston & Beijing – Current Weather\n| | Boston | Beijing |\n|---|---|---|\n| 🌡️ Temperature | 45°F (~7°C) | 45°F (~7°C) |\n| 🌦️ Condition | Rainy | Rainy |\n| 💧 Humidity | 85% | 85% |\n\n---\n\n### 👗 What to Wear\n\nSince both cities share the same chilly, rainy conditions, here are recommendations for **both**:\n\n1. **Waterproof Jacket or Raincoat** 🧥 – A must with the rain and high humidity. Go for something windproof too if possible.\n2. **Warm Layers** 🧣 – At 45°F, it's cold enough for a sweater or fleece underneath your jacket.\n3. **Waterproof Boots or Water-Resistant Shoes** 👢 – Keep your feet dry on wet streets.\n4. **Umbrella** ☂️ – Don't leave home without one!\n5. **Scarf & Gloves** 🧤 – Optional but recommended, especially if you'll be outside for extended periods.\n\nStay warm and dry! ☔"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 799,
    "completion_tokens": 324,
    "total_tokens": 1123,
    "claude_cache_tokens_details": {
      "cache_creation_input_tokens": 0,
      "cache_read_input_tokens": 0,
      "cache_write_5_minutes_input_tokens": 0,
      "cache_write_1_hour_input_tokens": 0
    }
  }
}

Streaming Reference Example

Reference code
import json
import logging
import http.client
import ssl
from urllib.parse import urlparse

logging.basicConfig(level=logging.DEBUG, format="%(asctime)s %(levelname)s %(message)s")
logger = logging.getLogger(__name__)

BASE_URL = "https://aihubmix.com"
API_KEY = "sk-***"
MODEL = "claude-sonnet-4-6"
EFFORT = "low"

def send_stream_request(path, data):
    """Send HTTP POST request with streaming and return accumulated message"""
    parsed = urlparse(BASE_URL)
    host = parsed.netloc
    use_https = parsed.scheme == 'https'

    if use_https:
        context = ssl.create_default_context()
        context.check_hostname = False
        context.verify_mode = ssl.CERT_NONE
        conn = http.client.HTTPSConnection(host, context=context)
    else:
        conn = http.client.HTTPConnection(host)

    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {API_KEY}"
    }

    json_data = json.dumps(data)

    try:
        conn.request("POST", path, json_data, headers)
        response = conn.getresponse()

        if response.status != 200:
            error_data = response.read().decode('utf-8')
            logger.error(f"HTTP Error: {response.status}")
            logger.error(error_data)
            raise Exception(f"HTTP {response.status}: {error_data}")

        # Read and process streaming response
        accumulated_message = {}
        tool_calls_dict = {}  # Use dict to merge tool_calls by index

        for line in response:
            line = line.decode('utf-8').strip()

            if not line or line == "data: [DONE]":
                continue

            if line.startswith("data: "):
                try:
                    chunk_data = json.loads(line[6:])  # Remove "data: " prefix
                    logger.debug(f"Stream chunk: {json.dumps(chunk_data, indent=2, default=str)}")

                    # Accumulate message from stream chunks
                    if "choices" in chunk_data and len(chunk_data["choices"]) > 0:
                        choice = chunk_data["choices"][0]

                        if "delta" in choice:
                            delta = choice["delta"]

                            # Accumulate content
                            if "content" in delta:
                                if "content" not in accumulated_message:
                                    accumulated_message["content"] = ""
                                accumulated_message["content"] += delta["content"]
                                # print(delta["content"], end="", flush=True)

                            # Accumulate role
                            if "role" in delta:
                                accumulated_message["role"] = delta["role"]

                            # Accumulate tool_calls (merge by index)
                            if "tool_calls" in delta:
                                for tool_call in delta["tool_calls"]:
                                    index = tool_call.get("index", 0)
                                    if index not in tool_calls_dict:
                                        tool_calls_dict[index] = {}

                                    # Merge tool_call fields
                                    for key, value in tool_call.items():
                                        if key == "index":
                                            continue
                                        if key == "function":
                                            if "function" not in tool_calls_dict[index]:
                                                tool_calls_dict[index]["function"] = {}
                                            # Merge function fields
                                            for func_key, func_value in value.items():
                                                if func_key == "arguments":
                                                    if "arguments" not in tool_calls_dict[index]["function"]:
                                                        tool_calls_dict[index]["function"]["arguments"] = ""
                                                    tool_calls_dict[index]["function"]["arguments"] += func_value
                                                else:
                                                    tool_calls_dict[index]["function"][func_key] = func_value
                                        else:
                                            tool_calls_dict[index][key] = value

                            # Accumulate reasoning_content
                            if "reasoning_content" in delta:
                                if "reasoning_content" not in accumulated_message:
                                    accumulated_message["reasoning_content"] = ""
                                accumulated_message["reasoning_content"] += delta["reasoning_content"]

                            # Accumulate reasoning_details: type is overwritten, strings concatenated
                            rd = delta.get("reasoning_details")
                            if rd and isinstance(rd, dict):
                                if "reasoning_details" not in accumulated_message:
                                    accumulated_message["reasoning_details"] = {}
                                for key, value in rd.items():
                                    if key == "type":
                                        accumulated_message["reasoning_details"]["type"] = value
                                    elif isinstance(value, str):
                                        accumulated_message["reasoning_details"][key] = accumulated_message["reasoning_details"].get(key, "") + value
                                    elif value is not None:
                                        accumulated_message["reasoning_details"][key] = value

                        # Get final message details from response (for non-delta fields like role)
                        if "message" in choice:
                            message_data = choice["message"]
                            for key, value in message_data.items():
                                if key not in accumulated_message:  # Don't overwrite accumulated content
                                    accumulated_message[key] = value

                except json.JSONDecodeError:
                    logger.debug(f"Skipping non-JSON line: {line}")

        # Convert tool_calls_dict back to list
        if tool_calls_dict:
            accumulated_message["tool_calls"] = [
                tool_calls_dict[i] for i in sorted(tool_calls_dict)
            ]

        print()  # New line after streaming
        return accumulated_message
    finally:
        conn.close()

# Define tools once and reuse
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get current weather",
        "parameters": {
            "type": "object",
            "properties": {
                "location": {"type": "string"}
            },
            "required": ["location"]
        }
    }
}]

# ===== Turn 1 =====
req1 = {
    "model": MODEL,
    "messages": [
        {"role": "user", "content": "What's the weather like in Boston and Beijing? Then recommend what to wear."}
    ],
    "parallel_tool_calls": True,
    "reasoning_effort": EFFORT,
    "tools": tools,
    "stream": True
}

logger.debug("[Turn 1] Request:\n%s", json.dumps(req1, indent=2, default=str))
print("\n[Turn 1] Streaming response:\n")

message = send_stream_request("/v1/chat/completions", req1)

logger.debug("[Turn 1] Accumulated message:\n%s", json.dumps(message, indent=2, default=str))

# ===== Turn 2 =====
# Build messages with all tool call responses
messages = [
    {"role": "user", "content": "What's the weather like in Boston and Beijing? Then recommend what to wear."},
    message
]

# Add tool responses for all tool calls
for tool_call in message.get("tool_calls", []):
    messages.append({
        "role": "tool",
        "tool_call_id": tool_call["id"],
        "content": '{"temperature": 45, "condition": "rainy", "humidity": 85}'
    })

req2 = {
    "model": MODEL,
    "messages": messages,
    "parallel_tool_calls": True,
    "reasoning_effort": EFFORT,
    "tools": tools,
    "stream": True
}

logger.debug("[Turn 2] Request:\n%s", json.dumps(req2, indent=2, default=str))
print("\n[Turn 2] Streaming response:\n")

message2 = send_stream_request("/v1/chat/completions", req2)

logger.debug("[Turn 2] Accumulated message:\n%s", json.dumps(message2, indent=2, default=str))
Reference output
2026-04-12 15:19:39,815 DEBUG [Turn 1] Request:
{
  "model": "claude-sonnet-4-6",
  "messages": [
    {
      "role": "user",
      "content": "What's the weather like in Boston and Beijing? Then recommend what to wear."
    }
  ],
  "parallel_tool_calls": true,
  "reasoning_effort": "low",
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string"
            }
          },
          "required": [
            "location"
          ]
        }
      }
    }
  ],
  "stream": true
}

[Turn 1] Streaming response:

2026-04-12 15:19:41,714 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "role": "assistant",
        "content": "",
        "reasoning_details": {
          "type": "thinking"
        }
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:41,714 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "",
        "reasoning_content": "Let me get the weather for both cities simultaneously.",
        "reasoning_details": {
          "type": "thinking",
          "thinking": "Let me get the weather for both cities simultaneously."
        }
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:41,715 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "",
        "reasoning_details": {
          "type": "thinking",
          "signature": "EvMBClsIDBgCKkApA3tLqIXac23x4XppC7wlH5lCSu/6iSh/hYWFWKNIlSDW0xTsOargmleRKY9UrTgqCbIDvl+C18yy8cWscQPsMhFjbGF1ZGUtc29ubmV0LTQtNjgAEgxnIIYapULsC2rToUoaDPYn/n0x9r+NtYMUYSIwpgr7lxtZvR8AxXeFAeygW9THqnqMcTwT3lKfBRbR9scj8nc7tpYD0bCJlLWay0kkKkau/0c3WHoLnM7oce2g8K8YrrxKGdPT1olGme7l9Hhj9b93AjwJkG92Toj7JPU1DRU4W1tEULdif7k0d0y6epgiegQe1HJEGAE="
        }
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:41,715 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "role": "assistant",
        "content": ""
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:41,715 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "Sure! Let me check the weather in both cities"
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,230 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": " at the same time!"
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,233 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "role": "assistant",
        "tool_calls": [
          {
            "id": "toolu_01Aeac9GjnyE3cJTmpwKiXeT",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": ""
            },
            "index": 0
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,233 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "function": {
              "arguments": ""
            },
            "index": 0
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,859 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "function": {
              "arguments": "{\"locat"
            },
            "index": 0
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,860 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "function": {
              "arguments": "ion\": \"Bos"
            },
            "index": 0
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,860 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "function": {
              "arguments": "ton\"}"
            },
            "index": 0
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,860 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "role": "assistant",
        "tool_calls": [
          {
            "id": "toolu_01ErK5zYygpSoARL39dfHcQ1",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": ""
            },
            "index": 1
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,860 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "function": {
              "arguments": ""
            },
            "index": 1
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,861 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "function": {
              "arguments": "{\""
            },
            "index": 1
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,861 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "function": {
              "arguments": "loc"
            },
            "index": 1
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,861 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "function": {
              "arguments": "ation\": "
            },
            "index": 1
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,861 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "function": {
              "arguments": "\"Be"
            },
            "index": 1
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,862 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "tool_calls": [
          {
            "function": {
              "arguments": "ijing\"}"
            },
            "index": 1
          }
        ]
      }
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,863 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "chat.completion.chunk",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": ""
      },
      "finish_reason": "tool_calls"
    }
  ],
  "system_fingerprint": "fp-msg_019r7FZ1qS2DvsTXKAWLVTwX"
}
2026-04-12 15:19:42,863 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_019r7FZ1qS2DvsTXKAWLVTwX",
  "object": "",
  "created": 1775978381,
  "model": "claude-sonnet-4-6",
  "choices": [],
  "usage": {
    "prompt_tokens": 571,
    "completion_tokens": 130,
    "total_tokens": 701,
    "claude_cache_tokens_details": {
      "cache_creation_input_tokens": 0,
      "cache_read_input_tokens": 0,
      "cache_write_5_minutes_input_tokens": 0,
      "cache_write_1_hour_input_tokens": 0
    }
  }
}

2026-04-12 15:19:42,863 DEBUG [Turn 1] Accumulated message:
{
  "content": "Sure! Let me check the weather in both cities at the same time!",
  "role": "assistant",
  "reasoning_details": {
    "type": "thinking",
    "thinking": "Let me get the weather for both cities simultaneously.",
    "signature": "EvMBClsIDBgCKkApA3tLqIXac23x4XppC7wlH5lCSu/6iSh/hYWFWKNIlSDW0xTsOargmleRKY9UrTgqCbIDvl+C18yy8cWscQPsMhFjbGF1ZGUtc29ubmV0LTQtNjgAEgxnIIYapULsC2rToUoaDPYn/n0x9r+NtYMUYSIwpgr7lxtZvR8AxXeFAeygW9THqnqMcTwT3lKfBRbR9scj8nc7tpYD0bCJlLWay0kkKkau/0c3WHoLnM7oce2g8K8YrrxKGdPT1olGme7l9Hhj9b93AjwJkG92Toj7JPU1DRU4W1tEULdif7k0d0y6epgiegQe1HJEGAE="
  },
  "reasoning_content": "Let me get the weather for both cities simultaneously.",
  "tool_calls": [
    {
      "id": "toolu_01Aeac9GjnyE3cJTmpwKiXeT",
      "type": "function",
      "function": {
        "name": "get_weather",
        "arguments": "{\"location\": \"Boston\"}"
      }
    },
    {
      "id": "toolu_01ErK5zYygpSoARL39dfHcQ1",
      "type": "function",
      "function": {
        "name": "get_weather",
        "arguments": "{\"location\": \"Beijing\"}"
      }
    }
  ]
}
2026-04-12 15:19:42,864 DEBUG [Turn 2] Request:
{
  "model": "claude-sonnet-4-6",
  "messages": [
    {
      "role": "user",
      "content": "What's the weather like in Boston and Beijing? Then recommend what to wear."
    },
    {
      "content": "Sure! Let me check the weather in both cities at the same time!",
      "role": "assistant",
      "reasoning_details": {
        "type": "thinking",
        "thinking": "Let me get the weather for both cities simultaneously.",
        "signature": "EvMBClsIDBgCKkApA3tLqIXac23x4XppC7wlH5lCSu/6iSh/hYWFWKNIlSDW0xTsOargmleRKY9UrTgqCbIDvl+C18yy8cWscQPsMhFjbGF1ZGUtc29ubmV0LTQtNjgAEgxnIIYapULsC2rToUoaDPYn/n0x9r+NtYMUYSIwpgr7lxtZvR8AxXeFAeygW9THqnqMcTwT3lKfBRbR9scj8nc7tpYD0bCJlLWay0kkKkau/0c3WHoLnM7oce2g8K8YrrxKGdPT1olGme7l9Hhj9b93AjwJkG92Toj7JPU1DRU4W1tEULdif7k0d0y6epgiegQe1HJEGAE="
      },
      "reasoning_content": "Let me get the weather for both cities simultaneously.",
      "tool_calls": [
        {
          "id": "toolu_01Aeac9GjnyE3cJTmpwKiXeT",
          "type": "function",
          "function": {
            "name": "get_weather",
            "arguments": "{\"location\": \"Boston\"}"
          }
        },
        {
          "id": "toolu_01ErK5zYygpSoARL39dfHcQ1",
          "type": "function",
          "function": {
            "name": "get_weather",
            "arguments": "{\"location\": \"Beijing\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "tool_call_id": "toolu_01Aeac9GjnyE3cJTmpwKiXeT",
      "content": "{\"temperature\": 45, \"condition\": \"rainy\", \"humidity\": 85}"
    },
    {
      "role": "tool",
      "tool_call_id": "toolu_01ErK5zYygpSoARL39dfHcQ1",
      "content": "{\"temperature\": 45, \"condition\": \"rainy\", \"humidity\": 85}"
    }
  ],
  "parallel_tool_calls": true,
  "reasoning_effort": "low",
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string"
            }
          },
          "required": [
            "location"
          ]
        }
      }
    }
  ],
  "stream": true
}

[Turn 2] Streaming response:

2026-04-12 15:19:44,954 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "role": "assistant",
        "content": ""
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:44,954 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "Inter"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:45,399 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "estingly, both cities have the same weather right now! Here's a summary and outfit recommendations:\n\n---\n\n### "
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:45,779 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "🌧️ Boston & Beijing — Current Weather\n| | Boston"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:46,264 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": " | Beijing |\n|---|---|---|\n| 🌡️ Temperature | 45°F | 45°F |\n| 🌦️ Condition | Rainy"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:46,618 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": " | Rainy |\n| 💧 Humidity | 85% | 85% |\n\n---\n\n### 👗 What to Wear\n\nSince both"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:46,968 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": " cities are experiencing **cool, rainy, and humid**"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:47,668 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": " conditions, here's what we recommend:\n\n1. **Waterproof Jacket or Raincoat** 🧥 "
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:47,827 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "— Essential to stay dry in the rain.\n2. **Warm Mid"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:48,263 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "-Layer** 🧣 — At 45°F, a sweater or fleece underneath will"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:48,670 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": " keep you comfortable.\n3. **Waterproof Boots or Shoes** 👢 — Keep your feet dry on wet"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:49,012 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": " streets.\n4. **Umbrella** ☂️ — A must-have for both cities today!"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:49,439 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "\n5. **Scarf & Light Gloves** 🧤 — The combination of cold"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:49,991 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": " and humidity can feel extra chilly.\n\nStay warm and dry out"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:50,056 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": " there! 🌧️"
      }
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:50,142 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "chat.completion.chunk",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": ""
      },
      "finish_reason": "stop"
    }
  ],
  "system_fingerprint": "fp-msg_01FXZYmNPMbnd9EHho9ZEmdY"
}
2026-04-12 15:19:50,170 DEBUG Stream chunk: {
  "id": "chatcmpl-msg_01FXZYmNPMbnd9EHho9ZEmdY",
  "object": "",
  "created": 1775978385,
  "model": "claude-sonnet-4-6",
  "choices": [],
  "usage": {
    "prompt_tokens": 800,
    "completion_tokens": 302,
    "total_tokens": 1102,
    "claude_cache_tokens_details": {
      "cache_creation_input_tokens": 0,
      "cache_read_input_tokens": 0,
      "cache_write_5_minutes_input_tokens": 0,
      "cache_write_1_hour_input_tokens": 0
    }
  }
}

2026-04-12 15:19:50,171 DEBUG [Turn 2] Accumulated message:
{
  "content": "Interestingly, both cities have the same weather right now! Here's a summary and outfit recommendations:\n\n---\n\n### 🌧️ Boston & Beijing — Current Weather\n| | Boston | Beijing |\n|---|---|---|\n| 🌡️ Temperature | 45°F | 45°F |\n| 🌦️ Condition | Rainy | Rainy |\n| 💧 Humidity | 85% | 85% |\n\n---\n\n### 👗 What to Wear\n\nSince both cities are experiencing **cool, rainy, and humid** conditions, here's what we recommend:\n\n1. **Waterproof Jacket or Raincoat** 🧥 — Essential to stay dry in the rain.\n2. **Warm Mid-Layer** 🧣 — At 45°F, a sweater or fleece underneath will keep you comfortable.\n3. **Waterproof Boots or Shoes** 👢 — Keep your feet dry on wet streets.\n4. **Umbrella** ☂️ — A must-have for both cities today!\n5. **Scarf & Light Gloves** 🧤 — The combination of cold and humidity can feel extra chilly.\n\nStay warm and dry out there! 🌧️",
  "role": "assistant"
}

Zuletzt aktualisiert: 2026-06-01