when:
  path: /v1/messages
  method: POST
  query_param: []
  header:
  - name: accept
    value: text/event-stream
  - name: content-type
    value: application/json
  - name: anthropic-version
    value: 2023-06-01
  body: '{"max_tokens":16384,"messages":[{"content":[{"text":"I''m planning a trip. What is the current weather in Tokyo, Japan? Based on the weather conditions, should I pack an umbrella or sunscreen? Use the get_weather tool to check before answering.","type":"text"}],"role":"user"}],"model":"claude-opus-4-7","stream":true,"system":[{"text":"You are a weather assistant. You have access to a get_weather tool. You must call the get_weather tool for any weather question and never guess weather data. After receiving the tool result, provide a concise summary of the weather.","type":"text"}],"thinking":{"type":"adaptive"},"tool_choice":{"type":"auto"},"tools":[{"description":"Get the current weather for a city. Must be called for weather questions.","input_schema":{"properties":{"city":{"description":"City name to get weather for","type":"string"}},"required":["city"],"type":"object"},"name":"get_weather"}]}'
then:
  status: 200
  header:
  - name: content-type
    value: text/event-stream; charset=utf-8
  body: |+
    event: message_start
    data: {"message":{"content":[],"id":"msg_REDACTED_1","model":"claude-opus-4-7","role":"assistant","stop_details":null,"stop_reason":null,"stop_sequence":null,"type":"message","usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"inference_geo":"global","input_tokens":913,"output_tokens":5,"service_tier":"standard"}},"type":"message_start"}

    event: content_block_start
    data: {"content_block":{"caller":{"type":"direct"},"id":"toolu_REDACTED_1","input":{},"name":"get_weather","type":"tool_use"},"index":0,"type":"content_block_start"}

    event: ping
    data: {"type":"ping"}

    event: content_block_delta
    data: {"delta":{"partial_json":"","type":"input_json_delta"},"index":0,"type":"content_block_delta"}

    event: content_block_delta
    data: {"delta":{"partial_json":"{\"ci","type":"input_json_delta"},"index":0,"type":"content_block_delta"}

    event: content_block_delta
    data: {"delta":{"partial_json":"ty\":","type":"input_json_delta"},"index":0,"type":"content_block_delta"}

    event: content_block_delta
    data: {"delta":{"partial_json":" \"Toky","type":"input_json_delta"},"index":0,"type":"content_block_delta"}

    event: content_block_delta
    data: {"delta":{"partial_json":"o\"}","type":"input_json_delta"},"index":0,"type":"content_block_delta"}

    event: content_block_stop
    data: {"index":0,"type":"content_block_stop"}

    event: message_delta
    data: {"delta":{"stop_details":null,"stop_reason":"tool_use","stop_sequence":null},"type":"message_delta","usage":{"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":913,"output_tokens":68}}

    event: message_stop
    data: {"type":"message_stop"}

---
when:
  path: /v1/messages
  method: POST
  query_param: []
  header:
  - name: accept
    value: text/event-stream
  - name: content-type
    value: application/json
  - name: anthropic-version
    value: 2023-06-01
  body: '{"max_tokens":16384,"messages":[{"content":[{"text":"I''m planning a trip. What is the current weather in Tokyo, Japan? Based on the weather conditions, should I pack an umbrella or sunscreen? Use the get_weather tool to check before answering.","type":"text"}],"role":"user"},{"content":[{"id":"toolu_REDACTED_1","input":{"city":"Tokyo"},"name":"get_weather","type":"tool_use"}],"role":"assistant"},{"content":[{"content":[{"text":"Weather in Tokyo: 72F (22C), sunny with light clouds, humidity 45%, wind 8 mph NW","type":"text"}],"tool_use_id":"toolu_REDACTED_1","type":"tool_result"}],"role":"user"}],"model":"claude-opus-4-7","stream":true,"system":[{"text":"You are a weather assistant. You have access to a get_weather tool. You must call the get_weather tool for any weather question and never guess weather data. After receiving the tool result, provide a concise summary of the weather.","type":"text"}],"thinking":{"type":"adaptive"},"tool_choice":{"type":"auto"},"tools":[{"description":"Get the current weather for a city. Must be called for weather questions.","input_schema":{"properties":{"city":{"description":"City name to get weather for","type":"string"}},"required":["city"],"type":"object"},"name":"get_weather"}]}'
then:
  status: 200
  header:
  - name: content-type
    value: text/event-stream; charset=utf-8
  body: |+
    event: message_start
    data: {"message":{"content":[],"id":"msg_REDACTED_2","model":"claude-opus-4-7","role":"assistant","stop_details":null,"stop_reason":null,"stop_sequence":null,"type":"message","usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"inference_geo":"global","input_tokens":1036,"output_tokens":9,"service_tier":"standard"}},"type":"message_start"}

    event: content_block_start
    data: {"content_block":{"text":"","type":"text"},"index":0,"type":"content_block_start"}

    event: ping
    data: {"type":"ping"}

    event: content_block_delta
    data: {"delta":{"text":"Here's the current weather in","type":"text_delta"},"index":0,"type":"content_block_delta"}

    event: content_block_delta
    data: {"delta":{"text":" Tokyo, Japan:\n\n- **Temperature:** 72°F (22°C)\n- **Conditions:** Sunny with light clouds\n- **Humidity:** 45%\n- **Wind:","type":"text_delta"},"index":0,"type":"content_block_delta"}

    event: content_block_delta
    data: {"delta":{"text":"** 8 mph NW\n\n**Recommendation:** Pack **sunscreen**! 🌞 With sunny skies,","type":"text_delta"},"index":0,"type":"content_block_delta"}

    event: content_block_delta
    data: {"delta":{"text":" mild temperatures, and low humidity, you won't need an umbrella. The UV exposure from","type":"text_delta"},"index":0,"type":"content_block_delta"}

    event: content_block_delta
    data: {"delta":{"text":" the sun makes sunscreen the smarter choice for your","type":"text_delta"},"index":0,"type":"content_block_delta"}

    event: content_block_delta
    data: {"delta":{"text":" trip. Enjoy Tokyo!","type":"text_delta"},"index":0,"type":"content_block_delta"}

    event: content_block_stop
    data: {"index":0,"type":"content_block_stop"}

    event: message_delta
    data: {"delta":{"stop_details":null,"stop_reason":"end_turn","stop_sequence":null},"type":"message_delta","usage":{"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":1036,"output_tokens":179}}

    event: message_stop
    data: {"type":"message_stop"}

