AI从零开始(第6课):用一张核对卡读懂AI计费单位

本文聚焦AI服务中易被忽视的计费单位识别与费用核算方法,强调区分聊天工具与API接口、理解Token计量逻辑、识别输入/输出分计价机制,并提出六项关键核对要素(模型、单位、价格来源、输入/输出Token量、缓存规则、其他计费项)。通过虚构示例和纸面练习,帮助读者建立准确读取报价的能力,避免因单位误读导致的成本误判。

“这个AI一百万Token才几元,是不是发一条消息几乎不用钱?”

第一次看到AI接口价格,很容易盯住那个数字。可在算便不便宜之前,我们得先弄清:这个价格给谁用、买的是什么、单位是什么,还有哪些条件。

前几课练了提问、消息改写、清单和原文核对。今天不登录新账户、不填密钥、不做实际请求,只用一张纸,学会做“费用核对卡”。

1. 先分清:聊天工具与接口是两种使用方式

聊天工具通常是你直接打开界面输入文字;API接口可以简单理解为“软件向模型提出请求的连接方式”。不同产品可能按订阅、用量、次数或组合规则收费,买了某个聊天产品的会员,不代表它的API用量也包含在里面。例如OpenAI的官方费用说明区分了ChatGPT订阅与API计费;其他服务仍要看自己的产品和账户规则,不能只认相似的名字。

今天只学习识读报价,不要求马上接API。你可以先继续做前几课的纸面练习。

2. 报价像买东西,数字旁边的单位同样重要

买水果时,“每斤2元”和“每箱2元”不能只比较那个2。AI也一样:

看到的单位先核对什么
每千/每百万Token是输入价、输出价,还是某一种缓存用量?
每张图片哪种尺寸、质量,计哪一类成功结果?
每秒视频什么分辨率,按实际时长还是参考估算?
每次/每月有没有次数、功能或额外用量限制?

这些是读报价的方向,不表示所有产品都提供这些收费方式或相同功能。不同单位不能直接互换。

Token不是固定数量的汉字。它是模型处理文字等内容时使用的一种计量单位,数量受模型、文本和语言影响。把“一千字”直接当成“一千Token”,可能从第一步就算错了。官方Token解释

3. 你发出去的与AI返回的,可能分开计价

可以先这样理解两类文字用量:

  • 输入:你交给模型的材料和要求。某些对话实现还会把前面的消息一起发出,不能总当成只传了最后一句。
  • 输出:模型生成的内容。某些模型还涉及不直接展示为文字的推理用量,不能只数屏幕上的字来确认费用。

它们可能用不同单价。下面只用虚构示例练习,数字只为练习,不对应实际产品价格:

假设:输入价每百万Token 2元,输出价每百万Token 8元。
假设:输入10000 Token,输出2000 Token。
假设:没有缓存、图片、工具或其他费用,也没有特殊账户规则。

输入:10000 ÷ 1000000 × 2 = 0.020元
输出: 2000 ÷ 1000000 × 8 = 0.016元
合计:0.036元(只是假设演算,不是账单)

这里为什么不能只算0.020元?因为那只覆盖输入,没有算返回内容。

也不要据此承诺“每条消息都是0.036元”。真实输入与输出会变化,目标模型、单位、价格档位、缓存和账户条件也可能不同。

4. 一次只核对这六件事

把这张卡保存到自己的笔记里。下次看到价格,先填写,空着的地方先问清楚。

费用核对卡
1. 对象:哪个产品、精确模型和账户条件?
2. 单位:什么币种,每多少Token/张/秒/次?
3. 分类:输入、输出、缓存或其他项目怎样分别计?
4. 条件:版本、档位、适用日期和规格是什么?
5. 证据:价格来自哪页,用量来自哪里,哪些还未知?
6. 边界:这是演算、估算,还是已核对的实际账单?

不会填“缓存”也没关系。今天先记住:它是一项需要具体规则和用量证据的条件,不能把重复问问题理解成一定享有缓存价格。

5. 用这张提示词卡,请AI帮你找缺项

你可以在纸面上模拟回答,也可以用自己已有权限的文字工具。先看工具自身规则,任何实际请求都可能计费,不以免费为前提。

请帮我检查下面这份虚构费用说明。
不要查询实时价格,不要推荐产品,不要替我操作账户。

材料:输入价是每百万Token 2元,输出价是每百万Token 8元;
假设输入10000 Token、输出2000 Token,无其他费用。

请按三项回答:
1. 逐步写出演算,保留单位;
2. 列出真实使用前还缺哪些条件;
3. 明确说明哪些结论不能从这份材料推出。
不要把这个例子当成任何产品的实际报价或账单。

人工参考答案:合计0.036元;真实使用前还要确认具体模型、价格来源和日期、账户条件、是否还有其他计费项;不能推出所有消息同价、字符数等于Token,或者界面显示0就一定没有收费。这里是人工教学说明,没有执行模型测试。

6. 最容易误会的几件事

“界面只显示0.00,是不是没产生费用?” 不一定,可能只是显示的小数位有限。看单位、精度说明和实际用量记录,不靠一个显示数字下结论。

“请求失败,是不是一定不收费?” 不同服务与处理阶段可能有不同规则,不能只看客户端提示就断言。先查对应说明,别为了验证连续重试。

“我给AI设了预算,它能保证不超吗?” 在提示词里写“不要超过1元”只是文字要求,不能替代软件的限制和服务的真实计费规则。本课不设置任何真实账户额度。

“模型说这次花了多少钱,可以直接相信吗?” 如果它没有可靠的价格和用量证据,那可能只是推测。保留未知,不让它编一个看似精确的数字。

今天的小练习

把虚构示例里的输出改为4000 Token。只做纸面演算:输入0.020元、输出0.032元,合计0.052元。然后写一句话:“这是规定假设下的算术结果,不是我的实际支出。”

再把“每百万Token”圈出来,想想:如果报价单位变成每千Token,数字还能够原样抄过来吗?今天不必比较谁便宜,先把单位读对。

近期检索到的政府采购优惠与企业合作公告,都不能直接作为普通读者的实际价格。本课采用常青教学,不提供即时价格推荐。所有模板均已放在正文中,可以自行保存和修改。

下一课一起回看第一周:把任务、资料、格式、核验和费用整理成一张能反复使用的五格提问卡。

你还想弄明白哪一种AI计费单位?欢迎在评论区提出问题,可用虚构数字说明,不要贴账号、账单、密钥或其他隐私。

作者说明:本文经AI辅助整理与校对。费用、用量与参考回答为虚构教学示意,没有实际模型请求,也没有读取或处理任何人的账单与支付信息。

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值