Google Vertex AI API: Generate Content
ZenMux 支持 Google Vertex AI API,使用 Gen AI SDK,具体请求参数和返回结构详见,具体请求参数和返回结构详见 Google Vertex AI 官网。
SDK
bash
pip install google-genaibash
npm install @google/genai示例
Python
from google import genai
from google.genai import types
client = genai.Client(
api_key="$ZenMux_API_KEY",
vertexai=True,
http_options=types.HttpOptions(
api_version='v1',
base_url='https://zenmux.ai/api/vertex-ai'
),
)
response = client.models.generate_content(
model="google/gemini-2.5-pro",
contents="How does AI work?"
)
print(response.text)ts
const genai = require("@google/genai");
const client = new genai.GoogleGenAI({
apiKey: "$ZenMux_API_KEY",
vertexai: true,
httpOptions: {
baseUrl: "https://zenmux.ai/api/vertex-ai",
apiVersion: "v1"
}
});
const response = await client.models.generateContent({
model: "google/gemini-2.5-pro",
contents: "How does AI work?",
});
console.log(response);
或者也可以通过