Posted in: IT, Mobile/iOS, PC/macOS

花 5 美元用上了GPT-4 API


去年5月底 GPT-4 API 刚开始启用时是采用邮件邀请的方式,我申请了,收到了如下回复邮件:

Thank you for joining the waitlist to build with GPT-4!

To balance capacity with demand, we’ll be sending invites gradually over time.

While we ramp up, invites will be prioritized to developers who have previously build with the OpenAI API. You can also gain priority access if you contribute model evaluations to OpenAI Evals that get merged, as this will help us improve the models for everyone.

Once you’re off the waitlist, you’ll receive an email with further instructions on how to get started. We will process requests for the 8K and 32K models at different rates based on capacity, so you can expect to receive 8K access first.

We appreciate your interest, and look forward to having you build with GPT-4 soon. In the meantime, we suggest getting started with gpt-3.5-turbo, the model powering ChatGPT.

– The OpenAI Team

P.S. You can also preview GPT-4 on chat.openai.com if you’re a ChatGPT Plus subscriber. We expect to be severely capacity constrained, so there will be a usage cap for the model depending on demand and system performance.

虽然结尾提到可以订阅 ChatGPT Plus,但问题是那是包月每月20💲,太贵。我没订阅。然后就没有然后了,一直等了快一年,没有任何回应。

之后,我要么用网页版的 ChatGPT(想写代码时),要么用 API (想划词翻译时),总之都是傻瓜式的 GPT-3.5 。每个月 API 的消费量大约是 0.01💲~0.08💲,由于没有达到 Pay as you go 的阈值,账单始终免费。

逼宫

大概是 OpenAI 公司觉得这羊毛被薅得太狠了,今天早上起来突然收到了这封邮件:

Action required: Upcoming changes to your OpenAI API billing
Hi there,
We’re reaching out to share that we will be updating how we bill for your OpenAI API account starting March 8, 2024. Instead of receiving a bill at the end of the month, you will need to pre-purchase credits to use the API.
Action required: To continue using the API, please add credits to your account by visiting the billing page. It’s important to purchase credits by March 8, 2024 to avoid API requests being interrupted for your application—if your account does not have sufficient credits on this date, API requests will temporarily fail for your application until credits are purchased. (You can learn more about prepaid billing.) If you recently purchased credits, no additional action is required.
Please note that this change only applies to your OpenAI API account. It does not affect ChatGPT Plus or Team subscriptions.
Best,
The OpenAI team

意思就是你不能再每个月白嫖 0.08💲 这样子了,从3月8日开始必须得给我们充值才行。充值的最低限额在充值页面有介绍,是 5💲。

那么不充值的话,GPT – 3.5 的 API 都不能用了。我开始想着是干脆就不用 API,只用网页版好了。后来偶尔看到 How can I access GPT-4? 的介绍才发现:原来充值了 5 💲后,可以使用 GPT-4 API!

API 价格

GPT-4 最便宜的是 gpt-4-turbo-preview (目前会重定向到 gpt-4-0125-preview),每百万tokens 的价格是 Input 10💲,Output 30💲,GPT-3.5 则是 Input 0.5💲,Output 1.5💲。相比之下 GPT-4 贵 20 倍。这意味着以前我每个月只花 0.08💲的现在每个月需要花 1.6💲(听起来好像还能接受?😄)

注意:充值的5💲一年之后过期,也就是说每个月平均要使用0.4💲。

尝试

官方文档的 curl 来尝试,就问一个问题:美国的人口数量是多少?下图例子中 API key 用 sk-D1111111111111 来表示:

gpt-3.5-turbo 来问:

curl https://api.openai.com/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer sk-D1111111111111"   -d '{
>     "model": "gpt-3.5-turbo",
>     "messages": [
>       {
>         "role": "user",
>         "content": "Tell me the population of USA."
>       }
>     ]
>   }'

回答结果是:As of 2021, the population of the United States is estimated to be around 331 million people.

{
  "id": "chatcmpl-111111111111111111111",
  "object": "chat.completion",
  "created": 1111111111,
  "model": "gpt-3.5-turbo-0125",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "As of 2021, the population of the United States is estimated to be around 331 million people."
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 14,
    "completion_tokens": 22,
    "total_tokens": 36
  },
  "system_fingerprint": "fp_1111111111"
}

