All right, so I'll do some more typing since since the haters will yell at me if I don't, so I'll 好吧，所以我会再打字，因为如果我不打字，讨厌者就会对我大喊大叫，所以我会
do some typing. 打字。
Let's do it the proper way. 让我们以正确的方式来做吧。
Let's create an OpenAI Python client. 让我们创建一个 OpenAI Python 客户端。
You just say OpenAI equals OpenAI. 你只是说 OpenAI 就等于 OpenAI。
Oops, like so. 哎呀，就像这样。
And it by default looks in the uh, in the environment variable OpenAI API key by default if you don't 如果您不这样做，它默认会在环境变量 OpenAI API 密钥中查找
specify one. 请指定一个。
So that's just just hard coded in there. 所以这只是硬编码在那里。
And I have to say from OpenAI import OpenAI to be able to do that. 我不得不说从 OpenAI 导入 OpenAI 才能做到这一点。
Okay. 好的。
And now what we're going to say is, uh, response equals I guess it just fills it in. 现在我们要说的是，呃，响应等于我想它只是填充了它。
What's the point in me typing OpenAI chat dot completions dot create. 我输入 OpenAI 聊天点完成点创建有什么意义。
So that is basically saying I want to go to slash chat completions and I want to do a post request, 所以这基本上是说我想要进行斜杠聊天完成并且我想做一个发布请求，
which is like doing a create. 这就像进行创建一样。
And I'm going to pass in like I don't have to manufacture JSON. 我将传递就像我不必制造 JSON 一样。
I can just say model equals GPT five nano five nano. 我只能说模型等于 GPT 5 nano 5 nano。
Oh, I could just press tab. 哦，我可以按 Tab 键。
You know it. 你知道的。
You know what I'm gonna say? 你知道我要说什么吗？
messages is that list of dictionaries that I passed in right there. messages 是我在那里传递的字典列表。
And then instead of this fussy JSON plowing, I can just say response dot choices. 然后我可以直接说响应点选择，而不是这种繁琐的 JSON 操作。
Zero choices, zero dot message content. 零选择，零点消息内容。
And I'm just going through Python fields. 我只是浏览一下 Python 领域。
It's actually pedantic object of course, for people that know this stuff. 当然，对于了解这些东西的人来说，这实际上是一个迂腐的对象。
Uh, and uh, as a result, it's got all of the, all of the nice features of using proper Python methods 呃，呃，因此，它具有使用正确的 Python 方法的所有、所有好的功能
and attributes like, like the ID can check, I've spelt it right and things like that. 还有诸如 ID 可以检查、我拼写正确之类的属性。
I'm not just guessing, uh, values to to look into the JSON. 我不只是猜测，呃，查看 JSON 的值。
I know that I've got this right. 我知道我做对了。
And so I run this and we should get ourselves a new fun fact. 所以我运行这个，我们应该得到一个新的有趣的事实。
And the thing to, to understand, uh, here we go. 以及要理解的事情，呃，我们开始吧。
Bananas are berries, but strawberries aren't. 香蕉是浆果，但草莓不是。
Strawberries are not. 草莓则不然。
And and there we go. 我们就这样吧。
We've got our explanation for that. 我们对此有自己的解释。
A lovely, fun fact from GPT five nano. GPT 5 nano 的一个可爱又有趣的事实。
I hope you've been enjoying yours too. 我希望你也玩得很开心。
Of course, the point I'm trying to make to you is that this is exactly the same as doing it the boring 当然，我想向你说明的一点是，这与做无聊的事情完全相同。
way. 方式。
It's just this looks a little bit more elegant and simple. 只是这样看起来更加优雅和简单一些。
And the reason I show you this is so that hopefully, and maybe this is all obvious to you, in which 我向您展示这一点的原因是希望，也许这对您来说都是显而易见的，其中
case, well, hang on in there. 情况，好吧，坚持住。
But if not, it just shows you that's all that this library is. 但如果没有，它只是向您展示了这个库的全部内容。
At the end of the day, it's just a nice, simple wrapper around making an HTTP call to an API in the 归根结底，它只是一个很好的、简单的包装器，用于对 API 中的 HTTP 调用
cloud. 云。
And it by default it looks for OpenAI API key. 默认情况下，它会查找 OpenAI API 密钥。
And that's what it puts in that bearer in that that authorization field in the headers of the HTTP request. 这就是它在 HTTP 请求标头的授权字段中放置的内容。
And it's as simple as that. 就这么简单。
We have made our call to OpenAI on the cloud. 我们已经向云上的 OpenAI 发出了呼吁。
It looks like we did it with code. 看起来我们是用代码做到的。
In fact, it was an HTTP call over an endpoint. 事实上，这是通过端点进行的 HTTP 调用。
Over an endpoint. 越过一个端点。
What I meant to say was it's an endpoint call over HTTP. 我的意思是它是通过 HTTP 进行的端点调用。
All right. 好的。
So I've already typed all this. 所以我已经输入了所有这些内容。
We can get rid of that. 我们可以摆脱它。
Get rid of that. 摆脱它。
So so then something cool happened. 就这样，然后发生了一些很酷的事情。
So then OpenAI's chat completions API was so popular that all the other providers started to offer an 因此，OpenAI 的聊天完成 API 非常受欢迎，以至于所有其他提供商都开始提供
identical end point. 相同的终点。
So you could use exactly the same web request and and just call a different model instead, because 因此，您可以使用完全相同的 Web 请求，然后调用不同的模型，因为
people sort of converged on OpenAI's approach as a way to do it. 人们都倾向于将 OpenAI 的方法作为实现这一目标的一种方式。
So everyone else offered them to Gemini. 所以其他人都把它们送给了双子座。
Google, for example, they had one endpoint that was very specific to Gemini, and they were like, 例如，谷歌，他们有一个专门针对 Gemini 的端点，他们就像，
oh, I know what, we'll just give a second one that's identical for anyone that wants it. 哦，我知道什么，我们只会为任何想要它的人提供第二个相同的。
And out of all of them, anthropic held out the longest. 在所有这些中，人类坚持的时间最长。
They they obviously their enemy OpenAI. 他们显然是他们的敌人 OpenAI。
They didn't want that to become the standard. 他们不希望这成为标准。
So they held out. 所以他们坚持了下来。
But in the end they relented. 但最终他们还是妥协了。
And they also created an OpenAI compatible endpoint. 他们还创建了一个 OpenAI 兼容端点。
So now all of them have it. 所以现在他们都拥有了。
And for example, this is Google's one. 例如，这是谷歌的一个。
It's Https generative. 它是 Https 生成的。
OpenAI. 开放人工智能。
It's got OpenAI in its name. 它的名字中有 OpenAI。
That is their endpoint for making OpenAI compatible request. 这是他们发出 OpenAI 兼容请求的端点。
And because everybody did this, OpenAI decided, oh, I guess we'll be good corporate citizens, good 因为每个人都这样做了，OpenAI 决定，哦，我想我们会成为优秀的企业公民，很好
AI citizens. 人工智能公民。
Reasons. 原因。
And we'll say to people, look, you can use the same OpenAI library. 我们会对人们说，看，你可以使用相同的 OpenAI 库。
The same client library will allow you to say, hey, I don't actually want to talk to OpenAI's endpoint. 同一个客户端库将允许您说，嘿，我实际上不想与 OpenAI 的端点对话。
I want to switch to a different endpoint like this. 我想像这样切换到不同的端点。
You can say OpenAI base URL equals and switch to a different URL and pass in a different API key. 您可以说 OpenAI 基本 URL 等于并切换到不同的 URL 并传入不同的 API 密钥。
And if you do that, then you can talk to Gemini using OpenAI's client library because it's just simple, 如果你这样做了，那么你就可以使用 OpenAI 的客户端库与 Gemini 交谈，因为它很简单，
lightweight code. 轻量级代码。
That's it. 就是这样。
And so yeah, just to be crystal clear, even though OpenAI is is in our code here, we're not actually 所以，是的，澄清一下，尽管 OpenAI 存在于我们的代码中，但我们实际上并没有
using anything to do with OpenAI's models. 使用任何与 OpenAI 模型有关的东西。
We're just using their lightweight code to make an endpoint request. 我们只是使用他们的轻量级代码来发出端点请求。
And you might know all this back to front. 你可能从头到尾都知道这一切。
This might be super obvious to you, but you'd be amazed how many people are confused by this and that 这对你来说可能是非常明显的，但你会惊讶地发现有多少人对此感到困惑
this can be really refreshing to understand exactly how this works. 了解其工作原理确实令人耳目一新。
So if you're in that category, then then, then I'm pleased to hear it and it's going to hopefully 所以，如果你属于这一类，那么，那么我很高兴听到它，并且希望它会
make a lot of sense what we do next. 让我们接下来要做的事情变得很有意义。
Okay. 好的。
So uh, we are going to look at Gemini's base URL. 所以呃，我们要看看 Gemini 的基本 URL。
That's the one I just showed you. 这就是我刚刚给你看的那个。
It's like a Google URL with OpenAI stuffed at the end of it. 它就像一个末尾填充了 OpenAI 的 Google URL。
In my EMV file, I have a Google API key. 在我的 EMV 文件中，我有一个 Google API 密钥。
Now you might not do it, in which case, don't worry, just just skip this next one. 现在您可能不会这样做，在这种情况下，不用担心，只需跳过下一个即可。
But if you do, if you've got a Gemini or a Gemini API key, then then hopefully you've added Google 但如果你这样做了，如果你有 Gemini 或 Gemini API 密钥，那么希望你已经添加了 Google
API key to your EMV file. 您的 EMV 文件的 API 密钥。
Uh, then then you can run this cell and uh, I'm just going to run it and it's going to confirm that 呃，然后你可以运行这个单元格，呃，我将运行它，它将确认
it found a Google API key in my EMV, and that it has the right format R and Z. 它在我的 EMV 中找到了 Google API 密钥，并且它具有正确的 R 和 Z 格式。
And if you yeah, if you want to get yourself an API key, you can you can head over. 如果你是的，如果你想给自己一个 API 密钥，你可以直接过去。
The instructions are in guide nine. 说明位于指南九中。
That will tell you exactly what you need to do. 这会准确地告诉您需要做什么。
Okay. 好的。
So now look at this line Gemini is OpenAI. 那么现在看这条线Gemini就是OpenAI。
Remember it's just the lightweight Python client library. 请记住，它只是轻量级 Python 客户端库。
We give it the Gemini base URL and we give it the Google API key. 我们给它 Gemini 基本 URL，并给它 Google API 密钥。
And that has now given me a, a basically like a class that's ready to connect to Gemini. 现在，这给了我一个基本上就像一个准备连接到 Gemini 的类。
Okay. 好的。
So what we can basically do is take exactly the same code that we had before. 所以我们基本上可以做的就是采用与之前完全相同的代码。
Come back up here. 回到这里来。
I can just copy this. 我可以复制这个。
I can come down here and I can use the identical code. 我可以下来这里，我可以使用相同的代码。
The only difference is I'm going to change the word OpenAI to be the word Gemini. 唯一的区别是我要把 OpenAI 这个词改为 Gemini 这个词。
And I'm obviously also going to change the model. 显然我也会改变模型。
If I try and talk to Gemini with GPT five, it'll say what it's not. 如果我尝试用 GPT 5 与 Gemini 交谈，它会说不是什么。
That's not our stuff. 那不是我们的东西。
So we have to make this something like Gemini 2.5 Pro. 所以我们必须把它做得像 Gemini 2.5 Pro 那样。
We'll get a fun fact from the top range model. 我们将从顶级型号中得到一个有趣的事实。
Let's check. 让我们检查一下。
This looks right. 这看起来是对的。
It does. 确实如此。
Let's give this a whirl. 让我们尝试一下。
So we are now asking Google's strongest model on the planet. 所以我们现在正在询问谷歌地球上最强大的模型。
As of now, you might be a Gemini three user, in which case you will have great fun getting a hopefully 截至目前，您可能是 Gemini 3 用户，在这种情况下，您将获得一个充满希望的乐趣
a more profound fun fact than my one. 这是比我的更深刻有趣的事实。
Uh, and here is the answer a group of flamingos is called a flamboyance. 呃，这就是答案，一群火烈鸟被称为“华丽”。
Uh, there you go. 呃，就这样吧。
Uh, if you knew that, then you're obviously very good at trivia. 呃，如果你知道这一点，那么你显然很擅长琐事。
Um, but there is the short, uh, and punchy fun fact from Google's Gemini 2.5 Pro, and I hope you 嗯，但是 Google 的 Gemini 2.5 Pro 有一个简短、呃、有力的有趣事实，我希望你
enjoyed it. 很享受。