---
title: "Raw Request/Response Logging"
url: "/docs/observability/raw_request_response"
canonical_url: "https://docs.litellm.ai/docs/observability/raw_request_response"
type: "docs"
last_updated: "2026-10-01"
related:
  - "/docs/observability/generic_api"
  - "/docs/observability/scrub_data"
---
# Raw Request/Response Logging

> Index of all LiteLLM docs: https://docs.litellm.ai/llms.txt


## Logging
See the raw request/response sent by LiteLLM in your logging provider (OTEL/Langfuse/etc.).

**SDK**

```python
# uv add langfuse 
import litellm
import os

# log raw request/response
litellm.log_raw_request_response = True

# from https://cloud.langfuse.com/
os.environ["LANGFUSE_PUBLIC_KEY"] = ""
os.environ["LANGFUSE_SECRET_KEY"] = ""
# Optional, defaults to https://cloud.langfuse.com
os.environ["LANGFUSE_HOST"] # optional

# LLM API Keys
os.environ['OPENAI_API_KEY']=""

# set langfuse as a callback, litellm will send the data to langfuse
litellm.success_callback = ["langfuse"] 
 
# openai call
response = litellm.completion(
  model="gpt-5.6-luna",
  messages=[
    {"role": "user", "content": "Hi 👋 - i'm openai"}
  ]
)
```

**PROXY**

```yaml
litellm_settings:
  log_raw_request_response: True
```

**Expected Log**

## Return Raw Response Headers 

Return raw response headers from llm provider. 

Currently only supported for openai. 

**SDK**

```python
import litellm
import os

litellm.return_response_headers = True

## set ENV variables
os.environ["OPENAI_API_KEY"] = "your-api-key"

response = litellm.completion(
  model="gpt-5.6-luna",
  messages=[{ "content": "Hello, how are you?","role": "user"}]
)

print(response._hidden_params)
```

**PROXY**

1. Setup config.yaml

```yaml
model_list:
  - model_name: gpt-5.6-luna
    litellm_params:
      model: gpt-5.6-luna
      api_key: os.environ/GROQ_API_KEY

litellm_settings:
  return_response_headers: true
```

2. Test it!

```bash
curl -X POST 'http://0.0.0.0:4000/chat/completions' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $LITELLM_API_KEY" \
-D '{
    "model": "gpt-5.6-luna",
    "messages": [
        { "role": "system", "content": "Use your tools smartly"},
        { "role": "user", "content": "What time is it now? Use your tool"}
    ]
}'
```

**Expected Response**

## Related pages

- [Generic API](https://docs.litellm.ai/docs/observability/generic_api.md)
- [Scrub Logged Data](https://docs.litellm.ai/docs/observability/scrub_data.md)
