Skip to content

Commit c42e30e

Browse files
committed
docs
1 parent e9780f7 commit c42e30e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,24 @@ Error codes are as followed:
375375
| >=500 | `InternalServerError` |
376376
| N/A | `APIConnectionError` |
377377

378+
## Request IDs
379+
380+
> For more information on debugging requests, see [these docs](https://platform.openai.com/docs/api-reference/debugging-requests)
381+
382+
All object responses in the SDK provide a `_request_id` property which is added from the `x-request-id` response header so that you can quickly log failing requests and report them back to OpenAI.
383+
384+
```python
385+
completion = await client.chat.completions.create(
386+
messages=[{"role": "user", "content": "Say this is a test"}], model="gpt-4"
387+
)
388+
print(completion._request_id) # req_123
389+
```
390+
391+
Note that unlike other properties that use an `_` prefix, the `_request_id` property
392+
*is* public. Unless documented otherwise, *all* other `_` prefix properties,
393+
methods and modules are *private*.
394+
395+
378396
### Retries
379397

380398
Certain errors are automatically retried 2 times by default, with a short exponential backoff.

0 commit comments

Comments
 (0)