---
title: Logs
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/python)

[AI Gateway](https://developers.cloudflare.com/api/python/resources/ai_gateway)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Logs

##### [List Gateway Logs](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/logs/methods/list)

ai\_gateway.logs.list(strgateway\_id, LogListParams\*\*kwargs) -> SyncV4PagePaginationArray\[[LogListResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)>)]

GET/accounts/{account\_id}/ai-gateway/gateways/{gateway\_id}/logs

##### [Get Gateway Log Detail](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/logs/methods/get)

ai\_gateway.logs.get(strid, LogGetParams\*\*kwargs) -> [LogGetResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)>)

GET/accounts/{account\_id}/ai-gateway/gateways/{gateway\_id}/logs/{id}

##### [Patch Gateway Log](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/logs/methods/edit)

ai\_gateway.logs.edit(strid, LogEditParams\*\*kwargs) -> object

PATCH/accounts/{account\_id}/ai-gateway/gateways/{gateway\_id}/logs/{id}

##### [Delete Gateway Logs](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/logs/methods/delete)

ai\_gateway.logs.delete(strgateway\_id, LogDeleteParams\*\*kwargs) -> [LogDeleteResponse](<https://developers.cloudflare.com/api/python/resources/ai_gateway#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_delete_response%20%3E%20(schema)>)

DELETE/accounts/{account\_id}/ai-gateway/gateways/{gateway\_id}/logs

##### [Get Gateway Log Request](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/logs/methods/request)

ai\_gateway.logs.request(strid, LogRequestParams\*\*kwargs) -> object

GET/accounts/{account\_id}/ai-gateway/gateways/{gateway\_id}/logs/{id}/request

##### [Get Gateway Log Response](https://developers.cloudflare.com/api/python/resources/ai_gateway/subresources/logs/methods/response)

ai\_gateway.logs.response(strid, LogResponseParams\*\*kwargs) -> object

GET/accounts/{account\_id}/ai-gateway/gateways/{gateway\_id}/logs/{id}/response

##### ModelsExpand Collapse

<details>

<summary>

class LogListResponse: …

</summary>

id: str

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

cached: bool

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20cached">Link to this property</a>

created\_at: datetime

formatdate-time

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20created_at">Link to this property</a>

duration: int

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20duration">Link to this property</a>

model: str

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20model">Link to this property</a>

path: str

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20path">Link to this property</a>

provider: str

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20provider">Link to this property</a>

success: bool

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

tokens\_in: Optional\[int]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20tokens_in">Link to this property</a>

tokens\_out: Optional\[int]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20tokens_out">Link to this property</a>

cost: Optional\[float]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20cost">Link to this property</a>

custom\_cost: Optional\[bool]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20custom_cost">Link to this property</a>

metadata: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20metadata">Link to this property</a>

model\_type: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20model_type">Link to this property</a>

request\_content\_type: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20request_content_type">Link to this property</a>

request\_type: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20request_type">Link to this property</a>

response\_content\_type: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20response_content_type">Link to this property</a>

status\_code: Optional\[int]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20status_code">Link to this property</a>

step: Optional\[int]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)%20%3E%20(property)%20step">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_list_response%20%3E%20(schema)>)

<details>

<summary>

class LogGetResponse: …

</summary>

id: str

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

cached: bool

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20cached">Link to this property</a>

created\_at: datetime

formatdate-time

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20created_at">Link to this property</a>

duration: int

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20duration">Link to this property</a>

model: str

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20model">Link to this property</a>

path: str

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20path">Link to this property</a>

provider: str

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20provider">Link to this property</a>

success: bool

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

tokens\_in: Optional\[int]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20tokens_in">Link to this property</a>

tokens\_out: Optional\[int]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20tokens_out">Link to this property</a>

cost: Optional\[float]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20cost">Link to this property</a>

custom\_cost: Optional\[bool]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20custom_cost">Link to this property</a>

metadata: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20metadata">Link to this property</a>

model\_type: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20model_type">Link to this property</a>

request\_content\_type: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20request_content_type">Link to this property</a>

request\_head: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20request_head">Link to this property</a>

request\_head\_complete: Optional\[bool]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20request_head_complete">Link to this property</a>

request\_size: Optional\[int]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20request_size">Link to this property</a>

request\_type: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20request_type">Link to this property</a>

response\_content\_type: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20response_content_type">Link to this property</a>

response\_head: Optional\[str]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20response_head">Link to this property</a>

response\_head\_complete: Optional\[bool]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20response_head_complete">Link to this property</a>

response\_size: Optional\[int]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20response_size">Link to this property</a>

status\_code: Optional\[int]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20status_code">Link to this property</a>

step: Optional\[int]

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)%20%3E%20(property)%20step">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_get_response%20%3E%20(schema)>)

<details>

<summary>

class LogDeleteResponse: …

</summary>

success: bool

<a href="#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_delete_response%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_gateway.logs%20%3E%20(model)%20log_delete_response%20%3E%20(schema)>)