You can pass a dummy key for the API Key and it should work.
Here's the code snippet that you can use:
from portkey_ai import Portkey
portkey = Portkey(
base_url="http://localhost:8787/v1",
provider="openai",
Authorization="Bearer YOUR_OPENAI_API_KEY",
api_key="xxx"
)
resposne = portkey.chat.completions.create(
messages = [{ "role": 'user', "content": '42' }],
model = 'gpt-4'
)
As you can see,
api_key
refers to the Portkey API Key generally, where we can pass any dummy value, while
Authorization
is where you'd pass your whole OpenAI key string, including
Bearer
in the front.
Please let me know if this solves it for you!