Skip to content

Add Request/Response logging#14

Merged
danielchen0 merged 7 commits intopatchedfrom
danielchen0/2025-11-12/add_request_response_logging
Nov 13, 2025
Merged

Add Request/Response logging#14
danielchen0 merged 7 commits intopatchedfrom
danielchen0/2025-11-12/add_request_response_logging

Conversation

@danielchen0
Copy link

@danielchen0 danielchen0 commented Nov 12, 2025

================================================================================
[11/12/2025, 04:21:14 PM PST] POST /v1/chat/completions
Status: 200 | Duration: 607ms
--------------------------------------------------------------------------------

INCOMING REQUEST (Client -> Gateway):

Client Headers:
{
  "accept": "*/*",
  "authorization": "Bearer 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",
  "content-length": "90",
  "content-type": "application/json",
  "host": "localhost:8787",
  "user-agent": "curl/8.7.1",
  "x-portkey-provider": "openai"
}

Client Request Body:
{
  "model": "gpt-3.5-turbo",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ]
}

--------------------------------------------------------------------------------

OUTGOING REQUESTS (Gateway -> Provider):
Provider: openai
Request URL: https://api.openai.com/v1/chat/completions

Request Parameters:
{
  "model": "gpt-3.5-turbo",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ]
}

Provider Response:
{
  "id": "chatcmpl-CbFNKybQqnEnqYpdEZhodGPUQhcz0",
  "object": "chat.completion",
  "created": 1762993274,
  "model": "gpt-3.5-turbo-0125",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I assist you today?",
        "refusal": null,
        "annotations": []
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 8,
    "completion_tokens": 9,
    "total_tokens": 17,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  },
  "service_tier": "default",
  "system_fingerprint": null
}

--------------------------------------------------------------------------------

OUTGOING RESPONSE (Gateway -> Client):

Status: 200

Response Headers:
{
  "access-control-expose-headers": "X-Request-ID",
  "alt-svc": "h3=\":443\"; ma=86400",
  "cf-cache-status": "DYNAMIC",
  "cf-ray": "99da1b99e8659453-SJC",
  "connection": "keep-alive",
  "content-encoding": "br",
  "content-type": "application/json",
  "date": "Thu, 13 Nov 2025 00:21:14 GMT",
  "openai-organization": "create-inc-3",
  "openai-processing-ms": "412",
  "openai-project": "proj_IwJrakFf6YLJu6tiASDpwyNo",
  "openai-version": "2020-10-01",
  "server": "cloudflare",
  "set-cookie": "_cfuvid=FUrVhZ_Rz5p43tvGnEFQWUcs8FnF0kDUAz514VvGTys-1762993274426-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None",
  "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
  "transfer-encoding": "chunked",
  "x-content-type-options": "nosniff",
  "x-envoy-upstream-service-time": "440",
  "x-openai-proxy-wasm": "v0.1",
  "x-portkey-cache-status": "DISABLED",
  "x-portkey-last-used-option-index": "config",
  "x-portkey-provider": "openai",
  "x-portkey-retry-attempt-count": "0",
  "x-portkey-trace-id": "",
  "x-ratelimit-limit-requests": "10000",
  "x-ratelimit-limit-tokens": "50000000",
  "x-ratelimit-remaining-requests": "9999",
  "x-ratelimit-remaining-tokens": "49999995",
  "x-ratelimit-reset-requests": "6ms",
  "x-ratelimit-reset-tokens": "0s",
  "x-request-id": "req_1d6e3b8473244863833abf7770f2a4ec"
}

Response Body:
{
  "id": "chatcmpl-CbFNKybQqnEnqYpdEZhodGPUQhcz0",
  "object": "chat.completion",
  "created": 1762993274,
  "model": "gpt-3.5-turbo-0125",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I assist you today?",
        "refusal": null,
        "annotations": []
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 8,
    "completion_tokens": 9,
    "total_tokens": 17,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  },
  "service_tier": "default",
  "system_fingerprint": null
}

================================================================================

Print something like this to help us see what's going on

@vercel
Copy link

vercel bot commented Nov 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
gateway Ready Ready Preview Comment Nov 13, 2025 1:23am

@danielchen0 danielchen0 changed the base branch from main to patched November 13, 2025 01:01
@danielchen0 danielchen0 merged commit 73c3aa3 into patched Nov 13, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants