Supported Providers
Google Vertex AI

Google Vertex AI

Add the x-props-provider: google header.

Call Google Vertex AI via the OpenAI SDK

Props AI supports Google Vertex AI queries via the OpenAI SDK.

We'll take care of creating a mapping between the OpenAI SDK and the Google Vertex AI API, from formatting the request to handling the response.

import os
from openai import OpenAI
 
client = OpenAI(
    api_key=process.env.GOOGLE_AI_API_KEY,
    base_url="https://proxy.getprops.ai",
    default_headers={
        "x-props-key": process.env.PROPS_API_KEY,
        "x-props-provider": "google"
    }
)
 
chat_completion = client.chat.completions.create(
    messages=[
        {
            "role": "user",
            "content": "Say this is a test",
        }
    ],
    model="gemini-pro",        
    user="<USER_ID or STRIPE_SUBSCRIPTION_ID or INTERNAL_PROCESS_ID>"
)

Google Generative AI SDK

import { GoogleGenerativeAI } from "@google/generative-ai";
 
const genAI = new GoogleGenerativeAI(process.env.GOOGLE_AI_API_KEY);
 
const model = googleGenAIClient.getGenerativeModel(
    { model: "gemini-pro" },
    {
        customHeaders: {
            "x-props-key": process.env.PROPS_API_KEY,
            "x-props-provider": "google",
            "x-props-metadata": JSON.stringify({
                user: "<USER_ID or STRIPE_SUBSCRIPTION_ID or INTERNAL_PROCESS_ID>",
            }),
 
        },
        baseUrl: "https://proxy.getprops.ai/",
    }
);

REST

curl -X POST https://proxy.getprops.ai/v1beta/models/gemini-pro:generateContent?key=$GOOGLE_AI_API_KEY \
-H "Content-Type: application/json" \
-H "x-props-key: $PROPS_API_KEY" \
-H "x-props-provider: google" \
-H "x-props-metadata: {\"user\": \"<USER_ID or STRIPE_SUBSCRIPTION_ID or INTERNAL_PROCESS_ID>\"}" \
-d '{ contents: [{ parts: [{ text: "Explain how AI works" }] }] }'