ai-token-estimator 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/README.md +42 -23
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -108,59 +108,78 @@ This package counts Unicode code points, not UTF-16 code units. This means:
108
108
  - Accented characters count correctly
109
109
  - Most source code characters count as 1
110
110
 
111
+ <!-- SUPPORTED_MODELS_START -->
111
112
  ## Supported Models
112
113
 
114
+ > **Auto-updated weekly** via GitHub Actions from provider pricing pages.
115
+
113
116
  ### OpenAI Models
114
117
 
115
118
  | Model | Chars/Token | Input Cost (per 1M tokens) |
116
119
  |-------|-------------|---------------------------|
117
- | gpt-5.2 | 4 | $1.75 |
118
- | gpt-5.2-pro | 4 | $21.00 |
119
- | gpt-5-mini | 4 | $0.25 |
120
120
  | gpt-4.1 | 4 | $3.00 |
121
- | gpt-4.1-mini | 4 | $0.80 |
122
- | gpt-4.1-nano | 4 | $0.20 |
121
+ | gpt-4.1-mini | 4 | $0.40 |
122
+ | gpt-4.1-nano | 4 | $0.10 |
123
123
  | gpt-4o | 4 | $2.50 |
124
124
  | gpt-4o-mini | 4 | $0.15 |
125
- | o3 | 4 | $2.00 |
126
- | o4-mini | 4 | $4.00 |
125
+ | gpt-5-mini | 4 | $0.25 |
126
+ | gpt-5.2 | 4 | $1.75 |
127
+ | gpt-5.2-pro | 4 | $21.00 |
128
+ | gpt-realtime | 4 | $4.00 |
129
+ | gpt-realtime-mini | 4 | $0.60 |
127
130
  | o1 | 4 | $15.00 |
128
131
  | o1-pro | 4 | $150.00 |
132
+ | o3 | 4 | $2.00 |
133
+ | o4-mini | 4 | $4.00 |
129
134
 
130
135
  ### Anthropic Claude Models
131
136
 
132
137
  | Model | Chars/Token | Input Cost (per 1M tokens) |
133
138
  |-------|-------------|---------------------------|
134
- | claude-opus-4.5 | 3.5 | $5.00 |
135
- | claude-sonnet-4.5 | 3.5 | $3.00 |
139
+ | claude-haiku-3 | 3.5 | $0.25 |
140
+ | claude-haiku-3.5 | 3.5 | $0.80 |
136
141
  | claude-haiku-4.5 | 3.5 | $1.00 |
142
+ | claude-opus-3 | 3.5 | $15.00 |
137
143
  | claude-opus-4 | 3.5 | $15.00 |
138
144
  | claude-opus-4.1 | 3.5 | $15.00 |
145
+ | claude-opus-4.5 | 3.5 | $5.00 |
139
146
  | claude-sonnet-4 | 3.5 | $3.00 |
140
- | claude-opus-3 | 3.5 | $15.00 |
141
- | claude-haiku-3 | 3.5 | $0.25 |
142
- | claude-haiku-3.5 | 3.5 | $0.80 |
147
+ | claude-sonnet-4.5 | 3.5 | $3.00 |
143
148
 
144
149
  ### Google Gemini Models
145
150
 
146
151
  | Model | Chars/Token | Input Cost (per 1M tokens) |
147
152
  |-------|-------------|---------------------------|
148
- | gemini-3-pro | 4 | $2.00 |
149
- | gemini-3-flash | 4 | $0.50 |
150
- | gemini-2.5-pro | 4 | $1.25 |
153
+ | gemini-2.0-flash | 4 | $0.10 |
154
+ | gemini-2.0-flash-lite | 4 | $0.08 |
155
+ | gemini-2.5-computer-use-preview-10-2025 | 4 | $1.25 |
151
156
  | gemini-2.5-flash | 4 | $0.30 |
152
157
  | gemini-2.5-flash-lite | 4 | $0.10 |
153
- | gemini-2.0-flash | 4 | $0.10 |
154
- | gemini-2.0-flash-lite | 4 | $0.075 |
158
+ | gemini-2.5-flash-lite-preview-09-2025 | 4 | $0.10 |
159
+ | gemini-2.5-flash-native-audio-preview-12-2025 | 4 | $0.50 |
160
+ | gemini-2.5-flash-preview-09-2025 | 4 | $0.30 |
161
+ | gemini-2.5-flash-preview-tts | 4 | $0.50 |
162
+ | gemini-2.5-pro | 4 | $1.25 |
163
+ | gemini-2.5-pro-preview-tts | 4 | $1.00 |
164
+ | gemini-3-flash | 4 | $0.50 |
165
+ | gemini-3-pro | 4 | $2.00 |
155
166
 
156
- *Pricing last verified: December 2025*
167
+ *Last updated: 2025-12-25*
168
+ <!-- SUPPORTED_MODELS_END -->
157
169
 
158
- ## Updating Pricing
170
+ ## Pricing Updates
159
171
 
160
- Model configurations are embedded in the package. To update pricing:
161
- 1. Modify `src/models.ts`
162
- 2. Create a changeset: `npx changeset`
163
- 3. Publish a new version
172
+ Model pricing is automatically updated weekly via GitHub Actions. The update script fetches the latest prices directly from:
173
+ - [OpenAI Pricing](https://openai.com/api/pricing/)
174
+ - [Anthropic Pricing](https://www.anthropic.com/pricing)
175
+ - [Google AI Pricing](https://ai.google.dev/gemini-api/docs/pricing)
176
+
177
+ You can check when prices were last updated:
178
+
179
+ ```typescript
180
+ import { LAST_UPDATED } from 'ai-token-estimator';
181
+ console.log(LAST_UPDATED); // '2025-12-25'
182
+ ```
164
183
 
165
184
  ## License
166
185
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-token-estimator",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Estimate token counts and costs for LLM API calls",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",