兼容 OpenAI——沿用你现有的 SDK
https://api.orcarouter.ai/v1https://api.orcarouter.aifrom openai import OpenAI
client = OpenAI(
base_url="https://api.orcarouter.ai/v1",
api_key="$ORCAROUTER_API_KEY",
)
response = client.chat.completions.create(
model="google/gemini-flash-latest",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)max_tokensresponse_formatseedstopstructured_outputstemperaturetool_choicetoolstop_pinclude_reasoningreasoning| 输入 / 1M tokens | $0.500 |
| 输出 / 1M tokens | $3.00 |
| 缓存读取 / 1M | $0.100 |
| 货币 | USD |
基于标价的估算
仅为估算——实际 Token 数取决于提供商的分词器。
@misc{orcarouter_gemini_flash_latest,
title = {google/gemini-flash-latest API},
author = {google},
year = {n.d.},
howpublished = {OrcaRouter},
url = {https://www.orcarouter.ai/models/google/gemini-flash-latest}
}google. (n.d.). google/gemini-flash-latest API. OrcaRouter. https://www.orcarouter.ai/models/google/gemini-flash-latest