Handling Successful Requests
The xproxy_result Object
xproxy_result ObjectThe xproxy_result object contains essential information about a request's execution, including cost calculations and limit status. It is returned whenever a request completes successfully (HTTP 200) and under certain failure conditions, such as when a limit blocks a request (HTTP 400).
Availability by Integration Method
Where and how you can access the xproxy_result object depends on your integration method:
Direct Provider Call with Telemetry (Recommended Approach)
Using @track decorator or track_context() function
When using the @track decorator or track_context() function with direct provider calls:
- Both
@trackandtrack_context()automatically submit telemetry data to the Ingest API, which returns anxproxy_resultobject - Important: The last
xproxy_resultresult can be accessed by calling get_context() immediately after the Direct Provider call. - Your function or code block receives only the original provider response
- If you need access to real-time cost data when using these annotations, please contact [email protected] for assistance
Without @track decorator or track_context() function
When making a direct call to a GenAI provider without using the @track decorator or track_context() function:
- You will need to manually call the Ingest API to submit telemetry data
- The Ingest API call will return the
xproxy_resultobject containing cost calculations and limit status - For Python applications, see the Python SDK Ingest API documentation for details on response handling
- For other languages, see the REST Ingest API documentation for details on the response format
xproxy_result Fields
Field | Description |
|---|---|
request_id | An identifier that can later be used to update request properties or reference this specific request for debugging |
request_tags | All Request Tags that were passed in as part of the request are returned to enable programmatic confirmation/testing. |
resource_id | An identifier that references the specific Resource used in the request. This is returned as an opaque ID and not a name (e.g. 'gpt-4o') because resources are versioned, and the version used will differ based on the timestamp of the request. See Resource Versions for more information. |
use_case_id | The |
limits | A dictionary containing all ** |
cost | The breakdown of how much this request costs across input and output units. The cost of the call, as charged by the Provider is called the When a request has failed, usually due to being blocked by a limit, there is no cost and therefore this field is not returned. |
blocked_limit_ids | If a request is blocked by one or more limits, then this array contains the list of ** This array is only present if the call was blocked by one or more limits. |
Updated 21 days ago
