关于如何白嫖gemini-2.5-pro-preview-06-05……

嗯,首先:
1.通过Vertex快速模式账号在Vertex中可以免费调用gemini-2.5-pro-preview-05-06
2.谷歌的API文档中说明,gemini-2.5-pro-preview-05-06会被重定向到gemini-2.5-pro-preview-06-05

如果这个重定向包含Vertex快速模式的调用,是不是意味着,可以爽嫖谷歌最新的gemini-2.5-pro-preview-06-05了? :nerd_face: :index_pointing_up:


无需等待重定向,已经得出Vertex快速模式直接调用gemini-2.5-pro-preview-06-05的方法!无限制免费用到爽!

下午罗盘佬(@Compass)的回复虽然无法测通,但带来了非常大的启发。


然后我去找了vertex2openai项目的作者Qi佬进行讨论,由Qi佬测试出了通过修改请求URL的方法直接调用gemini-2.5-pro-preview-06-05的方法:


补充:Qi佬的vertex2openai项目已更新。


最后,由唐洛佬(@tbphp)提出了在newapi中的渠道填写方法:

渠道选Google Gemini

40 个赞

快速模式直接调API不行 只能这么曲线了

Vertex直接调用0605需要区域global,而快速模式无法指定区域,所以无法直接调用。只能期望会被重定向。

1 个赞

原来如此 谷歌大善人继续善下去吧 【虽然感觉要收紧了 毕竟模型越强用的人越多算力越不够了

学废了,

3 个赞

快速模式用户路过,等佬更新白嫖。。。gcp扛不住用

快速模式应该是还没有重定向,现在思考预算还是不能设置,模型生成的内容也和之前没有区别

学废了

快速模式给出的调用代码示例中我看这不是可以指定区域吗?

import { GoogleGenAI } from '@google/genai';

// Initialize Vertex with your Cloud project and location
const ai = new GoogleGenAI({
  vertexai: true,
  project: 'xxx',
  location: 'global'
});
const model = 'gemini-2.5-pro-preview-06-05';


// Set up generation config
const generationConfig = {
  maxOutputTokens: 65535,
  temperature: 1,
  topP: 1,
  seed: 0,
  safetySettings: [
    {
      category: 'HARM_CATEGORY_HATE_SPEECH',
      threshold: 'OFF',
    },
    {
      category: 'HARM_CATEGORY_DANGEROUS_CONTENT',
      threshold: 'OFF',
    },
    {
      category: 'HARM_CATEGORY_SEXUALLY_EXPLICIT',
      threshold: 'OFF',
    },
    {
      category: 'HARM_CATEGORY_HARASSMENT',
      threshold: 'OFF',
    }
  ],
};


async function generateContent() {
  const req = {
    model: model,
    contents: [
    ],
    config: generationConfig,
  };

  const streamingResp = await ai.models.generateContentStream(req);

  for await (const chunk of streamingResp) {
    if (chunk.text) {
      process.stdout.write(chunk.text);
    } else {
      process.stdout.write(JSON.stringify(chunk) + '\n');
    }
  }
}

generateContent();
1 个赞

这不是快速模式的示例代码吧?快速模式有个 API_KEY = "YOUR_API_KEY"
我在Vertex快速模式的API文档里看到的代码示例是这样的:

from google import genai
from google.genai import types

def generate():
  client = genai.Client(vertexai=True, api_key=YOUR_API_KEY)
  
  config=types.GenerateContentConfig(
      temperature=0,
      top_p=0.95,
      top_k=20,
      candidate_count=1,
      seed=5,
      max_output_tokens=100,
      stop_sequences=["STOP!"],
      presence_penalty=0.0,
      frequency_penalty=0.0,
      safety_settings=[
          types.SafetySetting(
              category="HARM_CATEGORY_HATE_SPEECH",
              threshold="BLOCK_ONLY_HIGH",
          )
      ],
  )
  for chunk in client.models.generate_content_stream(
    model="gemini-2.0-flash-001",
    contents="Explain bubble sort to me",
    config=config,
  ):
    print(chunk.text)

generate()

你发的那个像调用正版Vertex的代码,而非快速模式的。

这个Vertex里的api和哪个gcp300的是不是两个东西呀,

,截图的这个不知道怎么用

1 个赞

两个东西。
这个快速模式api接入newapi的话,
渠道选Google Gemini, URL填https://aiplatform.googleapis.com/v1/publishers即可。

4 个赞

好感谢解答,这个cherry不能直接用吗?我试了下好像不行。

1 个赞

你切换语言到nodejs看下

找了半天没有发现快速模式的api有提供nodejs格式的代码示例……

1 个赞

我没用过cherry,具体不太清楚呢。

1 个赞

在这个地方

感谢,这就研究一下。

感谢佬友,虽然这个示例代码实测后无法测通(因为实际上是正版Vertex的调用方法,并没有传入快速模式独有的api_key参数),但依然起到了非常大的启发作用。

Vertex快速模式免费调用0605的方法已有佬基本科研成功。

快速模式可以免费调用0605啊。方法会公布出来吗 :face_holding_back_tears: