Skip to content

Commit e6b7f13

Browse files
committed
docs
1 parent 23e662f commit e6b7f13

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
@@ -417,6 +417,24 @@ Error codes are as followed:
417417
| >=500 | `InternalServerError` |
418418
| N/A | `APIConnectionError` |
419419

420+
## Request IDs
421+
422+
> For more information on debugging requests, see [these docs](https://platform.openai.com/docs/api-reference/debugging-requests)
423+
424+
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.
425+
426+
```python
427+
completion = await client.chat.completions.create(
428+
messages=[{"role": "user", "content": "Say this is a test"}], model="gpt-4"
429+
)
430+
print(completion._request_id) # req_123
431+
```
432+
433+
Note that unlike other properties that use an `_` prefix, the `_request_id` property
434+
*is* public. Unless documented otherwise, *all* other `_` prefix properties,
435+
methods and modules are *private*.
436+
437+
420438
### Retries
421439

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

0 commit comments

Comments
 (0)