Comment on page
You can send custom metadata along with your API requests in Portkey, which can be later used for auditing or filtering logs. Portkey provides four predefined keys:
_prompt. These predefined keys are indexed and allow for filtering data in Portkey analytics and logs sections. You can still pass any other metadata key you desire, but these four predefined keys will be indexed and will be available for filtering data in Portkey.
All predefined keys should be of type String, with max-length as 128 characters.
To include metadata in the proxy requests, you can add an
x-portkey-metadataheader with a JSON string containing your metadata. Portkey will parse the JSON object and make it available for filtering.
When using the _user predefined key, the following behavior applies:
If you pass the
userkey in the OpenAI request body, it will be automatically stored in
_user. If both the OpenAI request body
userkey and the metadata
_userkey are passed, the metadata
_userkey will be stored.
You can filter your logs with the predefined keys (
_prompt)easily on the Portkey logs.