再用 gpt-4-turbo-preview 来问:

curl https://api.openai.com/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer sk-D1111111111111"   -d '{
>     "model": "gpt-4-turbo-preview",
>     "messages": [
>       {
>         "role": "user",
>         "content": "Tell me the population of USA."
>       }
>     ]
>   }'

回答结果是:As of my last update in April 2023, the estimated population of the United States was around 333 million people. However, remember that population numbers are continually changing due to births, deaths, and migration. For the most current population estimate, it's best to check the latest data from sources such as the U.S. Census Bureau or other official population statistics agencies.

{
  "id": "chatcmpl-111111111111111111",
  "object": "chat.completion",
  "created": 11111111111,
  "model": "gpt-4-0125-preview",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "As of my last update in April 2023, the estimated population of the United States was around 333 million people. However, remember that population numbers are continually changing due to births, deaths, and migration. For the most current population estimate, it's best to check the latest data from sources such as the U.S. Census Bureau or other official population statistics agencies."
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 14,
    "completion_tokens": 75,
    "total_tokens": 89
  },
  "system_fingerprint": "fp_111111111"
}

知识库确实更新了,不过废话多了(completion_tokens值大了,从22变成了89),计费是按照 token 来计算的,果然赚钱有门路啊!

开源节流?

我在想 OpenAI 是不是在巧妙地搞开源节流?

  • 开源:从3月8日开始强制每个 API 用户都至少充值 5💲,否则你连 GPT-3.5 也不能用。
  • 节流:GPT-4 一年前采用的是邮件邀请模式,现在是只要充值5💲就能用,肯定是中途某个时间点改的,然而改了之后居然不用邮件通知一下像我一样还在傻傻地等待邮件排队的用户,明显就是不想让那么多的人用GPT-4 的 API。毕竟,GPT-4太消耗系统资源了。

套用到捷径

ChatGPT + macOS/iOS捷径:用于翻译和润色的无敌神器 一文里面,把 model 的值从 gpt-3.5-turbo 换成 gpt-4-turbo-preview ,仍然可用。偶尔有时会说你没有权限,再试一次就好了,原因不明。

不过由于价格贵了 20 倍,而且现在不是 Pay as you go 的模式,而是预付费之后扣款,没有抹零技巧了,所以要悠着点用。可是充值的5💲一年之后又会过期,所以也要适当用,不能完全不用。这节奏真难把握😣。

使用客户端 app

如果你想实现网页版一对一💬(闲聊)那种模式,可以找找支持 API 的客户端。在 macOS 上可以使用 macai,其他平台我还没试过,但这种客户端 app 太多了,自己找一个就行了。还是那句话,GPT-4 的 API 比 3.5 要贵20倍,所以不要闲聊过头了!

Comments (12) on "花 5 美元用上了GPT-4 API"

    1. Safari 17.3.1 Mac OS X  10.15.7

      免费的 3.5 因为知识库只到 2021 年,写一些最新的代码时(我说的主要是 vue,最近有很多新特性)就不够用了

    1. Safari 17.3.1 Mac OS X  10.15.7

      對於我來說幫助很大,因為要寫英文論文,它可以幫忙改語法!

  1. Google Chrome 122.0.0.0 Windows 10 x64 Edition

    看过很多文章说ChatGPT,但我搞不清哪个版本是对应什麽用途会更好。不过我还没有付款使用,暂时没有这方面的需求。

    1. Safari 17.4 Mac OS X  10.15.7

      如果你要查詢的知識點是在2021年以及之前,用免費版的3.5就可以。否則需要4.0版

  2. Google Chrome 122.0.0.0 Mac OS X  10.15.7

    感觉3.5在大多数问题上反而比4.0更能把握住提问的重点。
    不过可能是我提问技巧太原始了,离那种prompts大师还有不少距离hhh

    1. Safari 17.4 Mac OS X  10.15.7

      免费的3.5能用的话当然好。但是注意它的知识点只到2022年1月,不能应付后续的内容了。

  3. Google Chrome 86.0.4240.198 Windows 10 x64 Edition

    每个月花 1.6。这算开销么?还是要支持一下OpenAI嘛。别把人薅秃了。 😛

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注