By default, all the responses sent back from Portkey are compliant with the OpenAI specification.
In some cases, a response from a provider like Perplexity may contain useful fields which do not have a corresponding 1:1 mapping to OpenAI fields.
To get those fields in the response, you can do one of the following:
Python SDK: Pass this parameter strict_open_ai_compliance=false when initializing the portkey client
Node SDK: Pass this parameter strictOpenAiCompliance: false when initializing the portkey client
HTTP requests: Pass this header x-portkey-strict-open-ai-compliance: false with your request
By default strict_open_ai_compliance=false in Portkey Python and Node SDK
Copy
Ask AI
from portkey_ai import Portkeyportkey = Portkey( api_key="PORTKEY_API_KEY", provider="@PROVIDER", strict_open_ai_compliance=False)
Copy
Ask AI
from portkey_ai import Portkeyportkey = Portkey( api_key="PORTKEY_API_KEY", provider="@PROVIDER", strict_open_ai_compliance=False)
Copy
Ask AI
import Portkey from 'portkey-ai'const portkey = new Portkey({ apiKey: "PORTKEY_API_KEY", provider:"@PROVIDER", strictOpenAiCompliance: false})
Add the following header to your request
x-portkey-strict-open-ai-compliance: false