OpenAI
The
x-props-provider
header defaults to "openai" if not specified.
OpenAI SDK
from openai import OpenAI
client = OpenAI(
api_key="<OPENAI_API_KEY>",
base_url="https://proxy.getprops.ai",
default_headers={
"x-props-key": "<PROPS_API_KEY>",
"x-props-provider": "openai"
}
)
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "Say this is a test",
}
],
model="gpt-4-turbo",
user="<USER_ID or STRIPE_SUBSCRIPTION_ID or INTERNAL_PROCESS_ID>",
)
REST
curl -X POST https://proxy.getprops.ai/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "x-props-key: $PROPS_API_KEY" \
-H "x-props-provider: openai" \
-d '{
"messages": [
{
"role": "user",
"content": "Write a short sentence in 5 words."
}
],
"model": "gpt-3.5-turbo",
"user": "<USER_ID or STRIPE_SUBSCRIPTION_ID or INTERNAL_PROCESS_ID>"
}'