@dexterai/x402 3.18.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -5
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +32 -70
- package/dist/client/index.d.ts +32 -70
- package/dist/client/index.js +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.cts +5 -107
- package/dist/react/index.d.ts +5 -107
- package/dist/react/index.js +1 -1
- package/dist/server/index.cjs +1 -286
- package/dist/server/index.d.cts +1 -724
- package/dist/server/index.d.ts +1 -724
- package/dist/server/index.js +1 -286
- package/dist/{x402-client-Ug0vrj74.d.ts → x402-client-BQKDeNxq.d.cts} +1 -123
- package/dist/{x402-client-DmRbvqoc.d.cts → x402-client-BQKDeNxq.d.ts} +1 -123
- package/package.json +1 -1
- package/assets/openai-pricing.md +0 -385
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SponsoredRecommendation, SponsoredAccessSettlementInfo } from '@dexterai/x402-ads-types';
|
|
2
|
-
import { C as ChainAdapter, W as WalletSet, A as AccessPassClientConfig, P as PaymentAccept, S as SettlementProbe } from './types-xQu1U4xk.cjs';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Sponsored Access (Ads for Agents) — Client Helpers
|
|
@@ -130,104 +129,6 @@ interface PaymentReceipt {
|
|
|
130
129
|
* Get the x402 payment receipt from a response, or undefined if none.
|
|
131
130
|
*/
|
|
132
131
|
declare function getPaymentReceipt(response: Response): PaymentReceipt | undefined;
|
|
133
|
-
/**
|
|
134
|
-
* Client configuration
|
|
135
|
-
*
|
|
136
|
-
* @deprecated Slated for removal in `@dexterai/x402` 5.0 alongside
|
|
137
|
-
* `createX402Client` and `X402Client`. Use `PayAndFetchOptions` instead.
|
|
138
|
-
*/
|
|
139
|
-
interface X402ClientConfig {
|
|
140
|
-
/**
|
|
141
|
-
* Chain adapters to use for building transactions.
|
|
142
|
-
* If not provided, uses Solana and EVM adapters by default.
|
|
143
|
-
*/
|
|
144
|
-
adapters?: ChainAdapter[];
|
|
145
|
-
/**
|
|
146
|
-
* Wallets for each chain type.
|
|
147
|
-
* Can also pass a single wallet for backwards compatibility.
|
|
148
|
-
*/
|
|
149
|
-
wallets?: WalletSet;
|
|
150
|
-
/**
|
|
151
|
-
* Legacy: Single wallet (Solana).
|
|
152
|
-
* Use `wallets` for multi-chain support.
|
|
153
|
-
*/
|
|
154
|
-
wallet?: unknown;
|
|
155
|
-
/**
|
|
156
|
-
* Preferred network to use when multiple options are available.
|
|
157
|
-
* CAIP-2 format (e.g., 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', 'eip155:8453')
|
|
158
|
-
*/
|
|
159
|
-
preferredNetwork?: string;
|
|
160
|
-
/**
|
|
161
|
-
* Custom RPC URLs by network
|
|
162
|
-
*/
|
|
163
|
-
rpcUrls?: Record<string, string>;
|
|
164
|
-
/**
|
|
165
|
-
* Maximum payment amount allowed (in atomic units).
|
|
166
|
-
* Rejects payments exceeding this amount.
|
|
167
|
-
*/
|
|
168
|
-
maxAmountAtomic?: string;
|
|
169
|
-
/**
|
|
170
|
-
* Custom fetch implementation
|
|
171
|
-
*/
|
|
172
|
-
fetch?: typeof globalThis.fetch;
|
|
173
|
-
/**
|
|
174
|
-
* Enable verbose logging
|
|
175
|
-
*/
|
|
176
|
-
verbose?: boolean;
|
|
177
|
-
/**
|
|
178
|
-
* Access pass configuration.
|
|
179
|
-
* When present, the client will prefer purchasing time-limited access passes
|
|
180
|
-
* over per-request payments. One payment grants unlimited requests for a duration.
|
|
181
|
-
*/
|
|
182
|
-
accessPass?: AccessPassClientConfig;
|
|
183
|
-
/**
|
|
184
|
-
* Called before signing a payment. Return true to proceed, false to reject.
|
|
185
|
-
* Use for budget controls, confirmation prompts, or logging.
|
|
186
|
-
*
|
|
187
|
-
* @example
|
|
188
|
-
* ```typescript
|
|
189
|
-
* const client = createX402Client({
|
|
190
|
-
* wallets,
|
|
191
|
-
* onPaymentRequired: async (requirements) => {
|
|
192
|
-
* const amount = Number(requirements.amount) / 1e6;
|
|
193
|
-
* if (amount > 1.0) return false; // Reject payments over $1
|
|
194
|
-
* console.log(`Paying $${amount} on ${requirements.network}`);
|
|
195
|
-
* return true;
|
|
196
|
-
* },
|
|
197
|
-
* });
|
|
198
|
-
* ```
|
|
199
|
-
*/
|
|
200
|
-
onPaymentRequired?: (requirements: PaymentAccept) => boolean | Promise<boolean>;
|
|
201
|
-
/**
|
|
202
|
-
* Called the instant the signed payment authorization is sent to the
|
|
203
|
-
* merchant — after `buildTransaction`, immediately before the paid retry
|
|
204
|
-
* fetch. This is the point past which a timeout can no longer be treated
|
|
205
|
-
* as "no money moved": the facilitator may settle at any time once the
|
|
206
|
-
* authorization is in its hands.
|
|
207
|
-
*
|
|
208
|
-
* The callback receives the `accept` it is paying against (network, asset,
|
|
209
|
-
* amount, payTo) and the `settlementProbe` the adapter produced (or
|
|
210
|
-
* `undefined` for schemes with no on-chain confirmation). `payAndFetch`
|
|
211
|
-
* uses this to mark a payment as dispatched — so a post-payment abort is
|
|
212
|
-
* not misreported as a plain timeout — and keeps the probe so it can
|
|
213
|
-
* confirm settlement on-chain if the merchant never responds.
|
|
214
|
-
*
|
|
215
|
-
* Fire-and-forget — the return value is ignored, and a throw is swallowed
|
|
216
|
-
* (the payment proceeds regardless). Do not do slow work here.
|
|
217
|
-
*/
|
|
218
|
-
onPaymentDispatched?: (accept: PaymentAccept, settlementProbe?: SettlementProbe) => void;
|
|
219
|
-
/**
|
|
220
|
-
* Maximum retry attempts for transient failures (network errors, 502/503).
|
|
221
|
-
* Does not cause double payments — EIP-3009 nonces prevent replay.
|
|
222
|
-
* @default 0 (no retry)
|
|
223
|
-
*/
|
|
224
|
-
maxRetries?: number;
|
|
225
|
-
/**
|
|
226
|
-
* Base delay between retries in milliseconds (doubles each attempt).
|
|
227
|
-
* @default 500
|
|
228
|
-
*/
|
|
229
|
-
retryDelayMs?: number;
|
|
230
|
-
}
|
|
231
132
|
/**
|
|
232
133
|
* x402 Client interface
|
|
233
134
|
*
|
|
@@ -241,28 +142,5 @@ interface X402Client {
|
|
|
241
142
|
*/
|
|
242
143
|
fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
|
|
243
144
|
}
|
|
244
|
-
/**
|
|
245
|
-
* Create an x402 v2 client
|
|
246
|
-
*
|
|
247
|
-
* @deprecated Slated for removal in `@dexterai/x402` 5.0 (~6 months out — long
|
|
248
|
-
* cycle because of real production consumers). Use `payAndFetch` from
|
|
249
|
-
* `@dexterai/x402/client` instead — it's version-agnostic across x402 v1 and
|
|
250
|
-
* v2 and returns a discriminated union for cleaner error handling.
|
|
251
|
-
*
|
|
252
|
-
* Migration:
|
|
253
|
-
* ```typescript
|
|
254
|
-
* // Before
|
|
255
|
-
* const client = createX402Client({ wallets });
|
|
256
|
-
* const res = await client.fetch(url);
|
|
257
|
-
*
|
|
258
|
-
* // After
|
|
259
|
-
* import { payAndFetch } from '@dexterai/x402/client';
|
|
260
|
-
* const result = await payAndFetch(url, undefined, wallets);
|
|
261
|
-
* if (result.ok) {
|
|
262
|
-
* const res = result.response;
|
|
263
|
-
* }
|
|
264
|
-
* ```
|
|
265
|
-
*/
|
|
266
|
-
declare function createX402Client(config: X402ClientConfig): X402Client;
|
|
267
145
|
|
|
268
|
-
export { type PaymentReceipt as P, type
|
|
146
|
+
export { type PaymentReceipt as P, type X402Client as X, getSponsoredAccessInfo as a, getPaymentReceipt as b, fireImpressionBeacon as f, getSponsoredRecommendations as g };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexterai/x402",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Full-stack x402 SDK - add paid API monetization to any endpoint. Express middleware, React hooks, Access Pass, dynamic pricing. Solana, Base, Polygon, Arbitrum, Optimism, Avalanche, SKALE.",
|
|
5
5
|
"author": "Dexter",
|
|
6
6
|
"license": "MIT",
|
package/assets/openai-pricing.md
DELETED
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
Pricing
|
|
2
|
-
=======
|
|
3
|
-
|
|
4
|
-
###
|
|
5
|
-
|
|
6
|
-
Text tokens
|
|
7
|
-
|
|
8
|
-
Prices per 1M tokens.
|
|
9
|
-
|
|
10
|
-
Batch
|
|
11
|
-
|
|
12
|
-
|Model|Input|Cached input|Output|
|
|
13
|
-
|---|---|---|---|
|
|
14
|
-
|gpt-5.2|$0.875|$0.0875|$7.00|
|
|
15
|
-
|gpt-5.1|$0.625|$0.0625|$5.00|
|
|
16
|
-
|gpt-5|$0.625|$0.0625|$5.00|
|
|
17
|
-
|gpt-5-mini|$0.125|$0.0125|$1.00|
|
|
18
|
-
|gpt-5-nano|$0.025|$0.0025|$0.20|
|
|
19
|
-
|gpt-5.2-pro|$10.50|-|$84.00|
|
|
20
|
-
|gpt-5-pro|$7.50|-|$60.00|
|
|
21
|
-
|gpt-4.1|$1.00|-|$4.00|
|
|
22
|
-
|gpt-4.1-mini|$0.20|-|$0.80|
|
|
23
|
-
|gpt-4.1-nano|$0.05|-|$0.20|
|
|
24
|
-
|gpt-4o|$1.25|-|$5.00|
|
|
25
|
-
|gpt-4o-2024-05-13|$2.50|-|$7.50|
|
|
26
|
-
|gpt-4o-mini|$0.075|-|$0.30|
|
|
27
|
-
|o1|$7.50|-|$30.00|
|
|
28
|
-
|o1-pro|$75.00|-|$300.00|
|
|
29
|
-
|o3-pro|$10.00|-|$40.00|
|
|
30
|
-
|o3|$1.00|-|$4.00|
|
|
31
|
-
|o3-deep-research|$5.00|-|$20.00|
|
|
32
|
-
|o4-mini|$0.55|-|$2.20|
|
|
33
|
-
|o4-mini-deep-research|$1.00|-|$4.00|
|
|
34
|
-
|o3-mini|$0.55|-|$2.20|
|
|
35
|
-
|o1-mini|$0.55|-|$2.20|
|
|
36
|
-
|computer-use-preview|$1.50|-|$6.00|
|
|
37
|
-
|
|
38
|
-
Flex
|
|
39
|
-
|
|
40
|
-
|Model|Input|Cached input|Output|
|
|
41
|
-
|---|---|---|---|
|
|
42
|
-
|gpt-5.2|$0.875|$0.0875|$7.00|
|
|
43
|
-
|gpt-5.1|$0.625|$0.0625|$5.00|
|
|
44
|
-
|gpt-5|$0.625|$0.0625|$5.00|
|
|
45
|
-
|gpt-5-mini|$0.125|$0.0125|$1.00|
|
|
46
|
-
|gpt-5-nano|$0.025|$0.0025|$0.20|
|
|
47
|
-
|o3|$1.00|$0.25|$4.00|
|
|
48
|
-
|o4-mini|$0.55|$0.138|$2.20|
|
|
49
|
-
|
|
50
|
-
Standard
|
|
51
|
-
|
|
52
|
-
|Model|Input|Cached input|Output|
|
|
53
|
-
|---|---|---|---|
|
|
54
|
-
|gpt-5.2|$1.75|$0.175|$14.00|
|
|
55
|
-
|gpt-5.1|$1.25|$0.125|$10.00|
|
|
56
|
-
|gpt-5|$1.25|$0.125|$10.00|
|
|
57
|
-
|gpt-5-mini|$0.25|$0.025|$2.00|
|
|
58
|
-
|gpt-5-nano|$0.05|$0.005|$0.40|
|
|
59
|
-
|gpt-5.2-chat-latest|$1.75|$0.175|$14.00|
|
|
60
|
-
|gpt-5.1-chat-latest|$1.25|$0.125|$10.00|
|
|
61
|
-
|gpt-5-chat-latest|$1.25|$0.125|$10.00|
|
|
62
|
-
|gpt-5.1-codex-max|$1.25|$0.125|$10.00|
|
|
63
|
-
|gpt-5.1-codex|$1.25|$0.125|$10.00|
|
|
64
|
-
|gpt-5-codex|$1.25|$0.125|$10.00|
|
|
65
|
-
|gpt-5.2-pro|$21.00|-|$168.00|
|
|
66
|
-
|gpt-5-pro|$15.00|-|$120.00|
|
|
67
|
-
|gpt-4.1|$2.00|$0.50|$8.00|
|
|
68
|
-
|gpt-4.1-mini|$0.40|$0.10|$1.60|
|
|
69
|
-
|gpt-4.1-nano|$0.10|$0.025|$0.40|
|
|
70
|
-
|gpt-4o|$2.50|$1.25|$10.00|
|
|
71
|
-
|gpt-4o-2024-05-13|$5.00|-|$15.00|
|
|
72
|
-
|gpt-4o-mini|$0.15|$0.075|$0.60|
|
|
73
|
-
|gpt-realtime|$4.00|$0.40|$16.00|
|
|
74
|
-
|gpt-realtime-mini|$0.60|$0.06|$2.40|
|
|
75
|
-
|gpt-4o-realtime-preview|$5.00|$2.50|$20.00|
|
|
76
|
-
|gpt-4o-mini-realtime-preview|$0.60|$0.30|$2.40|
|
|
77
|
-
|gpt-audio|$2.50|-|$10.00|
|
|
78
|
-
|gpt-audio-mini|$0.60|-|$2.40|
|
|
79
|
-
|gpt-4o-audio-preview|$2.50|-|$10.00|
|
|
80
|
-
|gpt-4o-mini-audio-preview|$0.15|-|$0.60|
|
|
81
|
-
|o1|$15.00|$7.50|$60.00|
|
|
82
|
-
|o1-pro|$150.00|-|$600.00|
|
|
83
|
-
|o3-pro|$20.00|-|$80.00|
|
|
84
|
-
|o3|$2.00|$0.50|$8.00|
|
|
85
|
-
|o3-deep-research|$10.00|$2.50|$40.00|
|
|
86
|
-
|o4-mini|$1.10|$0.275|$4.40|
|
|
87
|
-
|o4-mini-deep-research|$2.00|$0.50|$8.00|
|
|
88
|
-
|o3-mini|$1.10|$0.55|$4.40|
|
|
89
|
-
|o1-mini|$1.10|$0.55|$4.40|
|
|
90
|
-
|gpt-5.1-codex-mini|$0.25|$0.025|$2.00|
|
|
91
|
-
|codex-mini-latest|$1.50|$0.375|$6.00|
|
|
92
|
-
|gpt-5-search-api|$1.25|$0.125|$10.00|
|
|
93
|
-
|gpt-4o-mini-search-preview|$0.15|-|$0.60|
|
|
94
|
-
|gpt-4o-search-preview|$2.50|-|$10.00|
|
|
95
|
-
|computer-use-preview|$3.00|-|$12.00|
|
|
96
|
-
|gpt-image-1.5|$5.00|$1.25|$10.00|
|
|
97
|
-
|chatgpt-image-latest|$5.00|$1.25|$10.00|
|
|
98
|
-
|gpt-image-1|$5.00|$1.25|-|
|
|
99
|
-
|gpt-image-1-mini|$2.00|$0.20|-|
|
|
100
|
-
|
|
101
|
-
Priority
|
|
102
|
-
|
|
103
|
-
|Model|Input|Cached input|Output|
|
|
104
|
-
|---|---|---|---|
|
|
105
|
-
|gpt-5.2|$3.50|$0.35|$28.00|
|
|
106
|
-
|gpt-5.1|$2.50|$0.25|$20.00|
|
|
107
|
-
|gpt-5|$2.50|$0.25|$20.00|
|
|
108
|
-
|gpt-5-mini|$0.45|$0.045|$3.60|
|
|
109
|
-
|gpt-5.1-codex-max|$2.50|$0.25|$20.00|
|
|
110
|
-
|gpt-5.1-codex|$2.50|$0.25|$20.00|
|
|
111
|
-
|gpt-5-codex|$2.50|$0.25|$20.00|
|
|
112
|
-
|gpt-4.1|$3.50|$0.875|$14.00|
|
|
113
|
-
|gpt-4.1-mini|$0.70|$0.175|$2.80|
|
|
114
|
-
|gpt-4.1-nano|$0.20|$0.05|$0.80|
|
|
115
|
-
|gpt-4o|$4.25|$2.125|$17.00|
|
|
116
|
-
|gpt-4o-2024-05-13|$8.75|-|$26.25|
|
|
117
|
-
|gpt-4o-mini|$0.25|$0.125|$1.00|
|
|
118
|
-
|o3|$3.50|$0.875|$14.00|
|
|
119
|
-
|o4-mini|$2.00|$0.50|$8.00|
|
|
120
|
-
|
|
121
|
-
For faster processing of API requests, try the [priority processing service tier](https://platform.openai.com/docs/guides/priority-processing). For lower prices with higher latency, try the [flex processing tier](https://platform.openai.com/docs/guides/flex-processing).
|
|
122
|
-
|
|
123
|
-
Large numbers of API requests which are not time-sensitive can use the [Batch API](https://platform.openai.com/docs/guides/batch) for additional savings as well.
|
|
124
|
-
|
|
125
|
-
While reasoning tokens are not visible via the API, they still occupy space in the model's context window and are billed as output tokens.
|
|
126
|
-
|
|
127
|
-
For gpt-image-1.5, Text output tokens include model reasoning tokens.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
###
|
|
132
|
-
|
|
133
|
-
Image tokens
|
|
134
|
-
|
|
135
|
-
Prices per 1M tokens.
|
|
136
|
-
|
|
137
|
-
|Model|Input|Cached Input|Output|
|
|
138
|
-
|---|---|---|---|
|
|
139
|
-
|gpt-image-1.5|$8.00|$2.00|$32.00|
|
|
140
|
-
|chatgpt-image-latest|$8.00|$2.00|$32.00|
|
|
141
|
-
|gpt-image-1|$10.00|$2.50|$40.00|
|
|
142
|
-
|gpt-image-1-mini|$2.50|$0.25|$8.00|
|
|
143
|
-
|gpt-realtime|$5.00|$0.50|-|
|
|
144
|
-
|gpt-realtime-mini|$0.80|$0.08|-|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
###
|
|
149
|
-
|
|
150
|
-
Audio tokens
|
|
151
|
-
|
|
152
|
-
Prices per 1M tokens.
|
|
153
|
-
|
|
154
|
-
|Model|Input|Cached Input|Output|
|
|
155
|
-
|---|---|---|---|
|
|
156
|
-
|gpt-realtime|$32.00|$0.40|$64.00|
|
|
157
|
-
|gpt-realtime-mini|$10.00|$0.30|$20.00|
|
|
158
|
-
|gpt-4o-realtime-preview|$40.00|$2.50|$80.00|
|
|
159
|
-
|gpt-4o-mini-realtime-preview|$10.00|$0.30|$20.00|
|
|
160
|
-
|gpt-audio|$32.00|-|$64.00|
|
|
161
|
-
|gpt-audio-mini|$10.00|-|$20.00|
|
|
162
|
-
|gpt-4o-audio-preview|$40.00|-|$80.00|
|
|
163
|
-
|gpt-4o-mini-audio-preview|$10.00|-|$20.00|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
###
|
|
168
|
-
|
|
169
|
-
Video
|
|
170
|
-
|
|
171
|
-
Prices per second.
|
|
172
|
-
|
|
173
|
-
|Model|Size: Output resolution|Price per second|
|
|
174
|
-
|---|---|---|
|
|
175
|
-
|sora-2|Portrait: 720x1280 Landscape: 1280x720|$0.10|
|
|
176
|
-
|sora-2-pro|Portrait: 720x1280 Landscape: 1280x720|$0.30|
|
|
177
|
-
|sora-2-pro|Portrait: 1024x1792 Landscape: 1792x1024|$0.50|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
###
|
|
182
|
-
|
|
183
|
-
Fine-tuning
|
|
184
|
-
|
|
185
|
-
Prices per 1M tokens.
|
|
186
|
-
|
|
187
|
-
Batch
|
|
188
|
-
|
|
189
|
-
|Model|Training|Input|Cached Input|Output|
|
|
190
|
-
|---|---|---|---|---|
|
|
191
|
-
|o4-mini-2025-04-16|$100.00 / hour|$2.00|$0.50|$8.00|
|
|
192
|
-
|o4-mini-2025-04-16with data sharing|$100.00 / hour|$1.00|$0.25|$4.00|
|
|
193
|
-
|gpt-4.1-2025-04-14|$25.00|$1.50|$0.50|$6.00|
|
|
194
|
-
|gpt-4.1-mini-2025-04-14|$5.00|$0.40|$0.10|$1.60|
|
|
195
|
-
|gpt-4.1-nano-2025-04-14|$1.50|$0.10|$0.025|$0.40|
|
|
196
|
-
|gpt-4o-2024-08-06|$25.00|$2.225|$0.90|$12.50|
|
|
197
|
-
|gpt-4o-mini-2024-07-18|$3.00|$0.15|$0.075|$0.60|
|
|
198
|
-
|gpt-3.5-turbo|$8.00|$1.50|-|$3.00|
|
|
199
|
-
|davinci-002|$6.00|$6.00|-|$6.00|
|
|
200
|
-
|babbage-002|$0.40|$0.80|-|$0.90|
|
|
201
|
-
|
|
202
|
-
Standard
|
|
203
|
-
|
|
204
|
-
|Model|Training|Input|Cached Input|Output|
|
|
205
|
-
|---|---|---|---|---|
|
|
206
|
-
|o4-mini-2025-04-16|$100.00 / hour|$4.00|$1.00|$16.00|
|
|
207
|
-
|o4-mini-2025-04-16with data sharing|$100.00 / hour|$2.00|$0.50|$8.00|
|
|
208
|
-
|gpt-4.1-2025-04-14|$25.00|$3.00|$0.75|$12.00|
|
|
209
|
-
|gpt-4.1-mini-2025-04-14|$5.00|$0.80|$0.20|$3.20|
|
|
210
|
-
|gpt-4.1-nano-2025-04-14|$1.50|$0.20|$0.05|$0.80|
|
|
211
|
-
|gpt-4o-2024-08-06|$25.00|$3.75|$1.875|$15.00|
|
|
212
|
-
|gpt-4o-mini-2024-07-18|$3.00|$0.30|$0.15|$1.20|
|
|
213
|
-
|gpt-3.5-turbo|$8.00|$3.00|-|$6.00|
|
|
214
|
-
|davinci-002|$6.00|$12.00|-|$12.00|
|
|
215
|
-
|babbage-002|$0.40|$1.60|-|$1.60|
|
|
216
|
-
|
|
217
|
-
Tokens used for model grading in reinforcement fine-tuning are billed at that model's per-token rate. Inference discounts are available if you enable data sharing when creating the fine-tune job. [Learn more](https://help.openai.com/en/articles/10306912-sharing-feedback-evaluation-and-fine-tuning-data-and-api-inputs-and-outputs-with-openai#h_c93188c569).
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
###
|
|
222
|
-
|
|
223
|
-
Built-in tools
|
|
224
|
-
|
|
225
|
-
|Tool|Cost|
|
|
226
|
-
|---|---|
|
|
227
|
-
|Code Interpreter|1 GB (default): $0.03 / container4 GB: $0.12 / container16 GB: $0.48 / container64 GB: $1.92 / container|
|
|
228
|
-
|File search storage|$0.10 / GB per day (1GB free)|
|
|
229
|
-
|File search tool callResponses API only|$2.50 / 1k calls|
|
|
230
|
-
|Web search (all models)[1]|$10.00 / 1k calls + search content tokens billed at model rates|
|
|
231
|
-
|Web search preview (reasoning models, including gpt-5, o-series)|$10.00 / 1k calls + search content tokens billed at model rates|
|
|
232
|
-
|Web search preview (non-reasoning models)|$25.00 / 1k calls + search content tokens are free|
|
|
233
|
-
|
|
234
|
-
The tokens used for built-in tools are billed at the chosen model's per-token rates. GB refers to binary gigabytes of storage (also known as gibibyte), where 1GB is 2^30 bytes.
|
|
235
|
-
|
|
236
|
-
**Web search:** There are two components that contribute to the cost of using the web search tool: (1) tool calls and (2) search content tokens. Tool calls are billed per 1000 calls, according to the tool version and model type. The billing dashboard and invoices will report these line items as “web search tool calls.”
|
|
237
|
-
|
|
238
|
-
Search content tokens are tokens retrieved from the search index and fed to the model alongside your prompt to generate an answer. These are billed at the model’s input token rate, unless otherwise specified.
|
|
239
|
-
|
|
240
|
-
\[1\] For `gpt-4o-mini` and `gpt-4.1-mini` with the web search non-preview tool, search content tokens are charged as a fixed block of 8,000 input tokens per call.
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
###
|
|
245
|
-
|
|
246
|
-
AgentKit
|
|
247
|
-
|
|
248
|
-
Build, deploy, and optimize production-grade agents with Agent Builder, ChatKit, and Evals. You pay only for the compute and data you actually use.
|
|
249
|
-
|
|
250
|
-
|Usage meter|Free tier (per account, per month)|Price beyond free tier|
|
|
251
|
-
|---|---|---|
|
|
252
|
-
|Storage for ChatKit File / Image Uploads|1 GB|$0.10 / GB-day|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
###
|
|
257
|
-
|
|
258
|
-
Transcription and speech generation
|
|
259
|
-
|
|
260
|
-
Prices per 1M tokens.
|
|
261
|
-
|
|
262
|
-
#### Text tokens
|
|
263
|
-
|
|
264
|
-
|Model|Input|Output|Estimated cost|
|
|
265
|
-
|---|---|---|---|
|
|
266
|
-
|gpt-4o-mini-tts|$0.60|-|$0.015 / minute|
|
|
267
|
-
|gpt-4o-transcribe|$2.50|$10.00|$0.006 / minute|
|
|
268
|
-
|gpt-4o-transcribe-diarize|$2.50|$10.00|$0.006 / minute|
|
|
269
|
-
|gpt-4o-mini-transcribe|$1.25|$5.00|$0.003 / minute|
|
|
270
|
-
|
|
271
|
-
#### Audio tokens
|
|
272
|
-
|
|
273
|
-
|Model|Input|Output|Estimated cost|
|
|
274
|
-
|---|---|---|---|
|
|
275
|
-
|gpt-4o-mini-tts|-|$12.00|$0.015 / minute|
|
|
276
|
-
|gpt-4o-transcribe|$6.00|-|$0.006 / minute|
|
|
277
|
-
|gpt-4o-transcribe-diarize|$6.00|-|$0.006 / minute|
|
|
278
|
-
|gpt-4o-mini-transcribe|$3.00|-|$0.003 / minute|
|
|
279
|
-
|
|
280
|
-
#### Other models
|
|
281
|
-
|
|
282
|
-
|Model|Use case|Cost|
|
|
283
|
-
|---|---|---|
|
|
284
|
-
|Whisper|Transcription|$0.006 / minute|
|
|
285
|
-
|TTS|Speech generation|$15.00 / 1M characters|
|
|
286
|
-
|TTS HD|Speech generation|$30.00 / 1M characters|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
###
|
|
291
|
-
|
|
292
|
-
Image generation
|
|
293
|
-
|
|
294
|
-
Prices per image.
|
|
295
|
-
|
|
296
|
-
|Model|Quality|1024 x 1024|1024 x 1536|1536 x 1024|
|
|
297
|
-
|---|---|---|---|---|
|
|
298
|
-
|GPT Image 1.5|Low|$0.009|$0.013|$0.013|
|
|
299
|
-
|Medium|$0.034|$0.05|$0.05|
|
|
300
|
-
|High|$0.133|$0.2|$0.2|
|
|
301
|
-
|GPT Image Latest|Low|$0.009|$0.013|$0.013|
|
|
302
|
-
|Medium|$0.034|$0.05|$0.05|
|
|
303
|
-
|High|$0.133|$0.2|$0.2|
|
|
304
|
-
|GPT Image 1|Low|$0.011|$0.016|$0.016|
|
|
305
|
-
|Medium|$0.042|$0.063|$0.063|
|
|
306
|
-
|High|$0.167|$0.25|$0.25|
|
|
307
|
-
|GPT Image 1 Mini|Low|$0.005|$0.006|$0.006|
|
|
308
|
-
|Medium|$0.011|$0.015|$0.015|
|
|
309
|
-
|High|$0.036|$0.052|$0.052|
|
|
310
|
-
||
|
|
311
|
-
||
|
|
312
|
-
|DALL·E 3|Standard|$0.04|$0.08|$0.08|
|
|
313
|
-
|HD|$0.08|$0.12|$0.12|
|
|
314
|
-
||
|
|
315
|
-
||
|
|
316
|
-
|DALL·E 2|Standard|$0.016|$0.018|$0.02|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
###
|
|
321
|
-
|
|
322
|
-
Embeddings
|
|
323
|
-
|
|
324
|
-
Prices per 1M tokens.
|
|
325
|
-
|
|
326
|
-
|Model|Cost|Batch cost|
|
|
327
|
-
|---|---|---|
|
|
328
|
-
|text-embedding-3-small|$0.02|$0.01|
|
|
329
|
-
|text-embedding-3-large|$0.13|$0.065|
|
|
330
|
-
|text-embedding-ada-002|$0.10|$0.05|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
### Moderation
|
|
335
|
-
|
|
336
|
-
Our `omni-moderation` models are made available free of charge ✌️
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
###
|
|
341
|
-
|
|
342
|
-
Legacy models
|
|
343
|
-
|
|
344
|
-
Prices per 1M tokens.
|
|
345
|
-
|
|
346
|
-
Batch
|
|
347
|
-
|
|
348
|
-
|Model|Input|Output|
|
|
349
|
-
|---|---|---|
|
|
350
|
-
|gpt-4-turbo-2024-04-09|$5.00|$15.00|
|
|
351
|
-
|gpt-4-0125-preview|$5.00|$15.00|
|
|
352
|
-
|gpt-4-1106-preview|$5.00|$15.00|
|
|
353
|
-
|gpt-4-1106-vision-preview|$5.00|$15.00|
|
|
354
|
-
|gpt-4-0613|$15.00|$30.00|
|
|
355
|
-
|gpt-4-0314|$15.00|$30.00|
|
|
356
|
-
|gpt-4-32k|$30.00|$60.00|
|
|
357
|
-
|gpt-3.5-turbo-0125|$0.25|$0.75|
|
|
358
|
-
|gpt-3.5-turbo-1106|$1.00|$2.00|
|
|
359
|
-
|gpt-3.5-turbo-0613|$1.50|$2.00|
|
|
360
|
-
|gpt-3.5-0301|$1.50|$2.00|
|
|
361
|
-
|gpt-3.5-turbo-16k-0613|$1.50|$2.00|
|
|
362
|
-
|davinci-002|$1.00|$1.00|
|
|
363
|
-
|babbage-002|$0.20|$0.20|
|
|
364
|
-
|
|
365
|
-
Standard
|
|
366
|
-
|
|
367
|
-
|Model|Input|Output|
|
|
368
|
-
|---|---|---|
|
|
369
|
-
|chatgpt-4o-latest|$5.00|$15.00|
|
|
370
|
-
|gpt-4-turbo-2024-04-09|$10.00|$30.00|
|
|
371
|
-
|gpt-4-0125-preview|$10.00|$30.00|
|
|
372
|
-
|gpt-4-1106-preview|$10.00|$30.00|
|
|
373
|
-
|gpt-4-1106-vision-preview|$10.00|$30.00|
|
|
374
|
-
|gpt-4-0613|$30.00|$60.00|
|
|
375
|
-
|gpt-4-0314|$30.00|$60.00|
|
|
376
|
-
|gpt-4-32k|$60.00|$120.00|
|
|
377
|
-
|gpt-3.5-turbo|$0.50|$1.50|
|
|
378
|
-
|gpt-3.5-turbo-0125|$0.50|$1.50|
|
|
379
|
-
|gpt-3.5-turbo-1106|$1.00|$2.00|
|
|
380
|
-
|gpt-3.5-turbo-0613|$1.50|$2.00|
|
|
381
|
-
|gpt-3.5-0301|$1.50|$2.00|
|
|
382
|
-
|gpt-3.5-turbo-instruct|$1.50|$2.00|
|
|
383
|
-
|gpt-3.5-turbo-16k-0613|$3.00|$4.00|
|
|
384
|
-
|davinci-002|$2.00|$2.00|
|
|
385
|
-
|babbage-002|$0.40|$0.40|
|