Skip to content

Instantly share code, notes, and snippets.

@aiyogg
Last active June 9, 2025 06:32
Show Gist options
  • Save aiyogg/a8241b5bfc9904397aaa55191d9d74dd to your computer and use it in GitHub Desktop.
Save aiyogg/a8241b5bfc9904397aaa55191d9d74dd to your computer and use it in GitHub Desktop.
mitmproxy
from mitmproxy import http
def request(flow: http.HTTPFlow) -> None:
# Check if the request is to api.openai.com and has the specific referer
if "api.openai.com" in flow.request.host and flow.request.headers.get("http-referer") == "https://cherry-ai.com":
# Headers to remove
headers_to_remove = ["x-stainless-timeout", "x-stainless-retry-count"]
# Remove specified headers if they exist
for header in headers_to_remove:
if header in flow.request.headers:
del flow.request.headers[header]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment