import google.generativeai as genai
from google.api_core import client_options

# 配置代理地址
# 注意：这里不需要加 /v1beta 或 /v1，只填主机和端口
proxy_url = "https://generativelanguage.googleapis.com/v1beta/openai/"

genai.configure(
    api_key="AIzaSyCK8Ykg2UGzDV9ZmPAbbqOFgK3_9ghxZl4",
    transport="rest",
    client_options=client_options.ClientOptions(
        api_endpoint=proxy_url
    ),
)

model = genai.GenerativeModel('gemini-2.5-pro')
response = model.generate_content("介绍一下你自己，用50字中文回答。")

print(response.text)
