---
version: 2
interactions:
- id: 0
  request:
    proto: HTTP/1.1
    proto_major: 1
    proto_minor: 1
    content_length: 512
    host: ""
    body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"}],"model":"grok-code-fast-1","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"stream":true}'
    headers:
      Accept:
      - application/json
      Content-Type:
      - application/json
      User-Agent:
      - Charm-Fantasy/0.12.2 (https://charm.land/fantasy)
    url: https://api.x.ai/v1/chat/completions
    method: POST
  response:
    proto: HTTP/2.0
    proto_major: 2
    proto_minor: 0
    content_length: -1
    body: |+
      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345589,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":"The","role":"assistant"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345589,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" user"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345589,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" asked"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" for"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" the"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" weather"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" in"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" Florence"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":","}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" Italy"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":"."}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" I"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" have"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" a"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" tool"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" for"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" that"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":":"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" the"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" weather"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" function"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":","}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" which"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" takes"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" a"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" location"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":".\n"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_53816330","function":{"name":"weather","arguments":"{\"location\":\"Florence,Italy\"}"},"index":0,"type":"function"}]}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"3adac95d-3cc4-9199-307c-5e78ba0909e5","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[],"usage":{"prompt_tokens":390,"completion_tokens":26,"total_tokens":493,"prompt_tokens_details":{"text_tokens":390,"audio_tokens":0,"image_tokens":0,"cached_tokens":384},"completion_tokens_details":{"reasoning_tokens":77,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0},"num_sources_used":0,"cost_in_usd_ticks":1633800},"system_fingerprint":"fp_99052e9f23"}

      data: [DONE]

    headers:
      Content-Type:
      - text/event-stream
    status: 200 OK
    code: 200
    duration: 530.425625ms
- id: 1
  request:
    proto: HTTP/1.1
    proto_major: 1
    proto_minor: 1
    content_length: 876
    host: ""
    body: '{"messages":[{"content":"You are a helpful assistant","role":"system"},{"content":"What''s the weather in Florence,Italy?","role":"user"},{"tool_calls":[{"id":"call_53816330","function":{"arguments":"{\"location\":\"Florence,Italy\"}","name":"weather"},"type":"function"}],"role":"assistant","reasoning_content":"The user asked for the weather in Florence, Italy. I have a tool for that: the weather function, which takes a location.\n"},{"content":"40 C","tool_call_id":"call_53816330","role":"tool"}],"model":"grok-code-fast-1","max_tokens":4000,"stream_options":{"include_usage":true},"tool_choice":"auto","tools":[{"function":{"name":"weather","strict":false,"description":"Get weather information for a location","parameters":{"properties":{"location":{"description":"the city","type":"string"}},"required":["location"],"type":"object"}},"type":"function"}],"stream":true}'
    headers:
      Accept:
      - application/json
      Content-Type:
      - application/json
      User-Agent:
      - Charm-Fantasy/0.12.2 (https://charm.land/fantasy)
    url: https://api.x.ai/v1/chat/completions
    method: POST
  response:
    proto: HTTP/2.0
    proto_major: 2
    proto_minor: 0
    content_length: -1
    body: |+
      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":"The","role":"assistant"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" tool"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" returned"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" \""}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":"40"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" C"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":"\","}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" which"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" I"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" assume"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" means"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" "}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":"40"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" degrees"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":" Celsius"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345590,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"reasoning_content":".\n"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":"The"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":" current"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":" weather"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":" in"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":" Florence"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":","}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":" Italy"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":" is"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":" "}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":"40"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":"°C"}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{"content":"."}}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"system_fingerprint":"fp_99052e9f23"}

      data: {"id":"e3825e75-0f1f-f256-f561-d94920fc9f6d","object":"chat.completion.chunk","created":1773345591,"model":"grok-code-fast-1","choices":[],"usage":{"prompt_tokens":506,"completion_tokens":12,"total_tokens":556,"prompt_tokens_details":{"text_tokens":506,"audio_tokens":0,"image_tokens":0,"cached_tokens":448},"completion_tokens_details":{"reasoning_tokens":38,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0},"num_sources_used":0,"cost_in_usd_ticks":955600},"system_fingerprint":"fp_99052e9f23"}

      data: [DONE]

    headers:
      Content-Type:
      - text/event-stream
    status: 200 OK
    code: 200
    duration: 540.322917ms
