@promptbook/cli 0.114.0-40 → 0.114.0-41
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/esm/index.es.js +1016 -1066
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/runners/gemini/GeminiRunner.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/runners/qwen-code/QwenCodeRunner.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/harness/HARNESS_DEFAULT_MODELS.d.ts +25 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +1 -1
- package/src/cli/cli-commands/common/harness/HARNESS_DEFAULT_MODELS.ts +37 -0
- package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +18 -10
- package/src/other/templates/getTemplatesPipelineCollection.ts +843 -666
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +1016 -1066
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/runners/gemini/GeminiRunner.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/runners/qwen-code/QwenCodeRunner.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/harness/HARNESS_DEFAULT_MODELS.d.ts +25 -0
- package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
* @generated
|
|
58
58
|
* @see https://github.com/webgptorg/promptbook
|
|
59
59
|
*/
|
|
60
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-
|
|
60
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-41';
|
|
61
61
|
/**
|
|
62
62
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
63
63
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1843,6 +1843,40 @@
|
|
|
1843
1843
|
}
|
|
1844
1844
|
// Note: [🟡] Code for CLI command [run](src/cli/cli-commands/coder/run.ts) should never be published outside of `@promptbook/cli`
|
|
1845
1845
|
|
|
1846
|
+
/**
|
|
1847
|
+
* Latest OpenAI flagship used by harnesses which support OpenAI models.
|
|
1848
|
+
*/
|
|
1849
|
+
const OPENAI_FLAGSHIP_MODEL = 'gpt-6-astra';
|
|
1850
|
+
/**
|
|
1851
|
+
* Latest Gemini model for coding and long-running agent tasks.
|
|
1852
|
+
*/
|
|
1853
|
+
const GEMINI_FLAGSHIP_MODEL = 'gemini-3.8-flash';
|
|
1854
|
+
/**
|
|
1855
|
+
* [🕕] Default models shared by CLI execution, project initialization and the coder landing page.
|
|
1856
|
+
*
|
|
1857
|
+
* Checked against provider documentation on 2026-09-21:
|
|
1858
|
+
* - https://developers.openai.com/codex/models
|
|
1859
|
+
* - https://github.blog/changelog/2026-09-04-gpt-6-astra-is-generally-available-in-github-copilot/
|
|
1860
|
+
* - https://code.claude.com/docs/en/model-config
|
|
1861
|
+
* - https://ai.google.dev/gemini-api/docs/models/gemini-3.8-flash
|
|
1862
|
+
* - https://qwenlm.github.io/qwen-code-docs/en/blog/updates/weekly-update-2026-08-27/
|
|
1863
|
+
*
|
|
1864
|
+
* Claude's `fable` alias follows its current flagship. OpenCode needs a provider-qualified model;
|
|
1865
|
+
* the Cline adapter uses Google's provider and therefore needs a Gemini model ID.
|
|
1866
|
+
* Keep this module free of runtime dependencies so the landing page can consume the same defaults.
|
|
1867
|
+
*
|
|
1868
|
+
* @private internal configuration of CLI harness integrations
|
|
1869
|
+
*/
|
|
1870
|
+
const HARNESS_DEFAULT_MODELS = {
|
|
1871
|
+
'openai-codex': OPENAI_FLAGSHIP_MODEL,
|
|
1872
|
+
'github-copilot': OPENAI_FLAGSHIP_MODEL,
|
|
1873
|
+
'claude-code': 'fable',
|
|
1874
|
+
gemini: GEMINI_FLAGSHIP_MODEL,
|
|
1875
|
+
'qwen-code': 'qwen3.8-max',
|
|
1876
|
+
opencode: `openai/${OPENAI_FLAGSHIP_MODEL}`,
|
|
1877
|
+
cline: GEMINI_FLAGSHIP_MODEL,
|
|
1878
|
+
};
|
|
1879
|
+
|
|
1846
1880
|
/**
|
|
1847
1881
|
* Runner identifiers supported by Promptbook CLI agent orchestration commands.
|
|
1848
1882
|
*
|
|
@@ -1856,13 +1890,15 @@
|
|
|
1856
1890
|
*/
|
|
1857
1891
|
const PROMPT_RUNNER_DESCRIPTION = _spaceTrim.spaceTrim(`
|
|
1858
1892
|
Runners:
|
|
1859
|
-
- openai-codex: OpenAI Codex integration
|
|
1893
|
+
- openai-codex: OpenAI Codex integration
|
|
1860
1894
|
- github-copilot: GitHub Copilot CLI integration
|
|
1861
1895
|
- cline: Cline CLI integration
|
|
1862
1896
|
- claude-code: Claude Code integration
|
|
1863
1897
|
- opencode: Opencode integration
|
|
1864
|
-
- gemini: Google Gemini CLI integration
|
|
1865
|
-
- qwen-code: Qwen Code CLI integration
|
|
1898
|
+
- gemini: Google Gemini CLI integration
|
|
1899
|
+
- qwen-code: Qwen Code CLI integration
|
|
1900
|
+
|
|
1901
|
+
Each harness automatically uses its current flagship model unless --model or PTBK_MODEL overrides it.
|
|
1866
1902
|
`);
|
|
1867
1903
|
/**
|
|
1868
1904
|
* Commander description for the `--harness` option.
|
|
@@ -1881,14 +1917,15 @@
|
|
|
1881
1917
|
*
|
|
1882
1918
|
* @private internal utility of `promptbookCli`
|
|
1883
1919
|
*/
|
|
1884
|
-
const PROMPT_RUNNER_MODEL_OPTION_DESCRIPTION = _spaceTrim.spaceTrim(`
|
|
1885
|
-
Model to use or filter by (
|
|
1920
|
+
const PROMPT_RUNNER_MODEL_OPTION_DESCRIPTION = _spaceTrim.spaceTrim((block) => `
|
|
1921
|
+
Model to use or filter by (optional; execution defaults to the current flagship of the selected harness)
|
|
1886
1922
|
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1923
|
+
${block(Object.entries(HARNESS_DEFAULT_MODELS)
|
|
1924
|
+
.map(([harnessName, modelName]) => `${harnessName}: ${modelName}`)
|
|
1925
|
+
.join('\n'))}
|
|
1890
1926
|
|
|
1891
|
-
|
|
1927
|
+
"default" keeps the model configured in Codex, Copilot, Claude Code or OpenCode itself.
|
|
1928
|
+
For Gemini, Qwen Code and Cline, "default" selects the flagship above.
|
|
1892
1929
|
`);
|
|
1893
1930
|
/**
|
|
1894
1931
|
* Commander description for the `--git-changes` option.
|
|
@@ -24347,953 +24384,267 @@
|
|
|
24347
24384
|
}
|
|
24348
24385
|
|
|
24349
24386
|
/**
|
|
24350
|
-
*
|
|
24387
|
+
* Pattern that matches durations like "1h", "30m", "5s", "1h30m", "1h30m5s".
|
|
24388
|
+
*/
|
|
24389
|
+
const DURATION_PATTERN = /^(?:(\d+)h)?(?:(\d+)m(?:in)?)?(?:(\d+)s)?$/;
|
|
24390
|
+
/**
|
|
24391
|
+
* Parses a human-readable duration string into milliseconds.
|
|
24351
24392
|
*
|
|
24352
|
-
*
|
|
24393
|
+
* Supported formats: `Xh`, `Xm`, `Xs`, and combinations like `1h30m`, `1h30m5s`.
|
|
24394
|
+
*
|
|
24395
|
+
* @returns Duration in milliseconds
|
|
24396
|
+
* @throws When the string does not match any supported format
|
|
24397
|
+
*
|
|
24398
|
+
* @private internal utility of `ptbk coder run`
|
|
24353
24399
|
*/
|
|
24354
|
-
function
|
|
24355
|
-
|
|
24356
|
-
|
|
24400
|
+
function parseDuration(durationString) {
|
|
24401
|
+
var _a, _b, _c;
|
|
24402
|
+
const trimmed = durationString.trim();
|
|
24403
|
+
if (!trimmed) {
|
|
24404
|
+
throw new Error(`Invalid duration: empty string. Expected a format like "1h", "30m", "5s", or combinations like "1h30m".`);
|
|
24405
|
+
}
|
|
24406
|
+
const match = trimmed.match(DURATION_PATTERN);
|
|
24407
|
+
if (!match || (match[1] === undefined && match[2] === undefined && match[3] === undefined)) {
|
|
24408
|
+
throw new Error(`Invalid duration: "${durationString}". Expected a format like "1h", "30m", "5s", or combinations like "1h30m5s".`);
|
|
24409
|
+
}
|
|
24410
|
+
const hours = parseInt((_a = match[1]) !== null && _a !== void 0 ? _a : '0', 10);
|
|
24411
|
+
const minutes = parseInt((_b = match[2]) !== null && _b !== void 0 ? _b : '0', 10);
|
|
24412
|
+
const seconds = parseInt((_c = match[3]) !== null && _c !== void 0 ? _c : '0', 10);
|
|
24413
|
+
return (hours * 3600 + minutes * 60 + seconds) * 1000;
|
|
24357
24414
|
}
|
|
24358
|
-
|
|
24359
24415
|
/**
|
|
24360
|
-
*
|
|
24416
|
+
* Formats a duration in milliseconds into a compact human-readable string.
|
|
24361
24417
|
*
|
|
24362
|
-
*
|
|
24418
|
+
* Examples: `3600000` → `"1h"`, `90000` → `"1m 30s"`, `5000` → `"5s"`.
|
|
24363
24419
|
*
|
|
24364
|
-
* @
|
|
24365
|
-
|
|
24420
|
+
* @private internal utility of `ptbk coder run`
|
|
24421
|
+
*/
|
|
24422
|
+
function formatDurationMs(ms) {
|
|
24423
|
+
const totalSeconds = Math.ceil(ms / 1000);
|
|
24424
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
24425
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
24426
|
+
const seconds = totalSeconds % 60;
|
|
24427
|
+
const parts = [];
|
|
24428
|
+
if (hours > 0)
|
|
24429
|
+
parts.push(`${hours}h`);
|
|
24430
|
+
if (minutes > 0)
|
|
24431
|
+
parts.push(`${minutes}m`);
|
|
24432
|
+
if (seconds > 0 || parts.length === 0)
|
|
24433
|
+
parts.push(`${seconds}s`);
|
|
24434
|
+
return parts.join(' ');
|
|
24435
|
+
}
|
|
24436
|
+
|
|
24437
|
+
/**
|
|
24438
|
+
* Creates a line reader for one shell output stream.
|
|
24366
24439
|
*
|
|
24367
|
-
*
|
|
24440
|
+
* A chunk boundary can fall into the middle of a line, so the unterminated rest is remembered until the next chunk
|
|
24441
|
+
* completes it. Every observer of the live output therefore sees whole lines only, exactly as the finished output
|
|
24442
|
+
* would contain them. One reader belongs to one stream, because interleaving `stdout` and `stderr` into a single
|
|
24443
|
+
* buffer would splice two unrelated halves into one nonexistent line.
|
|
24444
|
+
*
|
|
24445
|
+
* @private internal utility of the script runners
|
|
24368
24446
|
*/
|
|
24369
|
-
|
|
24370
|
-
|
|
24371
|
-
|
|
24372
|
-
|
|
24373
|
-
|
|
24374
|
-
|
|
24375
|
-
|
|
24376
|
-
|
|
24377
|
-
modelDescription: 'The best model for coding and agentic tasks with configurable reasoning effort.',
|
|
24378
|
-
pricing: {
|
|
24379
|
-
prompt: pricing(`$1.25 / 1M tokens`),
|
|
24380
|
-
output: pricing(`$10.00 / 1M tokens`),
|
|
24381
|
-
},
|
|
24382
|
-
},
|
|
24383
|
-
{
|
|
24384
|
-
modelVariant: 'CHAT',
|
|
24385
|
-
modelTitle: 'gpt-5',
|
|
24386
|
-
modelName: 'gpt-5',
|
|
24387
|
-
modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities. DEPRECATED: Use gpt-5.1 instead.",
|
|
24388
|
-
pricing: {
|
|
24389
|
-
prompt: pricing(`$1.25 / 1M tokens`),
|
|
24390
|
-
output: pricing(`$10.00 / 1M tokens`),
|
|
24391
|
-
},
|
|
24392
|
-
},
|
|
24393
|
-
/**/
|
|
24394
|
-
/**/
|
|
24395
|
-
{
|
|
24396
|
-
modelVariant: 'CHAT',
|
|
24397
|
-
modelTitle: 'gpt-5.2-codex',
|
|
24398
|
-
modelName: 'gpt-5.2-codex',
|
|
24399
|
-
modelDescription: 'High-capability Codex variant tuned for agentic code generation with large contexts and reasoning effort controls. Ideal for long-horizon coding workflows and multi-step reasoning.',
|
|
24400
|
-
pricing: {
|
|
24401
|
-
prompt: pricing(`$1.75 / 1M tokens`),
|
|
24402
|
-
output: pricing(`$14.00 / 1M tokens`),
|
|
24403
|
-
},
|
|
24404
|
-
},
|
|
24405
|
-
/**/
|
|
24406
|
-
/**/
|
|
24407
|
-
{
|
|
24408
|
-
modelVariant: 'CHAT',
|
|
24409
|
-
modelTitle: 'gpt-5.1-codex-max',
|
|
24410
|
-
modelName: 'gpt-5.1-codex-max',
|
|
24411
|
-
modelDescription: 'Premium GPT-5.1 Codex flavor that mirrors gpt-5.1 in capability and pricing while adding Codex tooling optimizations.',
|
|
24412
|
-
pricing: {
|
|
24413
|
-
prompt: pricing(`$1.25 / 1M tokens`),
|
|
24414
|
-
output: pricing(`$10.00 / 1M tokens`),
|
|
24415
|
-
},
|
|
24416
|
-
},
|
|
24417
|
-
/**/
|
|
24418
|
-
/**/
|
|
24419
|
-
{
|
|
24420
|
-
modelVariant: 'CHAT',
|
|
24421
|
-
modelTitle: 'gpt-5.1-codex',
|
|
24422
|
-
modelName: 'gpt-5.1-codex',
|
|
24423
|
-
modelDescription: 'Core GPT-5.1 Codex model focused on agentic coding tasks with a balanced trade-off between reasoning and cost.',
|
|
24424
|
-
pricing: {
|
|
24425
|
-
prompt: pricing(`$1.25 / 1M tokens`),
|
|
24426
|
-
output: pricing(`$10.00 / 1M tokens`),
|
|
24427
|
-
},
|
|
24428
|
-
},
|
|
24429
|
-
/**/
|
|
24430
|
-
/**/
|
|
24431
|
-
{
|
|
24432
|
-
modelVariant: 'CHAT',
|
|
24433
|
-
modelTitle: 'gpt-5.1-codex-mini',
|
|
24434
|
-
modelName: 'gpt-5.1-codex-mini',
|
|
24435
|
-
modelDescription: 'Compact, cost-effective GPT-5.1 Codex variant with a smaller context window ideal for cheap assistant iterations that still require coding awareness.',
|
|
24436
|
-
pricing: {
|
|
24437
|
-
prompt: pricing(`$0.25 / 1M tokens`),
|
|
24438
|
-
output: pricing(`$2.00 / 1M tokens`),
|
|
24439
|
-
},
|
|
24440
|
-
},
|
|
24441
|
-
/**/
|
|
24442
|
-
/**/
|
|
24443
|
-
{
|
|
24444
|
-
modelVariant: 'CHAT',
|
|
24445
|
-
modelTitle: 'gpt-5-codex',
|
|
24446
|
-
modelName: 'gpt-5-codex',
|
|
24447
|
-
modelDescription: 'Legacy GPT-5 Codex model built for agentic coding workloads with the same pricing as GPT-5 and a focus on stability.',
|
|
24448
|
-
pricing: {
|
|
24449
|
-
prompt: pricing(`$1.25 / 1M tokens`),
|
|
24450
|
-
output: pricing(`$10.00 / 1M tokens`),
|
|
24451
|
-
},
|
|
24452
|
-
},
|
|
24453
|
-
/**/
|
|
24454
|
-
/**/
|
|
24455
|
-
{
|
|
24456
|
-
modelVariant: 'CHAT',
|
|
24457
|
-
modelTitle: 'gpt-5-mini',
|
|
24458
|
-
modelName: 'gpt-5-mini',
|
|
24459
|
-
modelDescription: 'A faster, cost-efficient version of GPT-5 for well-defined tasks with 200K context window. Maintains core GPT-5 capabilities while offering 5x faster inference and significantly lower costs. Features enhanced instruction following and reduced latency for production applications requiring quick responses with high quality.',
|
|
24460
|
-
pricing: {
|
|
24461
|
-
prompt: pricing(`$0.25 / 1M tokens`),
|
|
24462
|
-
output: pricing(`$2.00 / 1M tokens`),
|
|
24463
|
-
},
|
|
24464
|
-
},
|
|
24465
|
-
/**/
|
|
24466
|
-
/**/
|
|
24467
|
-
{
|
|
24468
|
-
modelVariant: 'CHAT',
|
|
24469
|
-
modelTitle: 'gpt-5-nano',
|
|
24470
|
-
modelName: 'gpt-5-nano',
|
|
24471
|
-
modelDescription: 'The fastest, most cost-efficient version of GPT-5 with 200K context window. Optimized for summarization, classification, and simple reasoning tasks. Features 10x faster inference than base GPT-5 while maintaining good quality for straightforward applications. Ideal for high-volume, cost-sensitive deployments.',
|
|
24472
|
-
pricing: {
|
|
24473
|
-
prompt: pricing(`$0.05 / 1M tokens`),
|
|
24474
|
-
output: pricing(`$0.40 / 1M tokens`),
|
|
24475
|
-
},
|
|
24476
|
-
},
|
|
24477
|
-
/**/
|
|
24478
|
-
/**/
|
|
24479
|
-
{
|
|
24480
|
-
modelVariant: 'CHAT',
|
|
24481
|
-
modelTitle: 'gpt-4.1',
|
|
24482
|
-
modelName: 'gpt-4.1',
|
|
24483
|
-
modelDescription: 'Smartest non-reasoning model with 128K context window. Enhanced version of GPT-4 with improved instruction following, better factual accuracy, and reduced hallucinations. Features advanced function calling capabilities and superior performance on coding tasks. Ideal for applications requiring high intelligence without reasoning overhead.',
|
|
24484
|
-
pricing: {
|
|
24485
|
-
prompt: pricing(`$2.00 / 1M tokens`),
|
|
24486
|
-
output: pricing(`$8.00 / 1M tokens`),
|
|
24487
|
-
},
|
|
24488
|
-
},
|
|
24489
|
-
/**/
|
|
24490
|
-
/**/
|
|
24491
|
-
{
|
|
24492
|
-
modelVariant: 'CHAT',
|
|
24493
|
-
modelTitle: 'gpt-4.1-mini',
|
|
24494
|
-
modelName: 'gpt-4.1-mini',
|
|
24495
|
-
modelDescription: 'Smaller, faster version of GPT-4.1 with 128K context window. Balances intelligence and efficiency with 3x faster inference than base GPT-4.1. Maintains strong capabilities across text generation, reasoning, and coding while offering better cost-performance ratio for most applications.',
|
|
24496
|
-
pricing: {
|
|
24497
|
-
prompt: pricing(`$0.40 / 1M tokens`),
|
|
24498
|
-
output: pricing(`$1.60 / 1M tokens`),
|
|
24499
|
-
},
|
|
24500
|
-
},
|
|
24501
|
-
/**/
|
|
24502
|
-
/**/
|
|
24503
|
-
{
|
|
24504
|
-
modelVariant: 'CHAT',
|
|
24505
|
-
modelTitle: 'gpt-4.1-nano',
|
|
24506
|
-
modelName: 'gpt-4.1-nano',
|
|
24507
|
-
modelDescription: 'Fastest, most cost-efficient version of GPT-4.1 with 128K context window. Optimized for high-throughput applications requiring good quality at minimal cost. Features 5x faster inference than GPT-4.1 while maintaining adequate performance for most general-purpose tasks.',
|
|
24508
|
-
pricing: {
|
|
24509
|
-
prompt: pricing(`$0.10 / 1M tokens`),
|
|
24510
|
-
output: pricing(`$0.40 / 1M tokens`),
|
|
24511
|
-
},
|
|
24512
|
-
},
|
|
24513
|
-
/**/
|
|
24514
|
-
/**/
|
|
24515
|
-
{
|
|
24516
|
-
modelVariant: 'CHAT',
|
|
24517
|
-
modelTitle: 'o3',
|
|
24518
|
-
modelName: 'o3',
|
|
24519
|
-
modelDescription: 'Advanced reasoning model with 128K context window specializing in complex logical, mathematical, and analytical tasks. Successor to o1 with enhanced step-by-step problem-solving capabilities and superior performance on STEM-focused problems. Ideal for professional applications requiring deep analytical thinking and precise reasoning.',
|
|
24520
|
-
pricing: {
|
|
24521
|
-
prompt: pricing(`$2.00 / 1M tokens`),
|
|
24522
|
-
output: pricing(`$8.00 / 1M tokens`),
|
|
24523
|
-
},
|
|
24524
|
-
},
|
|
24525
|
-
/**/
|
|
24526
|
-
/**/
|
|
24527
|
-
{
|
|
24528
|
-
modelVariant: 'CHAT',
|
|
24529
|
-
modelTitle: 'o3-pro',
|
|
24530
|
-
modelName: 'o3-pro',
|
|
24531
|
-
modelDescription: 'Enhanced version of o3 with more compute allocated for better responses on the most challenging problems. Features extended reasoning time and improved accuracy on complex analytical tasks. Designed for applications where maximum reasoning quality is more important than response speed.',
|
|
24532
|
-
pricing: {
|
|
24533
|
-
prompt: pricing(`$20.00 / 1M tokens`),
|
|
24534
|
-
output: pricing(`$80.00 / 1M tokens`),
|
|
24535
|
-
},
|
|
24536
|
-
},
|
|
24537
|
-
/**/
|
|
24538
|
-
/**/
|
|
24539
|
-
{
|
|
24540
|
-
modelVariant: 'CHAT',
|
|
24541
|
-
modelTitle: 'o4-mini',
|
|
24542
|
-
modelName: 'o4-mini',
|
|
24543
|
-
modelDescription: 'Fast, cost-efficient reasoning model with 128K context window. Successor to o1-mini with improved analytical capabilities while maintaining speed advantages. Features enhanced mathematical reasoning and logical problem-solving at significantly lower cost than full reasoning models.',
|
|
24544
|
-
pricing: {
|
|
24545
|
-
prompt: pricing(`$1.10 / 1M tokens`),
|
|
24546
|
-
output: pricing(`$4.40 / 1M tokens`),
|
|
24547
|
-
},
|
|
24548
|
-
},
|
|
24549
|
-
/**/
|
|
24550
|
-
/**/
|
|
24551
|
-
{
|
|
24552
|
-
modelVariant: 'CHAT',
|
|
24553
|
-
modelTitle: 'o3-deep-research',
|
|
24554
|
-
modelName: 'o3-deep-research',
|
|
24555
|
-
modelDescription: 'Most powerful deep research model with 128K context window. Specialized for comprehensive research tasks, literature analysis, and complex information synthesis. Features advanced citation capabilities and enhanced factual accuracy for academic and professional research applications.',
|
|
24556
|
-
pricing: {
|
|
24557
|
-
prompt: pricing(`$25.00 / 1M tokens`),
|
|
24558
|
-
output: pricing(`$100.00 / 1M tokens`),
|
|
24559
|
-
},
|
|
24560
|
-
},
|
|
24561
|
-
/**/
|
|
24562
|
-
/**/
|
|
24563
|
-
{
|
|
24564
|
-
modelVariant: 'CHAT',
|
|
24565
|
-
modelTitle: 'o4-mini-deep-research',
|
|
24566
|
-
modelName: 'o4-mini-deep-research',
|
|
24567
|
-
modelDescription: 'Faster, more affordable deep research model with 128K context window. Balances research capabilities with cost efficiency, offering good performance on literature review, fact-checking, and information synthesis tasks at a more accessible price point.',
|
|
24568
|
-
pricing: {
|
|
24569
|
-
prompt: pricing(`$12.00 / 1M tokens`),
|
|
24570
|
-
output: pricing(`$48.00 / 1M tokens`),
|
|
24571
|
-
},
|
|
24572
|
-
},
|
|
24573
|
-
/**/
|
|
24574
|
-
/**/
|
|
24575
|
-
{
|
|
24576
|
-
modelVariant: 'IMAGE_GENERATION',
|
|
24577
|
-
modelTitle: 'dall-e-3',
|
|
24578
|
-
modelName: 'dall-e-3',
|
|
24579
|
-
modelDescription: 'DALL·E 3 is the latest version of the DALL·E art generation model. It understands significantly more nuance and detail than our previous systems, allowing you to easily translate your ideas into exceptionally accurate images.',
|
|
24580
|
-
pricing: {
|
|
24581
|
-
prompt: 0,
|
|
24582
|
-
output: 0.04,
|
|
24583
|
-
},
|
|
24447
|
+
function createScriptOutputLineReader() {
|
|
24448
|
+
let unterminatedLine = '';
|
|
24449
|
+
return {
|
|
24450
|
+
readCompletedLines(chunk) {
|
|
24451
|
+
var _a;
|
|
24452
|
+
const lines = `${unterminatedLine}${chunk}`.split(/\r?\n/);
|
|
24453
|
+
unterminatedLine = (_a = lines.pop()) !== null && _a !== void 0 ? _a : '';
|
|
24454
|
+
return lines;
|
|
24584
24455
|
},
|
|
24585
|
-
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
|
|
24591
|
-
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24598
|
-
|
|
24599
|
-
|
|
24600
|
-
|
|
24601
|
-
|
|
24602
|
-
|
|
24603
|
-
|
|
24604
|
-
|
|
24605
|
-
|
|
24606
|
-
|
|
24607
|
-
|
|
24608
|
-
|
|
24609
|
-
|
|
24610
|
-
|
|
24611
|
-
|
|
24612
|
-
|
|
24613
|
-
|
|
24614
|
-
|
|
24615
|
-
|
|
24616
|
-
|
|
24617
|
-
|
|
24618
|
-
|
|
24619
|
-
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
|
|
24625
|
-
|
|
24626
|
-
|
|
24627
|
-
|
|
24628
|
-
|
|
24629
|
-
|
|
24630
|
-
|
|
24631
|
-
|
|
24632
|
-
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
|
|
24636
|
-
|
|
24637
|
-
|
|
24638
|
-
|
|
24639
|
-
|
|
24640
|
-
|
|
24641
|
-
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
|
|
24647
|
-
|
|
24648
|
-
|
|
24649
|
-
|
|
24650
|
-
|
|
24651
|
-
|
|
24652
|
-
|
|
24653
|
-
|
|
24654
|
-
|
|
24655
|
-
|
|
24656
|
-
|
|
24657
|
-
|
|
24658
|
-
|
|
24659
|
-
|
|
24660
|
-
|
|
24661
|
-
|
|
24662
|
-
|
|
24663
|
-
|
|
24664
|
-
|
|
24665
|
-
|
|
24666
|
-
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
|
|
24678
|
-
|
|
24679
|
-
|
|
24680
|
-
|
|
24681
|
-
|
|
24682
|
-
|
|
24683
|
-
|
|
24684
|
-
|
|
24685
|
-
|
|
24686
|
-
|
|
24687
|
-
|
|
24688
|
-
|
|
24689
|
-
|
|
24690
|
-
|
|
24691
|
-
|
|
24692
|
-
|
|
24693
|
-
|
|
24694
|
-
|
|
24695
|
-
|
|
24696
|
-
|
|
24697
|
-
|
|
24698
|
-
|
|
24699
|
-
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
|
|
24703
|
-
|
|
24704
|
-
|
|
24705
|
-
|
|
24706
|
-
|
|
24707
|
-
|
|
24708
|
-
|
|
24709
|
-
|
|
24710
|
-
|
|
24711
|
-
|
|
24712
|
-
|
|
24713
|
-
|
|
24714
|
-
|
|
24715
|
-
|
|
24716
|
-
|
|
24717
|
-
|
|
24718
|
-
|
|
24719
|
-
|
|
24720
|
-
|
|
24721
|
-
}
|
|
24722
|
-
|
|
24723
|
-
|
|
24724
|
-
|
|
24725
|
-
|
|
24726
|
-
|
|
24727
|
-
|
|
24728
|
-
|
|
24729
|
-
|
|
24730
|
-
|
|
24731
|
-
|
|
24732
|
-
|
|
24733
|
-
|
|
24734
|
-
|
|
24735
|
-
|
|
24736
|
-
|
|
24737
|
-
|
|
24738
|
-
|
|
24739
|
-
|
|
24740
|
-
|
|
24741
|
-
|
|
24742
|
-
|
|
24743
|
-
|
|
24744
|
-
|
|
24745
|
-
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
|
|
24753
|
-
|
|
24754
|
-
|
|
24755
|
-
|
|
24756
|
-
|
|
24757
|
-
|
|
24758
|
-
|
|
24759
|
-
|
|
24760
|
-
|
|
24761
|
-
|
|
24762
|
-
|
|
24763
|
-
|
|
24764
|
-
|
|
24765
|
-
|
|
24766
|
-
|
|
24767
|
-
|
|
24768
|
-
|
|
24769
|
-
|
|
24770
|
-
|
|
24771
|
-
|
|
24772
|
-
|
|
24773
|
-
|
|
24774
|
-
|
|
24775
|
-
|
|
24776
|
-
|
|
24777
|
-
/**/
|
|
24778
|
-
{
|
|
24779
|
-
modelVariant: 'CHAT',
|
|
24780
|
-
modelTitle: 'gpt-4-1106-preview',
|
|
24781
|
-
modelName: 'gpt-4-1106-preview',
|
|
24782
|
-
modelDescription: 'November 2023 preview version of GPT-4 Turbo with 128K token context window. Features improved instruction following, better function calling capabilities, and enhanced reasoning. Includes knowledge cutoff from April 2023. Suitable for complex applications requiring extensive document understanding and sophisticated interactions.',
|
|
24783
|
-
pricing: {
|
|
24784
|
-
prompt: pricing(`$10.00 / 1M tokens`),
|
|
24785
|
-
output: pricing(`$30.00 / 1M tokens`),
|
|
24786
|
-
},
|
|
24787
|
-
},
|
|
24788
|
-
/**/
|
|
24789
|
-
/**/
|
|
24790
|
-
{
|
|
24791
|
-
modelVariant: 'CHAT',
|
|
24792
|
-
modelTitle: 'gpt-4-0125-preview',
|
|
24793
|
-
modelName: 'gpt-4-0125-preview',
|
|
24794
|
-
modelDescription: 'January 2024 preview version of GPT-4 Turbo with 128K token context window. Features improved reasoning capabilities, enhanced tool use, and more reliable function calling. Includes knowledge cutoff from October 2023. Offers better performance on complex logical tasks and more consistent outputs than previous preview versions.',
|
|
24795
|
-
pricing: {
|
|
24796
|
-
prompt: pricing(`$10.00 / 1M tokens`),
|
|
24797
|
-
output: pricing(`$30.00 / 1M tokens`),
|
|
24798
|
-
},
|
|
24799
|
-
},
|
|
24800
|
-
/**/
|
|
24801
|
-
/*/
|
|
24802
|
-
{
|
|
24803
|
-
modelTitle: 'tts-1-1106',
|
|
24804
|
-
modelName: 'tts-1-1106',
|
|
24805
|
-
},
|
|
24806
|
-
/**/
|
|
24807
|
-
/**/
|
|
24808
|
-
{
|
|
24809
|
-
modelVariant: 'CHAT',
|
|
24810
|
-
modelTitle: 'gpt-3.5-turbo-0125',
|
|
24811
|
-
modelName: 'gpt-3.5-turbo-0125',
|
|
24812
|
-
modelDescription: 'January 2024 version of GPT-3.5 Turbo with 16K token context window. Features improved reasoning capabilities, better instruction adherence, and reduced hallucinations compared to previous versions. Includes knowledge cutoff from September 2021. Provides good performance for most general applications at reasonable cost.',
|
|
24813
|
-
pricing: {
|
|
24814
|
-
prompt: pricing(`$0.50 / 1M tokens`),
|
|
24815
|
-
output: pricing(`$1.50 / 1M tokens`),
|
|
24816
|
-
},
|
|
24817
|
-
},
|
|
24818
|
-
/**/
|
|
24819
|
-
/**/
|
|
24820
|
-
{
|
|
24821
|
-
modelVariant: 'CHAT',
|
|
24822
|
-
modelTitle: 'gpt-4-turbo-preview',
|
|
24823
|
-
modelName: 'gpt-4-turbo-preview',
|
|
24824
|
-
modelDescription: 'Preview version of GPT-4 Turbo with 128K token context window that points to the latest development model. Features cutting-edge improvements to instruction following, knowledge representation, and tool use capabilities. Provides access to newest features but may have occasional behavior changes. Best for non-critical applications wanting latest capabilities.',
|
|
24825
|
-
pricing: {
|
|
24826
|
-
prompt: pricing(`$10.00 / 1M tokens`),
|
|
24827
|
-
output: pricing(`$30.00 / 1M tokens`),
|
|
24828
|
-
},
|
|
24829
|
-
},
|
|
24830
|
-
/**/
|
|
24831
|
-
/**/
|
|
24832
|
-
{
|
|
24833
|
-
modelVariant: 'EMBEDDING',
|
|
24834
|
-
modelTitle: 'text-embedding-3-large',
|
|
24835
|
-
modelName: 'text-embedding-3-large',
|
|
24836
|
-
modelDescription: "OpenAI's most capable text embedding model generating 3072-dimensional vectors. Designed for high-quality embeddings for complex similarity tasks, clustering, and information retrieval. Features enhanced cross-lingual capabilities and significantly improved performance on retrieval and classification benchmarks. Ideal for sophisticated RAG systems and semantic search applications.",
|
|
24837
|
-
pricing: {
|
|
24838
|
-
prompt: pricing(`$0.13 / 1M tokens`),
|
|
24839
|
-
output: 0,
|
|
24840
|
-
},
|
|
24841
|
-
},
|
|
24842
|
-
/**/
|
|
24843
|
-
/**/
|
|
24844
|
-
{
|
|
24845
|
-
modelVariant: 'EMBEDDING',
|
|
24846
|
-
modelTitle: 'text-embedding-3-small',
|
|
24847
|
-
modelName: 'text-embedding-3-small',
|
|
24848
|
-
modelDescription: 'Cost-effective embedding model generating 1536-dimensional vectors. Balances quality and efficiency for simpler tasks while maintaining good performance on text similarity and retrieval applications. Offers 20% better quality than ada-002 at significantly lower cost. Ideal for production embedding applications with cost constraints.',
|
|
24849
|
-
pricing: {
|
|
24850
|
-
prompt: pricing(`$0.02 / 1M tokens`),
|
|
24851
|
-
output: 0,
|
|
24852
|
-
},
|
|
24853
|
-
},
|
|
24854
|
-
/**/
|
|
24855
|
-
/**/
|
|
24856
|
-
{
|
|
24857
|
-
modelVariant: 'CHAT',
|
|
24858
|
-
modelTitle: 'gpt-3.5-turbo-0613',
|
|
24859
|
-
modelName: 'gpt-3.5-turbo-0613',
|
|
24860
|
-
modelDescription: "June 2023 version of GPT-3.5 Turbo with 4K token context window. Features function calling capabilities for structured data extraction and API interaction. Includes knowledge cutoff from September 2021. Maintained for applications specifically designed for this version's behaviors and capabilities.",
|
|
24861
|
-
pricing: {
|
|
24862
|
-
prompt: pricing(`$1.50 / 1M tokens`),
|
|
24863
|
-
output: pricing(`$2.00 / 1M tokens`),
|
|
24864
|
-
},
|
|
24865
|
-
},
|
|
24866
|
-
/**/
|
|
24867
|
-
/**/
|
|
24868
|
-
{
|
|
24869
|
-
modelVariant: 'EMBEDDING',
|
|
24870
|
-
modelTitle: 'text-embedding-ada-002',
|
|
24871
|
-
modelName: 'text-embedding-ada-002',
|
|
24872
|
-
modelDescription: 'Legacy text embedding model generating 1536-dimensional vectors suitable for text similarity and retrieval applications. Processes up to 8K tokens per request with consistent embedding quality. While superseded by newer embedding-3 models, still maintains adequate performance for many semantic search and classification tasks.',
|
|
24873
|
-
pricing: {
|
|
24874
|
-
prompt: pricing(`$0.1 / 1M tokens`),
|
|
24875
|
-
output: 0,
|
|
24876
|
-
},
|
|
24877
|
-
},
|
|
24878
|
-
/**/
|
|
24879
|
-
/*/
|
|
24880
|
-
{
|
|
24881
|
-
modelVariant: 'CHAT',
|
|
24882
|
-
modelTitle: 'gpt-4-1106-vision-preview',
|
|
24883
|
-
modelName: 'gpt-4-1106-vision-preview',
|
|
24884
|
-
},
|
|
24885
|
-
/**/
|
|
24886
|
-
/*/
|
|
24887
|
-
{
|
|
24888
|
-
modelVariant: 'CHAT',
|
|
24889
|
-
modelTitle: 'gpt-4-vision-preview',
|
|
24890
|
-
modelName: 'gpt-4-vision-preview',
|
|
24891
|
-
pricing: {
|
|
24892
|
-
prompt: computeUsage(`$10.00 / 1M tokens`),
|
|
24893
|
-
output: computeUsage(`$30.00 / 1M tokens`),
|
|
24894
|
-
},
|
|
24895
|
-
},
|
|
24896
|
-
/**/
|
|
24897
|
-
/**/
|
|
24898
|
-
{
|
|
24899
|
-
modelVariant: 'CHAT',
|
|
24900
|
-
modelTitle: 'gpt-4o-2024-05-13',
|
|
24901
|
-
modelName: 'gpt-4o-2024-05-13',
|
|
24902
|
-
modelDescription: 'May 2024 version of GPT-4o with 128K context window. Features enhanced multimodal capabilities including superior image understanding (up to 20MP), audio processing, and improved reasoning. Optimized for 2x lower latency than GPT-4 Turbo while maintaining high performance. Includes knowledge up to October 2023. Ideal for production applications requiring reliable multimodal capabilities.',
|
|
24903
|
-
pricing: {
|
|
24904
|
-
prompt: pricing(`$2.50 / 1M tokens`),
|
|
24905
|
-
output: pricing(`$10.00 / 1M tokens`),
|
|
24906
|
-
},
|
|
24907
|
-
},
|
|
24908
|
-
/**/
|
|
24909
|
-
/**/
|
|
24910
|
-
{
|
|
24911
|
-
modelVariant: 'CHAT',
|
|
24912
|
-
modelTitle: 'gpt-4o',
|
|
24913
|
-
modelName: 'gpt-4o',
|
|
24914
|
-
modelDescription: "OpenAI's most advanced general-purpose multimodal model with 128K context window. Optimized for balanced performance, speed, and cost with 2x faster responses than GPT-4 Turbo. Features excellent vision processing, audio understanding, reasoning, and text generation quality. Represents optimal balance of capability and efficiency for most advanced applications.",
|
|
24915
|
-
pricing: {
|
|
24916
|
-
prompt: pricing(`$2.50 / 1M tokens`),
|
|
24917
|
-
output: pricing(`$10.00 / 1M tokens`),
|
|
24918
|
-
},
|
|
24919
|
-
},
|
|
24920
|
-
/**/
|
|
24921
|
-
/**/
|
|
24922
|
-
{
|
|
24923
|
-
modelVariant: 'CHAT',
|
|
24924
|
-
modelTitle: 'gpt-4o-mini',
|
|
24925
|
-
modelName: 'gpt-4o-mini',
|
|
24926
|
-
modelDescription: 'Smaller, more cost-effective version of GPT-4o with 128K context window. Maintains impressive capabilities across text, vision, and audio tasks while operating at significantly lower cost. Features 3x faster inference than GPT-4o with good performance on general tasks. Excellent for applications requiring good quality multimodal capabilities at scale.',
|
|
24927
|
-
pricing: {
|
|
24928
|
-
prompt: pricing(`$0.15 / 1M tokens`),
|
|
24929
|
-
output: pricing(`$0.60 / 1M tokens`),
|
|
24930
|
-
},
|
|
24931
|
-
},
|
|
24932
|
-
/**/
|
|
24933
|
-
/**/
|
|
24934
|
-
{
|
|
24935
|
-
modelVariant: 'CHAT',
|
|
24936
|
-
modelTitle: 'o1-preview',
|
|
24937
|
-
modelName: 'o1-preview',
|
|
24938
|
-
modelDescription: 'Advanced reasoning model with 128K context window specializing in complex logical, mathematical, and analytical tasks. Features exceptional step-by-step problem-solving capabilities, advanced mathematical and scientific reasoning, and superior performance on STEM-focused problems. Significantly outperforms GPT-4 on quantitative reasoning benchmarks. Ideal for professional and specialized applications.',
|
|
24939
|
-
pricing: {
|
|
24940
|
-
prompt: pricing(`$15.00 / 1M tokens`),
|
|
24941
|
-
output: pricing(`$60.00 / 1M tokens`),
|
|
24942
|
-
},
|
|
24943
|
-
},
|
|
24944
|
-
/**/
|
|
24945
|
-
/**/
|
|
24946
|
-
{
|
|
24947
|
-
modelVariant: 'CHAT',
|
|
24948
|
-
modelTitle: 'o1-preview-2024-09-12',
|
|
24949
|
-
modelName: 'o1-preview-2024-09-12',
|
|
24950
|
-
modelDescription: 'September 2024 version of O1 preview with 128K context window. Features specialized reasoning capabilities with 30% improvement on mathematical and scientific accuracy over previous versions. Includes enhanced support for formal logic, statistical analysis, and technical domains. Optimized for professional applications requiring precise analytical thinking and rigorous methodologies.',
|
|
24951
|
-
pricing: {
|
|
24952
|
-
prompt: pricing(`$15.00 / 1M tokens`),
|
|
24953
|
-
output: pricing(`$60.00 / 1M tokens`),
|
|
24954
|
-
},
|
|
24955
|
-
},
|
|
24956
|
-
/**/
|
|
24957
|
-
/**/
|
|
24958
|
-
{
|
|
24959
|
-
modelVariant: 'CHAT',
|
|
24960
|
-
modelTitle: 'o1-mini',
|
|
24961
|
-
modelName: 'o1-mini',
|
|
24962
|
-
modelDescription: 'Smaller, cost-effective version of the O1 model with 128K context window. Maintains strong analytical reasoning abilities while reducing computational requirements by 70%. Features good performance on mathematical, logical, and scientific tasks at significantly lower cost than full O1. Excellent for everyday analytical applications that benefit from reasoning focus.',
|
|
24963
|
-
pricing: {
|
|
24964
|
-
prompt: pricing(`$3.00 / 1M tokens`),
|
|
24965
|
-
output: pricing(`$12.00 / 1M tokens`),
|
|
24966
|
-
},
|
|
24967
|
-
},
|
|
24968
|
-
/**/
|
|
24969
|
-
/**/
|
|
24970
|
-
{
|
|
24971
|
-
modelVariant: 'CHAT',
|
|
24972
|
-
modelTitle: 'o1',
|
|
24973
|
-
modelName: 'o1',
|
|
24974
|
-
modelDescription: "OpenAI's advanced reasoning model with 128K context window focusing on logical problem-solving and analytical thinking. Features exceptional performance on quantitative tasks, step-by-step deduction, and complex technical problems. Maintains 95%+ of o1-preview capabilities with production-ready stability. Ideal for scientific computing, financial analysis, and professional applications.",
|
|
24975
|
-
pricing: {
|
|
24976
|
-
prompt: pricing(`$15.00 / 1M tokens`),
|
|
24977
|
-
output: pricing(`$60.00 / 1M tokens`),
|
|
24978
|
-
},
|
|
24979
|
-
},
|
|
24980
|
-
/**/
|
|
24981
|
-
/**/
|
|
24982
|
-
{
|
|
24983
|
-
modelVariant: 'CHAT',
|
|
24984
|
-
modelTitle: 'o3-mini',
|
|
24985
|
-
modelName: 'o3-mini',
|
|
24986
|
-
modelDescription: 'Cost-effective reasoning model with 128K context window optimized for academic and scientific problem-solving. Features efficient performance on STEM tasks with specialized capabilities in mathematics, physics, chemistry, and computer science. Offers 80% of O1 performance on technical domains at significantly lower cost. Ideal for educational applications and research support.',
|
|
24987
|
-
pricing: {
|
|
24988
|
-
prompt: pricing(`$1.10 / 1M tokens`),
|
|
24989
|
-
output: pricing(`$4.40 / 1M tokens`),
|
|
24990
|
-
},
|
|
24991
|
-
},
|
|
24992
|
-
/**/
|
|
24993
|
-
/**/
|
|
24994
|
-
{
|
|
24995
|
-
modelVariant: 'CHAT',
|
|
24996
|
-
modelTitle: 'o1-mini-2024-09-12',
|
|
24997
|
-
modelName: 'o1-mini-2024-09-12',
|
|
24998
|
-
modelDescription: "September 2024 version of O1-mini with 128K context window featuring balanced reasoning capabilities and cost-efficiency. Includes 25% improvement in mathematical accuracy and enhanced performance on coding tasks compared to previous versions. Maintains efficient resource utilization while delivering improved results for analytical applications that don't require the full O1 model.",
|
|
24999
|
-
pricing: {
|
|
25000
|
-
prompt: pricing(`$3.00 / 1M tokens`),
|
|
25001
|
-
output: pricing(`$12.00 / 1M tokens`),
|
|
25002
|
-
},
|
|
25003
|
-
},
|
|
25004
|
-
/**/
|
|
25005
|
-
/**/
|
|
25006
|
-
{
|
|
25007
|
-
modelVariant: 'CHAT',
|
|
25008
|
-
modelTitle: 'gpt-3.5-turbo-16k-0613',
|
|
25009
|
-
modelName: 'gpt-3.5-turbo-16k-0613',
|
|
25010
|
-
modelDescription: "June 2023 version of GPT-3.5 Turbo with extended 16K token context window. Features good handling of longer conversations and documents with improved memory management across extended contexts. Includes knowledge cutoff from September 2021. Maintained for applications specifically designed for this version's behaviors and capabilities.",
|
|
25011
|
-
pricing: {
|
|
25012
|
-
prompt: pricing(`$3.00 / 1M tokens`),
|
|
25013
|
-
output: pricing(`$4.00 / 1M tokens`),
|
|
25014
|
-
},
|
|
25015
|
-
},
|
|
25016
|
-
/**/
|
|
25017
|
-
// <- [🕕]
|
|
25018
|
-
],
|
|
25019
|
-
});
|
|
25020
|
-
/**
|
|
25021
|
-
* Note: [🤖] Add models of new variant
|
|
25022
|
-
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
25023
|
-
* TODO: [🎰] Some mechanism to auto-update available models
|
|
25024
|
-
* TODO: [🎰][👮♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
25025
|
-
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
25026
|
-
* @see https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4
|
|
25027
|
-
* @see https://openai.com/api/pricing/
|
|
25028
|
-
* @see /other/playground/playground.ts
|
|
25029
|
-
* TODO: [🍓][💩] Make better
|
|
25030
|
-
* TODO: Change model titles to human eg: "gpt-4-turbo-2024-04-09" -> "GPT-4 Turbo (2024-04-09)"
|
|
25031
|
-
* TODO: [🚸] Not all models are compatible with JSON mode, add this information here and use it
|
|
25032
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
25033
|
-
*/
|
|
25034
|
-
|
|
25035
|
-
/**
|
|
25036
|
-
* Pattern that matches durations like "1h", "30m", "5s", "1h30m", "1h30m5s".
|
|
25037
|
-
*/
|
|
25038
|
-
const DURATION_PATTERN = /^(?:(\d+)h)?(?:(\d+)m(?:in)?)?(?:(\d+)s)?$/;
|
|
25039
|
-
/**
|
|
25040
|
-
* Parses a human-readable duration string into milliseconds.
|
|
25041
|
-
*
|
|
25042
|
-
* Supported formats: `Xh`, `Xm`, `Xs`, and combinations like `1h30m`, `1h30m5s`.
|
|
25043
|
-
*
|
|
25044
|
-
* @returns Duration in milliseconds
|
|
25045
|
-
* @throws When the string does not match any supported format
|
|
25046
|
-
*
|
|
25047
|
-
* @private internal utility of `ptbk coder run`
|
|
25048
|
-
*/
|
|
25049
|
-
function parseDuration(durationString) {
|
|
25050
|
-
var _a, _b, _c;
|
|
25051
|
-
const trimmed = durationString.trim();
|
|
25052
|
-
if (!trimmed) {
|
|
25053
|
-
throw new Error(`Invalid duration: empty string. Expected a format like "1h", "30m", "5s", or combinations like "1h30m".`);
|
|
25054
|
-
}
|
|
25055
|
-
const match = trimmed.match(DURATION_PATTERN);
|
|
25056
|
-
if (!match || (match[1] === undefined && match[2] === undefined && match[3] === undefined)) {
|
|
25057
|
-
throw new Error(`Invalid duration: "${durationString}". Expected a format like "1h", "30m", "5s", or combinations like "1h30m5s".`);
|
|
25058
|
-
}
|
|
25059
|
-
const hours = parseInt((_a = match[1]) !== null && _a !== void 0 ? _a : '0', 10);
|
|
25060
|
-
const minutes = parseInt((_b = match[2]) !== null && _b !== void 0 ? _b : '0', 10);
|
|
25061
|
-
const seconds = parseInt((_c = match[3]) !== null && _c !== void 0 ? _c : '0', 10);
|
|
25062
|
-
return (hours * 3600 + minutes * 60 + seconds) * 1000;
|
|
25063
|
-
}
|
|
25064
|
-
/**
|
|
25065
|
-
* Formats a duration in milliseconds into a compact human-readable string.
|
|
25066
|
-
*
|
|
25067
|
-
* Examples: `3600000` → `"1h"`, `90000` → `"1m 30s"`, `5000` → `"5s"`.
|
|
25068
|
-
*
|
|
25069
|
-
* @private internal utility of `ptbk coder run`
|
|
25070
|
-
*/
|
|
25071
|
-
function formatDurationMs(ms) {
|
|
25072
|
-
const totalSeconds = Math.ceil(ms / 1000);
|
|
25073
|
-
const hours = Math.floor(totalSeconds / 3600);
|
|
25074
|
-
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
25075
|
-
const seconds = totalSeconds % 60;
|
|
25076
|
-
const parts = [];
|
|
25077
|
-
if (hours > 0)
|
|
25078
|
-
parts.push(`${hours}h`);
|
|
25079
|
-
if (minutes > 0)
|
|
25080
|
-
parts.push(`${minutes}m`);
|
|
25081
|
-
if (seconds > 0 || parts.length === 0)
|
|
25082
|
-
parts.push(`${seconds}s`);
|
|
25083
|
-
return parts.join(' ');
|
|
25084
|
-
}
|
|
25085
|
-
|
|
25086
|
-
/**
|
|
25087
|
-
* Creates a line reader for one shell output stream.
|
|
25088
|
-
*
|
|
25089
|
-
* A chunk boundary can fall into the middle of a line, so the unterminated rest is remembered until the next chunk
|
|
25090
|
-
* completes it. Every observer of the live output therefore sees whole lines only, exactly as the finished output
|
|
25091
|
-
* would contain them. One reader belongs to one stream, because interleaving `stdout` and `stderr` into a single
|
|
25092
|
-
* buffer would splice two unrelated halves into one nonexistent line.
|
|
25093
|
-
*
|
|
25094
|
-
* @private internal utility of the script runners
|
|
25095
|
-
*/
|
|
25096
|
-
function createScriptOutputLineReader() {
|
|
25097
|
-
let unterminatedLine = '';
|
|
25098
|
-
return {
|
|
25099
|
-
readCompletedLines(chunk) {
|
|
25100
|
-
var _a;
|
|
25101
|
-
const lines = `${unterminatedLine}${chunk}`.split(/\r?\n/);
|
|
25102
|
-
unterminatedLine = (_a = lines.pop()) !== null && _a !== void 0 ? _a : '';
|
|
25103
|
-
return lines;
|
|
25104
|
-
},
|
|
25105
|
-
};
|
|
25106
|
-
}
|
|
25107
|
-
|
|
25108
|
-
/**
|
|
25109
|
-
* Converts a file path to POSIX format.
|
|
25110
|
-
*/
|
|
25111
|
-
function toPosixPath(filePath) {
|
|
25112
|
-
if (process.platform === 'win32') {
|
|
25113
|
-
const match = filePath.match(/^([a-zA-Z]):\\(.*)$/);
|
|
25114
|
-
if (match) {
|
|
25115
|
-
return `/${match[1].toLowerCase()}/${match[2].replace(/\\/g, '/')}`;
|
|
25116
|
-
}
|
|
25117
|
-
}
|
|
25118
|
-
return filePath.replace(/\\/g, '/');
|
|
25119
|
-
}
|
|
25120
|
-
|
|
25121
|
-
/**
|
|
25122
|
-
* Environment variable read by the shell wrapper to tee live output into the temporary runtime log file.
|
|
25123
|
-
*/
|
|
25124
|
-
const PTBK_CODER_LOG_FILE_ENV_NAME = 'PTBK_CODER_LOG_FILE';
|
|
25125
|
-
/**
|
|
25126
|
-
* Log line which separates the raw script input from the raw script output of one execution section.
|
|
25127
|
-
*
|
|
25128
|
-
* Readers of a runtime log split on this marker to look only at what the harness really produced,
|
|
25129
|
-
* without the generated script and the prompt it embeds.
|
|
25130
|
-
*/
|
|
25131
|
-
const SCRIPT_EXECUTION_LOG_RAW_OUTPUT_MARKER = '--- raw output ---';
|
|
25132
|
-
/**
|
|
25133
|
-
* Command which terminates the Bash process tree rooted at the running harness.
|
|
25134
|
-
*
|
|
25135
|
-
* Bash's POSIX process IDs differ from Windows process IDs in Git Bash, so the Windows branch resolves the native PID
|
|
25136
|
-
* before delegating to `taskkill`. Unix harnesses run in a dedicated Bash job process group, which can be terminated
|
|
25137
|
-
* with its negative process ID.
|
|
25138
|
-
*/
|
|
25139
|
-
const TERMINATE_BASH_PROCESS_TREE_COMMAND = process.platform === 'win32'
|
|
25140
|
-
? _spaceTrim.spaceTrim(`
|
|
25141
|
-
HARNESS_WINDOWS_PROCESS_ID="$(ps -l -p "$HARNESS_PROCESS_ID" | awk 'NR == 2 { print $4 }')"
|
|
25142
|
-
if [ -n "$HARNESS_WINDOWS_PROCESS_ID" ]; then
|
|
25143
|
-
MSYS_NO_PATHCONV=1 taskkill.exe /PID "$HARNESS_WINDOWS_PROCESS_ID" /T /F > /dev/null 2>&1 || true
|
|
25144
|
-
fi
|
|
25145
|
-
`)
|
|
25146
|
-
: 'kill -TERM -- "-$HARNESS_PROCESS_ID" 2>/dev/null || true';
|
|
25147
|
-
/**
|
|
25148
|
-
* Shell condition that detects whether the Node process which owns the harness is still running.
|
|
25149
|
-
*
|
|
25150
|
-
* Git Bash translates process IDs and command switches, so querying the native Windows PID needs both `tasklist` and
|
|
25151
|
-
* disabled MSYS path conversion there. Unix can use the native `kill -0` process existence check.
|
|
25152
|
-
*/
|
|
25153
|
-
const IS_PARENT_PROCESS_RUNNING_CONDITION = process.platform === 'win32'
|
|
25154
|
-
? 'MSYS_NO_PATHCONV=1 tasklist.exe /FI "PID eq $PARENT_CODER_PROCESS_ID" /NH | awk -v processId="$PARENT_CODER_PROCESS_ID" \'$2 == processId { isFound = 1 } END { exit isFound ? 0 : 1 }\''
|
|
25155
|
-
: 'kill -0 "$PARENT_CODER_PROCESS_ID" 2>/dev/null';
|
|
25156
|
-
/**
|
|
25157
|
-
* Environment variable that identifies the Node process responsible for a temporary harness shell.
|
|
25158
|
-
*/
|
|
25159
|
-
const PTBK_CODER_PARENT_PROCESS_ID_ENV_NAME = 'PTBK_CODER_PARENT_PROCESS_ID';
|
|
25160
|
-
/**
|
|
25161
|
-
* Small bash wrapper that preserves stdout/stderr streams while teeing both into the runtime log file.
|
|
25162
|
-
*
|
|
25163
|
-
* A watcher polls the owning Node process by its PID. If that process exits abruptly, the watcher stops the whole
|
|
25164
|
-
* Bash and harness process tree instead of letting it continue as an orphan.
|
|
25165
|
-
*/
|
|
25166
|
-
const LOGGED_BASH_WRAPPER_COMMAND = _spaceTrim.spaceTrim(`
|
|
25167
|
-
PARENT_CODER_PROCESS_ID="\${${PTBK_CODER_PARENT_PROCESS_ID_ENV_NAME}}"
|
|
25168
|
-
unset ${PTBK_CODER_PARENT_PROCESS_ID_ENV_NAME}
|
|
25169
|
-
|
|
25170
|
-
terminate_harness_process_tree() {
|
|
25171
|
-
# Keep the EXIT cleanup intact so the wrapper can also stop its parent-process watcher.
|
|
25172
|
-
trap - HUP INT TERM
|
|
25173
|
-
${TERMINATE_BASH_PROCESS_TREE_COMMAND}
|
|
25174
|
-
}
|
|
25175
|
-
|
|
25176
|
-
is_parent_process_running() {
|
|
25177
|
-
${IS_PARENT_PROCESS_RUNNING_CONDITION}
|
|
25178
|
-
}
|
|
25179
|
-
|
|
25180
|
-
if [ -n "\${${PTBK_CODER_LOG_FILE_ENV_NAME}:-}" ]; then
|
|
25181
|
-
exec > >(tee -a "$${PTBK_CODER_LOG_FILE_ENV_NAME}") 2> >(tee -a "$${PTBK_CODER_LOG_FILE_ENV_NAME}" >&2)
|
|
25182
|
-
fi
|
|
25183
|
-
|
|
25184
|
-
watch_parent_process() {
|
|
25185
|
-
trap 'exit 0' HUP INT TERM
|
|
25186
|
-
|
|
25187
|
-
while is_parent_process_running; do
|
|
25188
|
-
sleep 1
|
|
25189
|
-
done
|
|
25190
|
-
|
|
25191
|
-
terminate_harness_process_tree
|
|
25192
|
-
}
|
|
25193
|
-
|
|
25194
|
-
# Background harness jobs need their own process group on Unix so termination cannot reach the parent coder.
|
|
25195
|
-
set -m
|
|
25196
|
-
if ! is_parent_process_running; then
|
|
25197
|
-
exit 1
|
|
25198
|
-
fi
|
|
25199
|
-
bash "$1" &
|
|
25200
|
-
HARNESS_PROCESS_ID=$!
|
|
25201
|
-
|
|
25202
|
-
cleanup_parent_process_watcher() {
|
|
25203
|
-
kill "$PARENT_PROCESS_WATCHER_PID" 2>/dev/null || true
|
|
25204
|
-
wait "$PARENT_PROCESS_WATCHER_PID" 2>/dev/null || true
|
|
25205
|
-
}
|
|
25206
|
-
|
|
25207
|
-
watch_parent_process &
|
|
25208
|
-
PARENT_PROCESS_WATCHER_PID=$!
|
|
25209
|
-
|
|
25210
|
-
trap cleanup_parent_process_watcher EXIT
|
|
25211
|
-
trap terminate_harness_process_tree HUP INT TERM
|
|
25212
|
-
|
|
25213
|
-
wait "$HARNESS_PROCESS_ID"
|
|
25214
|
-
SCRIPT_EXIT_CODE=$?
|
|
25215
|
-
exit "$SCRIPT_EXIT_CODE"
|
|
25216
|
-
`);
|
|
25217
|
-
/**
|
|
25218
|
-
* Shapes one bash invocation that optionally mirrors live script output into a temporary log file.
|
|
25219
|
-
*/
|
|
25220
|
-
function buildLoggedBashExecution(scriptPath, logPath) {
|
|
25221
|
-
return {
|
|
25222
|
-
args: ['-lc', LOGGED_BASH_WRAPPER_COMMAND, 'ptbk-coder-temp-script', toPosixPath(scriptPath)],
|
|
25223
|
-
env: logPath ? { [PTBK_CODER_LOG_FILE_ENV_NAME]: toPosixPath(logPath) } : undefined,
|
|
25224
|
-
};
|
|
25225
|
-
}
|
|
25226
|
-
/**
|
|
25227
|
-
* Appends one execution-start section with the raw script input before the shell begins producing output.
|
|
25228
|
-
*/
|
|
25229
|
-
async function appendScriptExecutionLogStart({ scriptPath, scriptContent, logPath, }) {
|
|
25230
|
-
if (!logPath) {
|
|
25231
|
-
return;
|
|
25232
|
-
}
|
|
25233
|
-
await promises.mkdir(path.dirname(logPath), { recursive: true });
|
|
25234
|
-
const scriptKind = describeTempScriptKind(scriptPath);
|
|
25235
|
-
const normalizedInput = scriptContent.replace(/\r\n/g, '\n').trimEnd();
|
|
25236
|
-
const logSection = _spaceTrim.spaceTrim((block) => `
|
|
25237
|
-
=== ${scriptKind} started at ${new Date().toISOString()} ===
|
|
25238
|
-
Script path: ${toPosixPath(scriptPath)}
|
|
25239
|
-
|
|
25240
|
-
--- raw input ---
|
|
25241
|
-
${block(normalizedInput)}
|
|
25242
|
-
|
|
25243
|
-
${SCRIPT_EXECUTION_LOG_RAW_OUTPUT_MARKER}
|
|
25244
|
-
`);
|
|
25245
|
-
await promises.appendFile(logPath, `${logSection}\n`, 'utf-8');
|
|
25246
|
-
}
|
|
25247
|
-
/**
|
|
25248
|
-
* Appends one execution-finish section after the shell settles.
|
|
25249
|
-
*/
|
|
25250
|
-
async function appendScriptExecutionLogFinish({ scriptPath, logPath, status, details, }) {
|
|
25251
|
-
if (!logPath) {
|
|
25252
|
-
return;
|
|
25253
|
-
}
|
|
25254
|
-
const scriptKind = describeTempScriptKind(scriptPath);
|
|
25255
|
-
const logLines = ['', `=== ${scriptKind} finished at ${new Date().toISOString()} ===`, `Status: ${status}`];
|
|
25256
|
-
if (details !== undefined) {
|
|
25257
|
-
logLines.push('');
|
|
25258
|
-
logLines.push('--- details ---');
|
|
25259
|
-
logLines.push(formatUnknownErrorDetails(details));
|
|
25260
|
-
}
|
|
25261
|
-
logLines.push('');
|
|
25262
|
-
await promises.appendFile(logPath, `${logLines.join('\n')}\n`, 'utf-8');
|
|
25263
|
-
}
|
|
25264
|
-
/**
|
|
25265
|
-
* Distinguishes prompt-runner and verification temp shells in the shared runtime log.
|
|
25266
|
-
*/
|
|
25267
|
-
function describeTempScriptKind(scriptPath) {
|
|
25268
|
-
return scriptPath.toLowerCase().endsWith('.test.sh') ? 'test shell' : 'runner shell';
|
|
25269
|
-
}
|
|
25270
|
-
|
|
25271
|
-
/**
|
|
25272
|
-
* Standard streams used by every temporary Bash runner.
|
|
25273
|
-
*/
|
|
25274
|
-
const BASH_PROCESS_STDIO = ['pipe', 'pipe', 'pipe'];
|
|
25275
|
-
/**
|
|
25276
|
-
* Whether the current Node process is running on Windows.
|
|
25277
|
-
*/
|
|
25278
|
-
const IS_WINDOWS$1 = process.platform === 'win32';
|
|
25279
|
-
/**
|
|
25280
|
-
* Starts one temporary Bash script in a process tree owned by the current Node process.
|
|
25281
|
-
*
|
|
25282
|
-
* The wrapper watches the supplied owning process ID. When that process exits abruptly, the wrapper terminates every
|
|
25283
|
-
* nested shell and harness process instead of leaving it orphaned.
|
|
25284
|
-
*
|
|
25285
|
-
* @private internal utility of the coding prompt runner
|
|
25286
|
-
*/
|
|
25287
|
-
function $spawnLoggedBashScript(options) {
|
|
25288
|
-
var _a;
|
|
25289
|
-
const bashExecution = buildLoggedBashExecution(options.scriptPath, options.logPath);
|
|
25290
|
-
const parentProcessId = (_a = options.parentProcessId) !== null && _a !== void 0 ? _a : process.pid;
|
|
25291
|
-
return child_process.spawn('bash', bashExecution.args, {
|
|
25292
|
-
detached: !IS_WINDOWS$1,
|
|
25293
|
-
env: {
|
|
25294
|
-
...process.env,
|
|
25295
|
-
...bashExecution.env,
|
|
25296
|
-
[PTBK_CODER_PARENT_PROCESS_ID_ENV_NAME]: parentProcessId.toString(),
|
|
24456
|
+
};
|
|
24457
|
+
}
|
|
24458
|
+
|
|
24459
|
+
/**
|
|
24460
|
+
* Converts a file path to POSIX format.
|
|
24461
|
+
*/
|
|
24462
|
+
function toPosixPath(filePath) {
|
|
24463
|
+
if (process.platform === 'win32') {
|
|
24464
|
+
const match = filePath.match(/^([a-zA-Z]):\\(.*)$/);
|
|
24465
|
+
if (match) {
|
|
24466
|
+
return `/${match[1].toLowerCase()}/${match[2].replace(/\\/g, '/')}`;
|
|
24467
|
+
}
|
|
24468
|
+
}
|
|
24469
|
+
return filePath.replace(/\\/g, '/');
|
|
24470
|
+
}
|
|
24471
|
+
|
|
24472
|
+
/**
|
|
24473
|
+
* Environment variable read by the shell wrapper to tee live output into the temporary runtime log file.
|
|
24474
|
+
*/
|
|
24475
|
+
const PTBK_CODER_LOG_FILE_ENV_NAME = 'PTBK_CODER_LOG_FILE';
|
|
24476
|
+
/**
|
|
24477
|
+
* Log line which separates the raw script input from the raw script output of one execution section.
|
|
24478
|
+
*
|
|
24479
|
+
* Readers of a runtime log split on this marker to look only at what the harness really produced,
|
|
24480
|
+
* without the generated script and the prompt it embeds.
|
|
24481
|
+
*/
|
|
24482
|
+
const SCRIPT_EXECUTION_LOG_RAW_OUTPUT_MARKER = '--- raw output ---';
|
|
24483
|
+
/**
|
|
24484
|
+
* Command which terminates the Bash process tree rooted at the running harness.
|
|
24485
|
+
*
|
|
24486
|
+
* Bash's POSIX process IDs differ from Windows process IDs in Git Bash, so the Windows branch resolves the native PID
|
|
24487
|
+
* before delegating to `taskkill`. Unix harnesses run in a dedicated Bash job process group, which can be terminated
|
|
24488
|
+
* with its negative process ID.
|
|
24489
|
+
*/
|
|
24490
|
+
const TERMINATE_BASH_PROCESS_TREE_COMMAND = process.platform === 'win32'
|
|
24491
|
+
? _spaceTrim.spaceTrim(`
|
|
24492
|
+
HARNESS_WINDOWS_PROCESS_ID="$(ps -l -p "$HARNESS_PROCESS_ID" | awk 'NR == 2 { print $4 }')"
|
|
24493
|
+
if [ -n "$HARNESS_WINDOWS_PROCESS_ID" ]; then
|
|
24494
|
+
MSYS_NO_PATHCONV=1 taskkill.exe /PID "$HARNESS_WINDOWS_PROCESS_ID" /T /F > /dev/null 2>&1 || true
|
|
24495
|
+
fi
|
|
24496
|
+
`)
|
|
24497
|
+
: 'kill -TERM -- "-$HARNESS_PROCESS_ID" 2>/dev/null || true';
|
|
24498
|
+
/**
|
|
24499
|
+
* Shell condition that detects whether the Node process which owns the harness is still running.
|
|
24500
|
+
*
|
|
24501
|
+
* Git Bash translates process IDs and command switches, so querying the native Windows PID needs both `tasklist` and
|
|
24502
|
+
* disabled MSYS path conversion there. Unix can use the native `kill -0` process existence check.
|
|
24503
|
+
*/
|
|
24504
|
+
const IS_PARENT_PROCESS_RUNNING_CONDITION = process.platform === 'win32'
|
|
24505
|
+
? 'MSYS_NO_PATHCONV=1 tasklist.exe /FI "PID eq $PARENT_CODER_PROCESS_ID" /NH | awk -v processId="$PARENT_CODER_PROCESS_ID" \'$2 == processId { isFound = 1 } END { exit isFound ? 0 : 1 }\''
|
|
24506
|
+
: 'kill -0 "$PARENT_CODER_PROCESS_ID" 2>/dev/null';
|
|
24507
|
+
/**
|
|
24508
|
+
* Environment variable that identifies the Node process responsible for a temporary harness shell.
|
|
24509
|
+
*/
|
|
24510
|
+
const PTBK_CODER_PARENT_PROCESS_ID_ENV_NAME = 'PTBK_CODER_PARENT_PROCESS_ID';
|
|
24511
|
+
/**
|
|
24512
|
+
* Small bash wrapper that preserves stdout/stderr streams while teeing both into the runtime log file.
|
|
24513
|
+
*
|
|
24514
|
+
* A watcher polls the owning Node process by its PID. If that process exits abruptly, the watcher stops the whole
|
|
24515
|
+
* Bash and harness process tree instead of letting it continue as an orphan.
|
|
24516
|
+
*/
|
|
24517
|
+
const LOGGED_BASH_WRAPPER_COMMAND = _spaceTrim.spaceTrim(`
|
|
24518
|
+
PARENT_CODER_PROCESS_ID="\${${PTBK_CODER_PARENT_PROCESS_ID_ENV_NAME}}"
|
|
24519
|
+
unset ${PTBK_CODER_PARENT_PROCESS_ID_ENV_NAME}
|
|
24520
|
+
|
|
24521
|
+
terminate_harness_process_tree() {
|
|
24522
|
+
# Keep the EXIT cleanup intact so the wrapper can also stop its parent-process watcher.
|
|
24523
|
+
trap - HUP INT TERM
|
|
24524
|
+
${TERMINATE_BASH_PROCESS_TREE_COMMAND}
|
|
24525
|
+
}
|
|
24526
|
+
|
|
24527
|
+
is_parent_process_running() {
|
|
24528
|
+
${IS_PARENT_PROCESS_RUNNING_CONDITION}
|
|
24529
|
+
}
|
|
24530
|
+
|
|
24531
|
+
if [ -n "\${${PTBK_CODER_LOG_FILE_ENV_NAME}:-}" ]; then
|
|
24532
|
+
exec > >(tee -a "$${PTBK_CODER_LOG_FILE_ENV_NAME}") 2> >(tee -a "$${PTBK_CODER_LOG_FILE_ENV_NAME}" >&2)
|
|
24533
|
+
fi
|
|
24534
|
+
|
|
24535
|
+
watch_parent_process() {
|
|
24536
|
+
trap 'exit 0' HUP INT TERM
|
|
24537
|
+
|
|
24538
|
+
while is_parent_process_running; do
|
|
24539
|
+
sleep 1
|
|
24540
|
+
done
|
|
24541
|
+
|
|
24542
|
+
terminate_harness_process_tree
|
|
24543
|
+
}
|
|
24544
|
+
|
|
24545
|
+
# Background harness jobs need their own process group on Unix so termination cannot reach the parent coder.
|
|
24546
|
+
set -m
|
|
24547
|
+
if ! is_parent_process_running; then
|
|
24548
|
+
exit 1
|
|
24549
|
+
fi
|
|
24550
|
+
bash "$1" &
|
|
24551
|
+
HARNESS_PROCESS_ID=$!
|
|
24552
|
+
|
|
24553
|
+
cleanup_parent_process_watcher() {
|
|
24554
|
+
kill "$PARENT_PROCESS_WATCHER_PID" 2>/dev/null || true
|
|
24555
|
+
wait "$PARENT_PROCESS_WATCHER_PID" 2>/dev/null || true
|
|
24556
|
+
}
|
|
24557
|
+
|
|
24558
|
+
watch_parent_process &
|
|
24559
|
+
PARENT_PROCESS_WATCHER_PID=$!
|
|
24560
|
+
|
|
24561
|
+
trap cleanup_parent_process_watcher EXIT
|
|
24562
|
+
trap terminate_harness_process_tree HUP INT TERM
|
|
24563
|
+
|
|
24564
|
+
wait "$HARNESS_PROCESS_ID"
|
|
24565
|
+
SCRIPT_EXIT_CODE=$?
|
|
24566
|
+
exit "$SCRIPT_EXIT_CODE"
|
|
24567
|
+
`);
|
|
24568
|
+
/**
|
|
24569
|
+
* Shapes one bash invocation that optionally mirrors live script output into a temporary log file.
|
|
24570
|
+
*/
|
|
24571
|
+
function buildLoggedBashExecution(scriptPath, logPath) {
|
|
24572
|
+
return {
|
|
24573
|
+
args: ['-lc', LOGGED_BASH_WRAPPER_COMMAND, 'ptbk-coder-temp-script', toPosixPath(scriptPath)],
|
|
24574
|
+
env: logPath ? { [PTBK_CODER_LOG_FILE_ENV_NAME]: toPosixPath(logPath) } : undefined,
|
|
24575
|
+
};
|
|
24576
|
+
}
|
|
24577
|
+
/**
|
|
24578
|
+
* Appends one execution-start section with the raw script input before the shell begins producing output.
|
|
24579
|
+
*/
|
|
24580
|
+
async function appendScriptExecutionLogStart({ scriptPath, scriptContent, logPath, }) {
|
|
24581
|
+
if (!logPath) {
|
|
24582
|
+
return;
|
|
24583
|
+
}
|
|
24584
|
+
await promises.mkdir(path.dirname(logPath), { recursive: true });
|
|
24585
|
+
const scriptKind = describeTempScriptKind(scriptPath);
|
|
24586
|
+
const normalizedInput = scriptContent.replace(/\r\n/g, '\n').trimEnd();
|
|
24587
|
+
const logSection = _spaceTrim.spaceTrim((block) => `
|
|
24588
|
+
=== ${scriptKind} started at ${new Date().toISOString()} ===
|
|
24589
|
+
Script path: ${toPosixPath(scriptPath)}
|
|
24590
|
+
|
|
24591
|
+
--- raw input ---
|
|
24592
|
+
${block(normalizedInput)}
|
|
24593
|
+
|
|
24594
|
+
${SCRIPT_EXECUTION_LOG_RAW_OUTPUT_MARKER}
|
|
24595
|
+
`);
|
|
24596
|
+
await promises.appendFile(logPath, `${logSection}\n`, 'utf-8');
|
|
24597
|
+
}
|
|
24598
|
+
/**
|
|
24599
|
+
* Appends one execution-finish section after the shell settles.
|
|
24600
|
+
*/
|
|
24601
|
+
async function appendScriptExecutionLogFinish({ scriptPath, logPath, status, details, }) {
|
|
24602
|
+
if (!logPath) {
|
|
24603
|
+
return;
|
|
24604
|
+
}
|
|
24605
|
+
const scriptKind = describeTempScriptKind(scriptPath);
|
|
24606
|
+
const logLines = ['', `=== ${scriptKind} finished at ${new Date().toISOString()} ===`, `Status: ${status}`];
|
|
24607
|
+
if (details !== undefined) {
|
|
24608
|
+
logLines.push('');
|
|
24609
|
+
logLines.push('--- details ---');
|
|
24610
|
+
logLines.push(formatUnknownErrorDetails(details));
|
|
24611
|
+
}
|
|
24612
|
+
logLines.push('');
|
|
24613
|
+
await promises.appendFile(logPath, `${logLines.join('\n')}\n`, 'utf-8');
|
|
24614
|
+
}
|
|
24615
|
+
/**
|
|
24616
|
+
* Distinguishes prompt-runner and verification temp shells in the shared runtime log.
|
|
24617
|
+
*/
|
|
24618
|
+
function describeTempScriptKind(scriptPath) {
|
|
24619
|
+
return scriptPath.toLowerCase().endsWith('.test.sh') ? 'test shell' : 'runner shell';
|
|
24620
|
+
}
|
|
24621
|
+
|
|
24622
|
+
/**
|
|
24623
|
+
* Standard streams used by every temporary Bash runner.
|
|
24624
|
+
*/
|
|
24625
|
+
const BASH_PROCESS_STDIO = ['pipe', 'pipe', 'pipe'];
|
|
24626
|
+
/**
|
|
24627
|
+
* Whether the current Node process is running on Windows.
|
|
24628
|
+
*/
|
|
24629
|
+
const IS_WINDOWS$1 = process.platform === 'win32';
|
|
24630
|
+
/**
|
|
24631
|
+
* Starts one temporary Bash script in a process tree owned by the current Node process.
|
|
24632
|
+
*
|
|
24633
|
+
* The wrapper watches the supplied owning process ID. When that process exits abruptly, the wrapper terminates every
|
|
24634
|
+
* nested shell and harness process instead of leaving it orphaned.
|
|
24635
|
+
*
|
|
24636
|
+
* @private internal utility of the coding prompt runner
|
|
24637
|
+
*/
|
|
24638
|
+
function $spawnLoggedBashScript(options) {
|
|
24639
|
+
var _a;
|
|
24640
|
+
const bashExecution = buildLoggedBashExecution(options.scriptPath, options.logPath);
|
|
24641
|
+
const parentProcessId = (_a = options.parentProcessId) !== null && _a !== void 0 ? _a : process.pid;
|
|
24642
|
+
return child_process.spawn('bash', bashExecution.args, {
|
|
24643
|
+
detached: !IS_WINDOWS$1,
|
|
24644
|
+
env: {
|
|
24645
|
+
...process.env,
|
|
24646
|
+
...bashExecution.env,
|
|
24647
|
+
[PTBK_CODER_PARENT_PROCESS_ID_ENV_NAME]: parentProcessId.toString(),
|
|
25297
24648
|
},
|
|
25298
24649
|
stdio: BASH_PROCESS_STDIO,
|
|
25299
24650
|
windowsHide: true,
|
|
@@ -26791,7 +26142,7 @@
|
|
|
26791
26142
|
/**
|
|
26792
26143
|
* Default Gemini model used by the coding runner.
|
|
26793
26144
|
*/
|
|
26794
|
-
|
|
26145
|
+
HARNESS_DEFAULT_MODELS.gemini;
|
|
26795
26146
|
/**
|
|
26796
26147
|
* Runs prompts via the Gemini CLI.
|
|
26797
26148
|
*/
|
|
@@ -27301,11 +26652,697 @@
|
|
|
27301
26652
|
return delimiter;
|
|
27302
26653
|
}
|
|
27303
26654
|
/**
|
|
27304
|
-
* Checks whether a prompt already contains one exact here-document closing delimiter line.
|
|
26655
|
+
* Checks whether a prompt already contains one exact here-document closing delimiter line.
|
|
26656
|
+
*/
|
|
26657
|
+
function isShellHereDocumentDelimiterPresent(content, delimiter) {
|
|
26658
|
+
return content.replace(/\r\n/gu, '\n').split('\n').some((line) => line === delimiter);
|
|
26659
|
+
}
|
|
26660
|
+
|
|
26661
|
+
/**
|
|
26662
|
+
* Create price per one token based on the string value found on openai page
|
|
26663
|
+
*
|
|
26664
|
+
* @private within the repository, used only as internal helper for `OPENAI_MODELS`
|
|
26665
|
+
*/
|
|
26666
|
+
function pricing(value) {
|
|
26667
|
+
const [price, tokens] = value.split(' / ');
|
|
26668
|
+
return parseFloat(price.replace('$', '')) / parseFloat(tokens.replace('M tokens', '')) / 1000000;
|
|
26669
|
+
}
|
|
26670
|
+
|
|
26671
|
+
/**
|
|
26672
|
+
* List of available OpenAI models with pricing
|
|
26673
|
+
*
|
|
26674
|
+
* Note: Synced with official API docs at 2026-03-22
|
|
26675
|
+
*
|
|
26676
|
+
* @see https://platform.openai.com/docs/models/
|
|
26677
|
+
* @see https://openai.com/api/pricing/
|
|
26678
|
+
*
|
|
26679
|
+
* @public exported from `@promptbook/openai`
|
|
26680
|
+
*/
|
|
26681
|
+
const OPENAI_MODELS = exportJson({
|
|
26682
|
+
name: 'OPENAI_MODELS',
|
|
26683
|
+
value: [
|
|
26684
|
+
/**/
|
|
26685
|
+
{
|
|
26686
|
+
modelVariant: 'CHAT',
|
|
26687
|
+
modelTitle: 'gpt-5.1',
|
|
26688
|
+
modelName: 'gpt-5.1',
|
|
26689
|
+
modelDescription: 'The best model for coding and agentic tasks with configurable reasoning effort.',
|
|
26690
|
+
pricing: {
|
|
26691
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
26692
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
26693
|
+
},
|
|
26694
|
+
},
|
|
26695
|
+
{
|
|
26696
|
+
modelVariant: 'CHAT',
|
|
26697
|
+
modelTitle: 'gpt-5',
|
|
26698
|
+
modelName: 'gpt-5',
|
|
26699
|
+
modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities. DEPRECATED: Use gpt-5.1 instead.",
|
|
26700
|
+
pricing: {
|
|
26701
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
26702
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
26703
|
+
},
|
|
26704
|
+
},
|
|
26705
|
+
/**/
|
|
26706
|
+
/**/
|
|
26707
|
+
{
|
|
26708
|
+
modelVariant: 'CHAT',
|
|
26709
|
+
modelTitle: 'gpt-5.2-codex',
|
|
26710
|
+
modelName: 'gpt-5.2-codex',
|
|
26711
|
+
modelDescription: 'High-capability Codex variant tuned for agentic code generation with large contexts and reasoning effort controls. Ideal for long-horizon coding workflows and multi-step reasoning.',
|
|
26712
|
+
pricing: {
|
|
26713
|
+
prompt: pricing(`$1.75 / 1M tokens`),
|
|
26714
|
+
output: pricing(`$14.00 / 1M tokens`),
|
|
26715
|
+
},
|
|
26716
|
+
},
|
|
26717
|
+
/**/
|
|
26718
|
+
/**/
|
|
26719
|
+
{
|
|
26720
|
+
modelVariant: 'CHAT',
|
|
26721
|
+
modelTitle: 'gpt-5.1-codex-max',
|
|
26722
|
+
modelName: 'gpt-5.1-codex-max',
|
|
26723
|
+
modelDescription: 'Premium GPT-5.1 Codex flavor that mirrors gpt-5.1 in capability and pricing while adding Codex tooling optimizations.',
|
|
26724
|
+
pricing: {
|
|
26725
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
26726
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
26727
|
+
},
|
|
26728
|
+
},
|
|
26729
|
+
/**/
|
|
26730
|
+
/**/
|
|
26731
|
+
{
|
|
26732
|
+
modelVariant: 'CHAT',
|
|
26733
|
+
modelTitle: 'gpt-5.1-codex',
|
|
26734
|
+
modelName: 'gpt-5.1-codex',
|
|
26735
|
+
modelDescription: 'Core GPT-5.1 Codex model focused on agentic coding tasks with a balanced trade-off between reasoning and cost.',
|
|
26736
|
+
pricing: {
|
|
26737
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
26738
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
26739
|
+
},
|
|
26740
|
+
},
|
|
26741
|
+
/**/
|
|
26742
|
+
/**/
|
|
26743
|
+
{
|
|
26744
|
+
modelVariant: 'CHAT',
|
|
26745
|
+
modelTitle: 'gpt-5.1-codex-mini',
|
|
26746
|
+
modelName: 'gpt-5.1-codex-mini',
|
|
26747
|
+
modelDescription: 'Compact, cost-effective GPT-5.1 Codex variant with a smaller context window ideal for cheap assistant iterations that still require coding awareness.',
|
|
26748
|
+
pricing: {
|
|
26749
|
+
prompt: pricing(`$0.25 / 1M tokens`),
|
|
26750
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
26751
|
+
},
|
|
26752
|
+
},
|
|
26753
|
+
/**/
|
|
26754
|
+
/**/
|
|
26755
|
+
{
|
|
26756
|
+
modelVariant: 'CHAT',
|
|
26757
|
+
modelTitle: 'gpt-5-codex',
|
|
26758
|
+
modelName: 'gpt-5-codex',
|
|
26759
|
+
modelDescription: 'Legacy GPT-5 Codex model built for agentic coding workloads with the same pricing as GPT-5 and a focus on stability.',
|
|
26760
|
+
pricing: {
|
|
26761
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
26762
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
26763
|
+
},
|
|
26764
|
+
},
|
|
26765
|
+
/**/
|
|
26766
|
+
/**/
|
|
26767
|
+
{
|
|
26768
|
+
modelVariant: 'CHAT',
|
|
26769
|
+
modelTitle: 'gpt-5-mini',
|
|
26770
|
+
modelName: 'gpt-5-mini',
|
|
26771
|
+
modelDescription: 'A faster, cost-efficient version of GPT-5 for well-defined tasks with 200K context window. Maintains core GPT-5 capabilities while offering 5x faster inference and significantly lower costs. Features enhanced instruction following and reduced latency for production applications requiring quick responses with high quality.',
|
|
26772
|
+
pricing: {
|
|
26773
|
+
prompt: pricing(`$0.25 / 1M tokens`),
|
|
26774
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
26775
|
+
},
|
|
26776
|
+
},
|
|
26777
|
+
/**/
|
|
26778
|
+
/**/
|
|
26779
|
+
{
|
|
26780
|
+
modelVariant: 'CHAT',
|
|
26781
|
+
modelTitle: 'gpt-5-nano',
|
|
26782
|
+
modelName: 'gpt-5-nano',
|
|
26783
|
+
modelDescription: 'The fastest, most cost-efficient version of GPT-5 with 200K context window. Optimized for summarization, classification, and simple reasoning tasks. Features 10x faster inference than base GPT-5 while maintaining good quality for straightforward applications. Ideal for high-volume, cost-sensitive deployments.',
|
|
26784
|
+
pricing: {
|
|
26785
|
+
prompt: pricing(`$0.05 / 1M tokens`),
|
|
26786
|
+
output: pricing(`$0.40 / 1M tokens`),
|
|
26787
|
+
},
|
|
26788
|
+
},
|
|
26789
|
+
/**/
|
|
26790
|
+
/**/
|
|
26791
|
+
{
|
|
26792
|
+
modelVariant: 'CHAT',
|
|
26793
|
+
modelTitle: 'gpt-4.1',
|
|
26794
|
+
modelName: 'gpt-4.1',
|
|
26795
|
+
modelDescription: 'Smartest non-reasoning model with 128K context window. Enhanced version of GPT-4 with improved instruction following, better factual accuracy, and reduced hallucinations. Features advanced function calling capabilities and superior performance on coding tasks. Ideal for applications requiring high intelligence without reasoning overhead.',
|
|
26796
|
+
pricing: {
|
|
26797
|
+
prompt: pricing(`$2.00 / 1M tokens`),
|
|
26798
|
+
output: pricing(`$8.00 / 1M tokens`),
|
|
26799
|
+
},
|
|
26800
|
+
},
|
|
26801
|
+
/**/
|
|
26802
|
+
/**/
|
|
26803
|
+
{
|
|
26804
|
+
modelVariant: 'CHAT',
|
|
26805
|
+
modelTitle: 'gpt-4.1-mini',
|
|
26806
|
+
modelName: 'gpt-4.1-mini',
|
|
26807
|
+
modelDescription: 'Smaller, faster version of GPT-4.1 with 128K context window. Balances intelligence and efficiency with 3x faster inference than base GPT-4.1. Maintains strong capabilities across text generation, reasoning, and coding while offering better cost-performance ratio for most applications.',
|
|
26808
|
+
pricing: {
|
|
26809
|
+
prompt: pricing(`$0.40 / 1M tokens`),
|
|
26810
|
+
output: pricing(`$1.60 / 1M tokens`),
|
|
26811
|
+
},
|
|
26812
|
+
},
|
|
26813
|
+
/**/
|
|
26814
|
+
/**/
|
|
26815
|
+
{
|
|
26816
|
+
modelVariant: 'CHAT',
|
|
26817
|
+
modelTitle: 'gpt-4.1-nano',
|
|
26818
|
+
modelName: 'gpt-4.1-nano',
|
|
26819
|
+
modelDescription: 'Fastest, most cost-efficient version of GPT-4.1 with 128K context window. Optimized for high-throughput applications requiring good quality at minimal cost. Features 5x faster inference than GPT-4.1 while maintaining adequate performance for most general-purpose tasks.',
|
|
26820
|
+
pricing: {
|
|
26821
|
+
prompt: pricing(`$0.10 / 1M tokens`),
|
|
26822
|
+
output: pricing(`$0.40 / 1M tokens`),
|
|
26823
|
+
},
|
|
26824
|
+
},
|
|
26825
|
+
/**/
|
|
26826
|
+
/**/
|
|
26827
|
+
{
|
|
26828
|
+
modelVariant: 'CHAT',
|
|
26829
|
+
modelTitle: 'o3',
|
|
26830
|
+
modelName: 'o3',
|
|
26831
|
+
modelDescription: 'Advanced reasoning model with 128K context window specializing in complex logical, mathematical, and analytical tasks. Successor to o1 with enhanced step-by-step problem-solving capabilities and superior performance on STEM-focused problems. Ideal for professional applications requiring deep analytical thinking and precise reasoning.',
|
|
26832
|
+
pricing: {
|
|
26833
|
+
prompt: pricing(`$2.00 / 1M tokens`),
|
|
26834
|
+
output: pricing(`$8.00 / 1M tokens`),
|
|
26835
|
+
},
|
|
26836
|
+
},
|
|
26837
|
+
/**/
|
|
26838
|
+
/**/
|
|
26839
|
+
{
|
|
26840
|
+
modelVariant: 'CHAT',
|
|
26841
|
+
modelTitle: 'o3-pro',
|
|
26842
|
+
modelName: 'o3-pro',
|
|
26843
|
+
modelDescription: 'Enhanced version of o3 with more compute allocated for better responses on the most challenging problems. Features extended reasoning time and improved accuracy on complex analytical tasks. Designed for applications where maximum reasoning quality is more important than response speed.',
|
|
26844
|
+
pricing: {
|
|
26845
|
+
prompt: pricing(`$20.00 / 1M tokens`),
|
|
26846
|
+
output: pricing(`$80.00 / 1M tokens`),
|
|
26847
|
+
},
|
|
26848
|
+
},
|
|
26849
|
+
/**/
|
|
26850
|
+
/**/
|
|
26851
|
+
{
|
|
26852
|
+
modelVariant: 'CHAT',
|
|
26853
|
+
modelTitle: 'o4-mini',
|
|
26854
|
+
modelName: 'o4-mini',
|
|
26855
|
+
modelDescription: 'Fast, cost-efficient reasoning model with 128K context window. Successor to o1-mini with improved analytical capabilities while maintaining speed advantages. Features enhanced mathematical reasoning and logical problem-solving at significantly lower cost than full reasoning models.',
|
|
26856
|
+
pricing: {
|
|
26857
|
+
prompt: pricing(`$1.10 / 1M tokens`),
|
|
26858
|
+
output: pricing(`$4.40 / 1M tokens`),
|
|
26859
|
+
},
|
|
26860
|
+
},
|
|
26861
|
+
/**/
|
|
26862
|
+
/**/
|
|
26863
|
+
{
|
|
26864
|
+
modelVariant: 'CHAT',
|
|
26865
|
+
modelTitle: 'o3-deep-research',
|
|
26866
|
+
modelName: 'o3-deep-research',
|
|
26867
|
+
modelDescription: 'Most powerful deep research model with 128K context window. Specialized for comprehensive research tasks, literature analysis, and complex information synthesis. Features advanced citation capabilities and enhanced factual accuracy for academic and professional research applications.',
|
|
26868
|
+
pricing: {
|
|
26869
|
+
prompt: pricing(`$25.00 / 1M tokens`),
|
|
26870
|
+
output: pricing(`$100.00 / 1M tokens`),
|
|
26871
|
+
},
|
|
26872
|
+
},
|
|
26873
|
+
/**/
|
|
26874
|
+
/**/
|
|
26875
|
+
{
|
|
26876
|
+
modelVariant: 'CHAT',
|
|
26877
|
+
modelTitle: 'o4-mini-deep-research',
|
|
26878
|
+
modelName: 'o4-mini-deep-research',
|
|
26879
|
+
modelDescription: 'Faster, more affordable deep research model with 128K context window. Balances research capabilities with cost efficiency, offering good performance on literature review, fact-checking, and information synthesis tasks at a more accessible price point.',
|
|
26880
|
+
pricing: {
|
|
26881
|
+
prompt: pricing(`$12.00 / 1M tokens`),
|
|
26882
|
+
output: pricing(`$48.00 / 1M tokens`),
|
|
26883
|
+
},
|
|
26884
|
+
},
|
|
26885
|
+
/**/
|
|
26886
|
+
/**/
|
|
26887
|
+
{
|
|
26888
|
+
modelVariant: 'IMAGE_GENERATION',
|
|
26889
|
+
modelTitle: 'dall-e-3',
|
|
26890
|
+
modelName: 'dall-e-3',
|
|
26891
|
+
modelDescription: 'DALL·E 3 is the latest version of the DALL·E art generation model. It understands significantly more nuance and detail than our previous systems, allowing you to easily translate your ideas into exceptionally accurate images.',
|
|
26892
|
+
pricing: {
|
|
26893
|
+
prompt: 0,
|
|
26894
|
+
output: 0.04,
|
|
26895
|
+
},
|
|
26896
|
+
},
|
|
26897
|
+
/**/
|
|
26898
|
+
/*/
|
|
26899
|
+
{
|
|
26900
|
+
modelTitle: 'whisper-1',
|
|
26901
|
+
modelName: 'whisper-1',
|
|
26902
|
+
},
|
|
26903
|
+
/**/
|
|
26904
|
+
/**/
|
|
26905
|
+
{
|
|
26906
|
+
modelVariant: 'COMPLETION',
|
|
26907
|
+
modelTitle: 'davinci-002',
|
|
26908
|
+
modelName: 'davinci-002',
|
|
26909
|
+
modelDescription: 'Legacy completion model with 4K token context window. Excels at complex text generation, creative writing, and detailed content creation with strong contextual understanding. Optimized for instructions requiring nuanced outputs and extended reasoning. Suitable for applications needing high-quality text generation without conversation management.',
|
|
26910
|
+
pricing: {
|
|
26911
|
+
prompt: pricing(`$2.00 / 1M tokens`),
|
|
26912
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
26913
|
+
},
|
|
26914
|
+
},
|
|
26915
|
+
/**/
|
|
26916
|
+
/**/
|
|
26917
|
+
{
|
|
26918
|
+
modelVariant: 'IMAGE_GENERATION',
|
|
26919
|
+
modelTitle: 'dall-e-2',
|
|
26920
|
+
modelName: 'dall-e-2',
|
|
26921
|
+
modelDescription: 'DALL·E 2 is an AI system that can create realistic images and art from a description in natural language.',
|
|
26922
|
+
pricing: {
|
|
26923
|
+
prompt: 0,
|
|
26924
|
+
output: 0.02,
|
|
26925
|
+
},
|
|
26926
|
+
},
|
|
26927
|
+
/**/
|
|
26928
|
+
/**/
|
|
26929
|
+
{
|
|
26930
|
+
modelVariant: 'CHAT',
|
|
26931
|
+
modelTitle: 'gpt-3.5-turbo-16k',
|
|
26932
|
+
modelName: 'gpt-3.5-turbo-16k',
|
|
26933
|
+
modelDescription: 'Extended context GPT-3.5 Turbo with 16K token window. Maintains core capabilities of standard 3.5 Turbo while supporting longer conversations and documents. Features good balance of performance and cost for applications requiring more context than standard 4K models. Effective for document analysis, extended conversations, and multi-step reasoning tasks.',
|
|
26934
|
+
pricing: {
|
|
26935
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
26936
|
+
output: pricing(`$4.00 / 1M tokens`),
|
|
26937
|
+
},
|
|
26938
|
+
},
|
|
26939
|
+
/**/
|
|
26940
|
+
/*/
|
|
26941
|
+
{
|
|
26942
|
+
modelTitle: 'tts-1-hd-1106',
|
|
26943
|
+
modelName: 'tts-1-hd-1106',
|
|
26944
|
+
},
|
|
26945
|
+
/**/
|
|
26946
|
+
/*/
|
|
26947
|
+
{
|
|
26948
|
+
modelTitle: 'tts-1-hd',
|
|
26949
|
+
modelName: 'tts-1-hd',
|
|
26950
|
+
},
|
|
26951
|
+
/**/
|
|
26952
|
+
/**/
|
|
26953
|
+
{
|
|
26954
|
+
modelVariant: 'CHAT',
|
|
26955
|
+
modelTitle: 'gpt-4',
|
|
26956
|
+
modelName: 'gpt-4',
|
|
26957
|
+
modelDescription: 'Powerful language model with 8K context window featuring sophisticated reasoning, instruction-following, and knowledge capabilities. Demonstrates strong performance on complex tasks requiring deep understanding and multi-step reasoning. Excels at code generation, logical analysis, and nuanced content creation. Suitable for advanced applications requiring high-quality outputs.',
|
|
26958
|
+
pricing: {
|
|
26959
|
+
prompt: pricing(`$30.00 / 1M tokens`),
|
|
26960
|
+
output: pricing(`$60.00 / 1M tokens`),
|
|
26961
|
+
},
|
|
26962
|
+
},
|
|
26963
|
+
/**/
|
|
26964
|
+
/**/
|
|
26965
|
+
{
|
|
26966
|
+
modelVariant: 'CHAT',
|
|
26967
|
+
modelTitle: 'gpt-4-32k',
|
|
26968
|
+
modelName: 'gpt-4-32k',
|
|
26969
|
+
modelDescription: 'Extended context version of GPT-4 with 32K token window. Maintains all capabilities of standard GPT-4 while supporting analysis of very lengthy documents, code bases, and conversations. Features enhanced ability to maintain context over long interactions and process detailed information from large inputs. Ideal for document analysis, legal review, and complex problem-solving.',
|
|
26970
|
+
pricing: {
|
|
26971
|
+
prompt: pricing(`$60.00 / 1M tokens`),
|
|
26972
|
+
output: pricing(`$120.00 / 1M tokens`),
|
|
26973
|
+
},
|
|
26974
|
+
},
|
|
26975
|
+
/**/
|
|
26976
|
+
/*/
|
|
26977
|
+
{
|
|
26978
|
+
modelVariant: 'CHAT',
|
|
26979
|
+
modelTitle: 'gpt-4-0613',
|
|
26980
|
+
modelName: 'gpt-4-0613',
|
|
26981
|
+
pricing: {
|
|
26982
|
+
prompt: computeUsage(` / 1M tokens`),
|
|
26983
|
+
output: computeUsage(` / 1M tokens`),
|
|
26984
|
+
},
|
|
26985
|
+
},
|
|
26986
|
+
/**/
|
|
26987
|
+
/**/
|
|
26988
|
+
{
|
|
26989
|
+
modelVariant: 'CHAT',
|
|
26990
|
+
modelTitle: 'gpt-4-turbo-2024-04-09',
|
|
26991
|
+
modelName: 'gpt-4-turbo-2024-04-09',
|
|
26992
|
+
modelDescription: 'Latest stable GPT-4 Turbo from April 2024 with 128K context window. Features enhanced reasoning chains, improved factual accuracy with 40% reduction in hallucinations, and better instruction following compared to earlier versions. Includes advanced function calling capabilities and knowledge up to April 2024. Provides optimal performance for enterprise applications requiring reliability.',
|
|
26993
|
+
pricing: {
|
|
26994
|
+
prompt: pricing(`$10.00 / 1M tokens`),
|
|
26995
|
+
output: pricing(`$30.00 / 1M tokens`),
|
|
26996
|
+
},
|
|
26997
|
+
},
|
|
26998
|
+
/**/
|
|
26999
|
+
/**/
|
|
27000
|
+
{
|
|
27001
|
+
modelVariant: 'CHAT',
|
|
27002
|
+
modelTitle: 'gpt-3.5-turbo-1106',
|
|
27003
|
+
modelName: 'gpt-3.5-turbo-1106',
|
|
27004
|
+
modelDescription: 'November 2023 version of GPT-3.5 Turbo with 16K token context window. Features improved instruction following, more consistent output formatting, and enhanced function calling capabilities. Includes knowledge cutoff from April 2023. Suitable for applications requiring good performance at lower cost than GPT-4 models.',
|
|
27005
|
+
pricing: {
|
|
27006
|
+
prompt: pricing(`$1.00 / 1M tokens`),
|
|
27007
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
27008
|
+
},
|
|
27009
|
+
},
|
|
27010
|
+
/**/
|
|
27011
|
+
/**/
|
|
27012
|
+
{
|
|
27013
|
+
modelVariant: 'CHAT',
|
|
27014
|
+
modelTitle: 'gpt-4-turbo',
|
|
27015
|
+
modelName: 'gpt-4-turbo',
|
|
27016
|
+
modelDescription: 'More capable and cost-efficient version of GPT-4 with 128K token context window. Features improved instruction following, advanced function calling capabilities, and better performance on coding tasks. Maintains superior reasoning and knowledge while offering substantial cost reduction compared to base GPT-4. Ideal for complex applications requiring extensive context processing.',
|
|
27017
|
+
pricing: {
|
|
27018
|
+
prompt: pricing(`$10.00 / 1M tokens`),
|
|
27019
|
+
output: pricing(`$30.00 / 1M tokens`),
|
|
27020
|
+
},
|
|
27021
|
+
},
|
|
27022
|
+
/**/
|
|
27023
|
+
/**/
|
|
27024
|
+
{
|
|
27025
|
+
modelVariant: 'COMPLETION',
|
|
27026
|
+
modelTitle: 'gpt-3.5-turbo-instruct-0914',
|
|
27027
|
+
modelName: 'gpt-3.5-turbo-instruct-0914',
|
|
27028
|
+
modelDescription: 'September 2023 version of GPT-3.5 Turbo Instruct with 4K context window. Optimized for completion-style instruction following with deterministic responses. Better suited than chat models for applications requiring specific formatted outputs without conversation management. Knowledge cutoff from September 2021.',
|
|
27029
|
+
pricing: {
|
|
27030
|
+
prompt: pricing(`$1.50 / 1M tokens`),
|
|
27031
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
27032
|
+
},
|
|
27033
|
+
},
|
|
27034
|
+
/**/
|
|
27035
|
+
/**/
|
|
27036
|
+
{
|
|
27037
|
+
modelVariant: 'COMPLETION',
|
|
27038
|
+
modelTitle: 'gpt-3.5-turbo-instruct',
|
|
27039
|
+
modelName: 'gpt-3.5-turbo-instruct',
|
|
27040
|
+
modelDescription: 'Optimized version of GPT-3.5 for completion-style API with 4K token context window. Features strong instruction following with single-turn design rather than multi-turn conversation. Provides more consistent, deterministic outputs compared to chat models. Well-suited for templated content generation and structured text transformation tasks.',
|
|
27041
|
+
pricing: {
|
|
27042
|
+
prompt: pricing(`$1.50 / 1M tokens`),
|
|
27043
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
27044
|
+
},
|
|
27045
|
+
},
|
|
27046
|
+
/**/
|
|
27047
|
+
/*/
|
|
27048
|
+
{
|
|
27049
|
+
modelTitle: 'tts-1',
|
|
27050
|
+
modelName: 'tts-1',
|
|
27051
|
+
},
|
|
27052
|
+
/**/
|
|
27053
|
+
/**/
|
|
27054
|
+
{
|
|
27055
|
+
modelVariant: 'CHAT',
|
|
27056
|
+
modelTitle: 'gpt-3.5-turbo',
|
|
27057
|
+
modelName: 'gpt-3.5-turbo',
|
|
27058
|
+
modelDescription: 'Latest version of GPT-3.5 Turbo with 4K token default context window (16K available). Features continually improved performance with enhanced instruction following and reduced hallucinations. Offers excellent balance between capability and cost efficiency. Suitable for most general-purpose applications requiring good AI capabilities at reasonable cost.',
|
|
27059
|
+
pricing: {
|
|
27060
|
+
prompt: pricing(`$0.50 / 1M tokens`),
|
|
27061
|
+
output: pricing(`$1.50 / 1M tokens`),
|
|
27062
|
+
},
|
|
27063
|
+
},
|
|
27064
|
+
/**/
|
|
27065
|
+
/**/
|
|
27066
|
+
{
|
|
27067
|
+
modelVariant: 'CHAT',
|
|
27068
|
+
modelTitle: 'gpt-3.5-turbo-0301',
|
|
27069
|
+
modelName: 'gpt-3.5-turbo-0301',
|
|
27070
|
+
modelDescription: 'March 2023 version of GPT-3.5 Turbo with 4K token context window. Legacy model maintained for backward compatibility with specific application behaviors. Features solid conversational abilities and basic instruction following. Knowledge cutoff from September 2021. Suitable for applications explicitly designed for this version.',
|
|
27071
|
+
pricing: {
|
|
27072
|
+
prompt: pricing(`$1.50 / 1M tokens`),
|
|
27073
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
27074
|
+
},
|
|
27075
|
+
},
|
|
27076
|
+
/**/
|
|
27077
|
+
/**/
|
|
27078
|
+
{
|
|
27079
|
+
modelVariant: 'COMPLETION',
|
|
27080
|
+
modelTitle: 'babbage-002',
|
|
27081
|
+
modelName: 'babbage-002',
|
|
27082
|
+
modelDescription: 'Efficient legacy completion model with 4K context window balancing performance and speed. Features moderate reasoning capabilities with focus on straightforward text generation tasks. Significantly more efficient than davinci models while maintaining adequate quality for many applications. Suitable for high-volume, cost-sensitive text generation needs.',
|
|
27083
|
+
pricing: {
|
|
27084
|
+
prompt: pricing(`$0.40 / 1M tokens`),
|
|
27085
|
+
output: pricing(`$0.40 / 1M tokens`),
|
|
27086
|
+
},
|
|
27087
|
+
},
|
|
27088
|
+
/**/
|
|
27089
|
+
/**/
|
|
27090
|
+
{
|
|
27091
|
+
modelVariant: 'CHAT',
|
|
27092
|
+
modelTitle: 'gpt-4-1106-preview',
|
|
27093
|
+
modelName: 'gpt-4-1106-preview',
|
|
27094
|
+
modelDescription: 'November 2023 preview version of GPT-4 Turbo with 128K token context window. Features improved instruction following, better function calling capabilities, and enhanced reasoning. Includes knowledge cutoff from April 2023. Suitable for complex applications requiring extensive document understanding and sophisticated interactions.',
|
|
27095
|
+
pricing: {
|
|
27096
|
+
prompt: pricing(`$10.00 / 1M tokens`),
|
|
27097
|
+
output: pricing(`$30.00 / 1M tokens`),
|
|
27098
|
+
},
|
|
27099
|
+
},
|
|
27100
|
+
/**/
|
|
27101
|
+
/**/
|
|
27102
|
+
{
|
|
27103
|
+
modelVariant: 'CHAT',
|
|
27104
|
+
modelTitle: 'gpt-4-0125-preview',
|
|
27105
|
+
modelName: 'gpt-4-0125-preview',
|
|
27106
|
+
modelDescription: 'January 2024 preview version of GPT-4 Turbo with 128K token context window. Features improved reasoning capabilities, enhanced tool use, and more reliable function calling. Includes knowledge cutoff from October 2023. Offers better performance on complex logical tasks and more consistent outputs than previous preview versions.',
|
|
27107
|
+
pricing: {
|
|
27108
|
+
prompt: pricing(`$10.00 / 1M tokens`),
|
|
27109
|
+
output: pricing(`$30.00 / 1M tokens`),
|
|
27110
|
+
},
|
|
27111
|
+
},
|
|
27112
|
+
/**/
|
|
27113
|
+
/*/
|
|
27114
|
+
{
|
|
27115
|
+
modelTitle: 'tts-1-1106',
|
|
27116
|
+
modelName: 'tts-1-1106',
|
|
27117
|
+
},
|
|
27118
|
+
/**/
|
|
27119
|
+
/**/
|
|
27120
|
+
{
|
|
27121
|
+
modelVariant: 'CHAT',
|
|
27122
|
+
modelTitle: 'gpt-3.5-turbo-0125',
|
|
27123
|
+
modelName: 'gpt-3.5-turbo-0125',
|
|
27124
|
+
modelDescription: 'January 2024 version of GPT-3.5 Turbo with 16K token context window. Features improved reasoning capabilities, better instruction adherence, and reduced hallucinations compared to previous versions. Includes knowledge cutoff from September 2021. Provides good performance for most general applications at reasonable cost.',
|
|
27125
|
+
pricing: {
|
|
27126
|
+
prompt: pricing(`$0.50 / 1M tokens`),
|
|
27127
|
+
output: pricing(`$1.50 / 1M tokens`),
|
|
27128
|
+
},
|
|
27129
|
+
},
|
|
27130
|
+
/**/
|
|
27131
|
+
/**/
|
|
27132
|
+
{
|
|
27133
|
+
modelVariant: 'CHAT',
|
|
27134
|
+
modelTitle: 'gpt-4-turbo-preview',
|
|
27135
|
+
modelName: 'gpt-4-turbo-preview',
|
|
27136
|
+
modelDescription: 'Preview version of GPT-4 Turbo with 128K token context window that points to the latest development model. Features cutting-edge improvements to instruction following, knowledge representation, and tool use capabilities. Provides access to newest features but may have occasional behavior changes. Best for non-critical applications wanting latest capabilities.',
|
|
27137
|
+
pricing: {
|
|
27138
|
+
prompt: pricing(`$10.00 / 1M tokens`),
|
|
27139
|
+
output: pricing(`$30.00 / 1M tokens`),
|
|
27140
|
+
},
|
|
27141
|
+
},
|
|
27142
|
+
/**/
|
|
27143
|
+
/**/
|
|
27144
|
+
{
|
|
27145
|
+
modelVariant: 'EMBEDDING',
|
|
27146
|
+
modelTitle: 'text-embedding-3-large',
|
|
27147
|
+
modelName: 'text-embedding-3-large',
|
|
27148
|
+
modelDescription: "OpenAI's most capable text embedding model generating 3072-dimensional vectors. Designed for high-quality embeddings for complex similarity tasks, clustering, and information retrieval. Features enhanced cross-lingual capabilities and significantly improved performance on retrieval and classification benchmarks. Ideal for sophisticated RAG systems and semantic search applications.",
|
|
27149
|
+
pricing: {
|
|
27150
|
+
prompt: pricing(`$0.13 / 1M tokens`),
|
|
27151
|
+
output: 0,
|
|
27152
|
+
},
|
|
27153
|
+
},
|
|
27154
|
+
/**/
|
|
27155
|
+
/**/
|
|
27156
|
+
{
|
|
27157
|
+
modelVariant: 'EMBEDDING',
|
|
27158
|
+
modelTitle: 'text-embedding-3-small',
|
|
27159
|
+
modelName: 'text-embedding-3-small',
|
|
27160
|
+
modelDescription: 'Cost-effective embedding model generating 1536-dimensional vectors. Balances quality and efficiency for simpler tasks while maintaining good performance on text similarity and retrieval applications. Offers 20% better quality than ada-002 at significantly lower cost. Ideal for production embedding applications with cost constraints.',
|
|
27161
|
+
pricing: {
|
|
27162
|
+
prompt: pricing(`$0.02 / 1M tokens`),
|
|
27163
|
+
output: 0,
|
|
27164
|
+
},
|
|
27165
|
+
},
|
|
27166
|
+
/**/
|
|
27167
|
+
/**/
|
|
27168
|
+
{
|
|
27169
|
+
modelVariant: 'CHAT',
|
|
27170
|
+
modelTitle: 'gpt-3.5-turbo-0613',
|
|
27171
|
+
modelName: 'gpt-3.5-turbo-0613',
|
|
27172
|
+
modelDescription: "June 2023 version of GPT-3.5 Turbo with 4K token context window. Features function calling capabilities for structured data extraction and API interaction. Includes knowledge cutoff from September 2021. Maintained for applications specifically designed for this version's behaviors and capabilities.",
|
|
27173
|
+
pricing: {
|
|
27174
|
+
prompt: pricing(`$1.50 / 1M tokens`),
|
|
27175
|
+
output: pricing(`$2.00 / 1M tokens`),
|
|
27176
|
+
},
|
|
27177
|
+
},
|
|
27178
|
+
/**/
|
|
27179
|
+
/**/
|
|
27180
|
+
{
|
|
27181
|
+
modelVariant: 'EMBEDDING',
|
|
27182
|
+
modelTitle: 'text-embedding-ada-002',
|
|
27183
|
+
modelName: 'text-embedding-ada-002',
|
|
27184
|
+
modelDescription: 'Legacy text embedding model generating 1536-dimensional vectors suitable for text similarity and retrieval applications. Processes up to 8K tokens per request with consistent embedding quality. While superseded by newer embedding-3 models, still maintains adequate performance for many semantic search and classification tasks.',
|
|
27185
|
+
pricing: {
|
|
27186
|
+
prompt: pricing(`$0.1 / 1M tokens`),
|
|
27187
|
+
output: 0,
|
|
27188
|
+
},
|
|
27189
|
+
},
|
|
27190
|
+
/**/
|
|
27191
|
+
/*/
|
|
27192
|
+
{
|
|
27193
|
+
modelVariant: 'CHAT',
|
|
27194
|
+
modelTitle: 'gpt-4-1106-vision-preview',
|
|
27195
|
+
modelName: 'gpt-4-1106-vision-preview',
|
|
27196
|
+
},
|
|
27197
|
+
/**/
|
|
27198
|
+
/*/
|
|
27199
|
+
{
|
|
27200
|
+
modelVariant: 'CHAT',
|
|
27201
|
+
modelTitle: 'gpt-4-vision-preview',
|
|
27202
|
+
modelName: 'gpt-4-vision-preview',
|
|
27203
|
+
pricing: {
|
|
27204
|
+
prompt: computeUsage(`$10.00 / 1M tokens`),
|
|
27205
|
+
output: computeUsage(`$30.00 / 1M tokens`),
|
|
27206
|
+
},
|
|
27207
|
+
},
|
|
27208
|
+
/**/
|
|
27209
|
+
/**/
|
|
27210
|
+
{
|
|
27211
|
+
modelVariant: 'CHAT',
|
|
27212
|
+
modelTitle: 'gpt-4o-2024-05-13',
|
|
27213
|
+
modelName: 'gpt-4o-2024-05-13',
|
|
27214
|
+
modelDescription: 'May 2024 version of GPT-4o with 128K context window. Features enhanced multimodal capabilities including superior image understanding (up to 20MP), audio processing, and improved reasoning. Optimized for 2x lower latency than GPT-4 Turbo while maintaining high performance. Includes knowledge up to October 2023. Ideal for production applications requiring reliable multimodal capabilities.',
|
|
27215
|
+
pricing: {
|
|
27216
|
+
prompt: pricing(`$2.50 / 1M tokens`),
|
|
27217
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
27218
|
+
},
|
|
27219
|
+
},
|
|
27220
|
+
/**/
|
|
27221
|
+
/**/
|
|
27222
|
+
{
|
|
27223
|
+
modelVariant: 'CHAT',
|
|
27224
|
+
modelTitle: 'gpt-4o',
|
|
27225
|
+
modelName: 'gpt-4o',
|
|
27226
|
+
modelDescription: "OpenAI's most advanced general-purpose multimodal model with 128K context window. Optimized for balanced performance, speed, and cost with 2x faster responses than GPT-4 Turbo. Features excellent vision processing, audio understanding, reasoning, and text generation quality. Represents optimal balance of capability and efficiency for most advanced applications.",
|
|
27227
|
+
pricing: {
|
|
27228
|
+
prompt: pricing(`$2.50 / 1M tokens`),
|
|
27229
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
27230
|
+
},
|
|
27231
|
+
},
|
|
27232
|
+
/**/
|
|
27233
|
+
/**/
|
|
27234
|
+
{
|
|
27235
|
+
modelVariant: 'CHAT',
|
|
27236
|
+
modelTitle: 'gpt-4o-mini',
|
|
27237
|
+
modelName: 'gpt-4o-mini',
|
|
27238
|
+
modelDescription: 'Smaller, more cost-effective version of GPT-4o with 128K context window. Maintains impressive capabilities across text, vision, and audio tasks while operating at significantly lower cost. Features 3x faster inference than GPT-4o with good performance on general tasks. Excellent for applications requiring good quality multimodal capabilities at scale.',
|
|
27239
|
+
pricing: {
|
|
27240
|
+
prompt: pricing(`$0.15 / 1M tokens`),
|
|
27241
|
+
output: pricing(`$0.60 / 1M tokens`),
|
|
27242
|
+
},
|
|
27243
|
+
},
|
|
27244
|
+
/**/
|
|
27245
|
+
/**/
|
|
27246
|
+
{
|
|
27247
|
+
modelVariant: 'CHAT',
|
|
27248
|
+
modelTitle: 'o1-preview',
|
|
27249
|
+
modelName: 'o1-preview',
|
|
27250
|
+
modelDescription: 'Advanced reasoning model with 128K context window specializing in complex logical, mathematical, and analytical tasks. Features exceptional step-by-step problem-solving capabilities, advanced mathematical and scientific reasoning, and superior performance on STEM-focused problems. Significantly outperforms GPT-4 on quantitative reasoning benchmarks. Ideal for professional and specialized applications.',
|
|
27251
|
+
pricing: {
|
|
27252
|
+
prompt: pricing(`$15.00 / 1M tokens`),
|
|
27253
|
+
output: pricing(`$60.00 / 1M tokens`),
|
|
27254
|
+
},
|
|
27255
|
+
},
|
|
27256
|
+
/**/
|
|
27257
|
+
/**/
|
|
27258
|
+
{
|
|
27259
|
+
modelVariant: 'CHAT',
|
|
27260
|
+
modelTitle: 'o1-preview-2024-09-12',
|
|
27261
|
+
modelName: 'o1-preview-2024-09-12',
|
|
27262
|
+
modelDescription: 'September 2024 version of O1 preview with 128K context window. Features specialized reasoning capabilities with 30% improvement on mathematical and scientific accuracy over previous versions. Includes enhanced support for formal logic, statistical analysis, and technical domains. Optimized for professional applications requiring precise analytical thinking and rigorous methodologies.',
|
|
27263
|
+
pricing: {
|
|
27264
|
+
prompt: pricing(`$15.00 / 1M tokens`),
|
|
27265
|
+
output: pricing(`$60.00 / 1M tokens`),
|
|
27266
|
+
},
|
|
27267
|
+
},
|
|
27268
|
+
/**/
|
|
27269
|
+
/**/
|
|
27270
|
+
{
|
|
27271
|
+
modelVariant: 'CHAT',
|
|
27272
|
+
modelTitle: 'o1-mini',
|
|
27273
|
+
modelName: 'o1-mini',
|
|
27274
|
+
modelDescription: 'Smaller, cost-effective version of the O1 model with 128K context window. Maintains strong analytical reasoning abilities while reducing computational requirements by 70%. Features good performance on mathematical, logical, and scientific tasks at significantly lower cost than full O1. Excellent for everyday analytical applications that benefit from reasoning focus.',
|
|
27275
|
+
pricing: {
|
|
27276
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
27277
|
+
output: pricing(`$12.00 / 1M tokens`),
|
|
27278
|
+
},
|
|
27279
|
+
},
|
|
27280
|
+
/**/
|
|
27281
|
+
/**/
|
|
27282
|
+
{
|
|
27283
|
+
modelVariant: 'CHAT',
|
|
27284
|
+
modelTitle: 'o1',
|
|
27285
|
+
modelName: 'o1',
|
|
27286
|
+
modelDescription: "OpenAI's advanced reasoning model with 128K context window focusing on logical problem-solving and analytical thinking. Features exceptional performance on quantitative tasks, step-by-step deduction, and complex technical problems. Maintains 95%+ of o1-preview capabilities with production-ready stability. Ideal for scientific computing, financial analysis, and professional applications.",
|
|
27287
|
+
pricing: {
|
|
27288
|
+
prompt: pricing(`$15.00 / 1M tokens`),
|
|
27289
|
+
output: pricing(`$60.00 / 1M tokens`),
|
|
27290
|
+
},
|
|
27291
|
+
},
|
|
27292
|
+
/**/
|
|
27293
|
+
/**/
|
|
27294
|
+
{
|
|
27295
|
+
modelVariant: 'CHAT',
|
|
27296
|
+
modelTitle: 'o3-mini',
|
|
27297
|
+
modelName: 'o3-mini',
|
|
27298
|
+
modelDescription: 'Cost-effective reasoning model with 128K context window optimized for academic and scientific problem-solving. Features efficient performance on STEM tasks with specialized capabilities in mathematics, physics, chemistry, and computer science. Offers 80% of O1 performance on technical domains at significantly lower cost. Ideal for educational applications and research support.',
|
|
27299
|
+
pricing: {
|
|
27300
|
+
prompt: pricing(`$1.10 / 1M tokens`),
|
|
27301
|
+
output: pricing(`$4.40 / 1M tokens`),
|
|
27302
|
+
},
|
|
27303
|
+
},
|
|
27304
|
+
/**/
|
|
27305
|
+
/**/
|
|
27306
|
+
{
|
|
27307
|
+
modelVariant: 'CHAT',
|
|
27308
|
+
modelTitle: 'o1-mini-2024-09-12',
|
|
27309
|
+
modelName: 'o1-mini-2024-09-12',
|
|
27310
|
+
modelDescription: "September 2024 version of O1-mini with 128K context window featuring balanced reasoning capabilities and cost-efficiency. Includes 25% improvement in mathematical accuracy and enhanced performance on coding tasks compared to previous versions. Maintains efficient resource utilization while delivering improved results for analytical applications that don't require the full O1 model.",
|
|
27311
|
+
pricing: {
|
|
27312
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
27313
|
+
output: pricing(`$12.00 / 1M tokens`),
|
|
27314
|
+
},
|
|
27315
|
+
},
|
|
27316
|
+
/**/
|
|
27317
|
+
/**/
|
|
27318
|
+
{
|
|
27319
|
+
modelVariant: 'CHAT',
|
|
27320
|
+
modelTitle: 'gpt-3.5-turbo-16k-0613',
|
|
27321
|
+
modelName: 'gpt-3.5-turbo-16k-0613',
|
|
27322
|
+
modelDescription: "June 2023 version of GPT-3.5 Turbo with extended 16K token context window. Features good handling of longer conversations and documents with improved memory management across extended contexts. Includes knowledge cutoff from September 2021. Maintained for applications specifically designed for this version's behaviors and capabilities.",
|
|
27323
|
+
pricing: {
|
|
27324
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
27325
|
+
output: pricing(`$4.00 / 1M tokens`),
|
|
27326
|
+
},
|
|
27327
|
+
},
|
|
27328
|
+
/**/
|
|
27329
|
+
// <- [🕕]
|
|
27330
|
+
],
|
|
27331
|
+
});
|
|
27332
|
+
/**
|
|
27333
|
+
* Note: [🤖] Add models of new variant
|
|
27334
|
+
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
27335
|
+
* TODO: [🎰] Some mechanism to auto-update available models
|
|
27336
|
+
* TODO: [🎰][👮♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
27337
|
+
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
27338
|
+
* @see https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4
|
|
27339
|
+
* @see https://openai.com/api/pricing/
|
|
27340
|
+
* @see /other/playground/playground.ts
|
|
27341
|
+
* TODO: [🍓][💩] Make better
|
|
27342
|
+
* TODO: Change model titles to human eg: "gpt-4-turbo-2024-04-09" -> "GPT-4 Turbo (2024-04-09)"
|
|
27343
|
+
* TODO: [🚸] Not all models are compatible with JSON mode, add this information here and use it
|
|
27344
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
27305
27345
|
*/
|
|
27306
|
-
function isShellHereDocumentDelimiterPresent(content, delimiter) {
|
|
27307
|
-
return content.replace(/\r\n/gu, '\n').split('\n').some((line) => line === delimiter);
|
|
27308
|
-
}
|
|
27309
27346
|
|
|
27310
27347
|
/**
|
|
27311
27348
|
* Pattern matching codex tokens value matcher.
|
|
@@ -28255,7 +28292,7 @@
|
|
|
28255
28292
|
/**
|
|
28256
28293
|
* Default Qwen Code model used by the coding runner.
|
|
28257
28294
|
*/
|
|
28258
|
-
|
|
28295
|
+
HARNESS_DEFAULT_MODELS['qwen-code'];
|
|
28259
28296
|
/**
|
|
28260
28297
|
* Runs prompts via the Qwen Code CLI.
|
|
28261
28298
|
*/
|
|
@@ -28291,15 +28328,6 @@
|
|
|
28291
28328
|
* Value of `--model` which asks for the default model of the selected harness instead of naming one.
|
|
28292
28329
|
*/
|
|
28293
28330
|
const DEFAULT_MODEL_NAME = 'default';
|
|
28294
|
-
/**
|
|
28295
|
-
* Constant for cline model.
|
|
28296
|
-
*/
|
|
28297
|
-
const CLINE_MODEL = 'gemini:gemini-3-flash-preview';
|
|
28298
|
-
/**
|
|
28299
|
-
* Harnesses which refuse to run without an explicit `--model`, because they expose many models
|
|
28300
|
-
* of very different capability and price and never pick a sensible one on their own.
|
|
28301
|
-
*/
|
|
28302
|
-
const MODEL_REQUIRING_HARNESS_NAMES = ['openai-codex', 'gemini', 'qwen-code'];
|
|
28303
28331
|
/**
|
|
28304
28332
|
* Resolves the configured prompt runner together with status-line metadata.
|
|
28305
28333
|
*
|
|
@@ -28322,14 +28350,14 @@
|
|
|
28322
28350
|
* Creates the runner of one selected harness together with its status-line metadata.
|
|
28323
28351
|
*/
|
|
28324
28352
|
function resolveHarnessPromptRunner(agentName, options) {
|
|
28353
|
+
const actualRunnerModel = resolveRunnerModel(agentName, options.model);
|
|
28325
28354
|
if (agentName === 'openai-codex') {
|
|
28326
|
-
return createOpenAiCodexRunnerResolution(options);
|
|
28355
|
+
return createOpenAiCodexRunnerResolution(options, actualRunnerModel);
|
|
28327
28356
|
}
|
|
28328
28357
|
if (agentName === 'cline') {
|
|
28329
|
-
return createRunnerResolution(options, new ClineRunner({ model:
|
|
28358
|
+
return createRunnerResolution(options, new ClineRunner({ model: actualRunnerModel !== null && actualRunnerModel !== void 0 ? actualRunnerModel : HARNESS_DEFAULT_MODELS.cline }), actualRunnerModel);
|
|
28330
28359
|
}
|
|
28331
28360
|
if (agentName === 'github-copilot') {
|
|
28332
|
-
const actualRunnerModel = options.model === DEFAULT_MODEL_NAME ? undefined : options.model;
|
|
28333
28361
|
return createRunnerResolution(options, new GitHubCopilotRunner({
|
|
28334
28362
|
model: actualRunnerModel,
|
|
28335
28363
|
thinkingLevel: options.thinkingLevel,
|
|
@@ -28337,36 +28365,27 @@
|
|
|
28337
28365
|
}
|
|
28338
28366
|
if (agentName === 'claude-code') {
|
|
28339
28367
|
return createRunnerResolution(options, new ClaudeCodeRunner({
|
|
28340
|
-
model:
|
|
28368
|
+
model: actualRunnerModel,
|
|
28341
28369
|
thinkingLevel: options.thinkingLevel,
|
|
28342
|
-
}),
|
|
28370
|
+
}), actualRunnerModel);
|
|
28343
28371
|
}
|
|
28344
28372
|
if (agentName === 'opencode') {
|
|
28345
28373
|
return createRunnerResolution(options, new OpencodeRunner({
|
|
28346
|
-
model:
|
|
28347
|
-
}),
|
|
28374
|
+
model: actualRunnerModel,
|
|
28375
|
+
}), actualRunnerModel);
|
|
28348
28376
|
}
|
|
28349
28377
|
if (agentName === 'gemini') {
|
|
28350
|
-
return
|
|
28378
|
+
return createRunnerResolution(options, new GeminiRunner({ model: actualRunnerModel !== null && actualRunnerModel !== void 0 ? actualRunnerModel : HARNESS_DEFAULT_MODELS.gemini }), actualRunnerModel);
|
|
28351
28379
|
}
|
|
28352
28380
|
if (agentName === 'qwen-code') {
|
|
28353
|
-
return
|
|
28381
|
+
return createRunnerResolution(options, new QwenCodeRunner({ model: actualRunnerModel !== null && actualRunnerModel !== void 0 ? actualRunnerModel : HARNESS_DEFAULT_MODELS['qwen-code'] }), actualRunnerModel);
|
|
28354
28382
|
}
|
|
28355
28383
|
throw new Error(`Unknown harness: ${agentName}`);
|
|
28356
28384
|
}
|
|
28357
28385
|
/**
|
|
28358
|
-
* Builds the OpenAI Codex runner resolution
|
|
28386
|
+
* Builds the OpenAI Codex runner resolution with its credit-spending policy.
|
|
28359
28387
|
*/
|
|
28360
|
-
function createOpenAiCodexRunnerResolution(options) {
|
|
28361
|
-
const actualRunnerModel = resolveRequiredModel({
|
|
28362
|
-
agentName: 'openai-codex',
|
|
28363
|
-
providedModel: options.model,
|
|
28364
|
-
// Note: Codex must not be pinned to any model of ours, because a ChatGPT-account login only accepts the
|
|
28365
|
-
// models which Codex itself offers — `default` therefore keeps the model from `~/.codex/config.toml`
|
|
28366
|
-
defaultModel: undefined,
|
|
28367
|
-
availableModels: OPENAI_MODELS.filter((model) => model.modelVariant === 'CHAT').map((model) => model.modelName),
|
|
28368
|
-
exampleUsages: ['--harness openai-codex --model gpt-5.2-codex', '--harness openai-codex --model default'],
|
|
28369
|
-
});
|
|
28388
|
+
function createOpenAiCodexRunnerResolution(options, actualRunnerModel) {
|
|
28370
28389
|
const runner = new OpenAiCodexRunner({
|
|
28371
28390
|
codexCommand: 'codex',
|
|
28372
28391
|
model: actualRunnerModel,
|
|
@@ -28381,37 +28400,6 @@
|
|
|
28381
28400
|
}
|
|
28382
28401
|
return createRunnerResolution(options, runner, actualRunnerModel);
|
|
28383
28402
|
}
|
|
28384
|
-
/**
|
|
28385
|
-
* Builds the Gemini CLI runner resolution, including required-model validation.
|
|
28386
|
-
*/
|
|
28387
|
-
function createGeminiRunnerResolution(options) {
|
|
28388
|
-
const actualRunnerModel = resolveRequiredModel({
|
|
28389
|
-
agentName: 'gemini',
|
|
28390
|
-
providedModel: options.model,
|
|
28391
|
-
defaultModel: DEFAULT_GEMINI_MODEL,
|
|
28392
|
-
exampleUsages: [`--harness gemini --model ${DEFAULT_GEMINI_MODEL}`, '--harness gemini --model default'],
|
|
28393
|
-
});
|
|
28394
|
-
return createRunnerResolution(options, new GeminiRunner({
|
|
28395
|
-
model: actualRunnerModel,
|
|
28396
|
-
}), actualRunnerModel);
|
|
28397
|
-
}
|
|
28398
|
-
/**
|
|
28399
|
-
* Builds the Qwen Code CLI runner resolution, including required-model validation.
|
|
28400
|
-
*/
|
|
28401
|
-
function createQwenCodeRunnerResolution(options) {
|
|
28402
|
-
const actualRunnerModel = resolveRequiredModel({
|
|
28403
|
-
agentName: 'qwen-code',
|
|
28404
|
-
providedModel: options.model,
|
|
28405
|
-
defaultModel: DEFAULT_QWEN_CODE_MODEL,
|
|
28406
|
-
exampleUsages: [
|
|
28407
|
-
`--harness qwen-code --model ${DEFAULT_QWEN_CODE_MODEL}`,
|
|
28408
|
-
'--harness qwen-code --model default',
|
|
28409
|
-
],
|
|
28410
|
-
});
|
|
28411
|
-
return createRunnerResolution(options, new QwenCodeRunner({
|
|
28412
|
-
model: actualRunnerModel,
|
|
28413
|
-
}), actualRunnerModel);
|
|
28414
|
-
}
|
|
28415
28403
|
/**
|
|
28416
28404
|
* Combines the instantiated runner with prompt status metadata.
|
|
28417
28405
|
*/
|
|
@@ -28419,64 +28407,26 @@
|
|
|
28419
28407
|
return {
|
|
28420
28408
|
runner,
|
|
28421
28409
|
actualRunnerModel,
|
|
28422
|
-
runnerMetadata:
|
|
28410
|
+
runnerMetadata: {
|
|
28411
|
+
runnerName: options.agentName ? getHarnessDefinition(options.agentName).label : 'unknown',
|
|
28412
|
+
modelName: actualRunnerModel,
|
|
28413
|
+
},
|
|
28423
28414
|
};
|
|
28424
28415
|
}
|
|
28425
28416
|
/**
|
|
28426
|
-
*
|
|
28427
|
-
*/
|
|
28428
|
-
function getRunnerMetadata(options, actualRunnerModel) {
|
|
28429
|
-
const runnerName = options.agentName ? getHarnessDefinition(options.agentName).label : 'unknown';
|
|
28430
|
-
if (options.agentName === 'github-copilot' || isModelRequiringHarnessName(options.agentName)) {
|
|
28431
|
-
return { runnerName, modelName: actualRunnerModel };
|
|
28432
|
-
}
|
|
28433
|
-
if (options.agentName === 'cline') {
|
|
28434
|
-
return { runnerName, modelName: CLINE_MODEL };
|
|
28435
|
-
}
|
|
28436
|
-
if (options.agentName === 'opencode' || options.agentName === 'claude-code') {
|
|
28437
|
-
return { runnerName, modelName: options.model };
|
|
28438
|
-
}
|
|
28439
|
-
return { runnerName };
|
|
28440
|
-
}
|
|
28441
|
-
/**
|
|
28442
|
-
* Checks whether one harness refuses to run without an explicit `--model`.
|
|
28443
|
-
*/
|
|
28444
|
-
function isModelRequiringHarnessName(agentName) {
|
|
28445
|
-
return MODEL_REQUIRING_HARNESS_NAMES.includes(agentName);
|
|
28446
|
-
}
|
|
28447
|
-
/**
|
|
28448
|
-
* Resolves a runner model, allowing `default` but otherwise requiring an explicit value.
|
|
28417
|
+
* Uses the current flagship when no model is selected, while preserving explicit overrides.
|
|
28449
28418
|
*
|
|
28450
|
-
*
|
|
28451
|
-
*
|
|
28419
|
+
* `--model default` keeps the harness's own configured model where supported. Gemini, Qwen and Cline
|
|
28420
|
+
* require a concrete model in their adapters, so the sentinel selects their shared default instead.
|
|
28452
28421
|
*/
|
|
28453
|
-
function
|
|
28454
|
-
if (
|
|
28455
|
-
|
|
28456
|
-
|
|
28457
|
-
if (options.providedModel === DEFAULT_MODEL_NAME) {
|
|
28458
|
-
return options.defaultModel;
|
|
28459
|
-
}
|
|
28460
|
-
return options.providedModel;
|
|
28461
|
-
}
|
|
28462
|
-
/**
|
|
28463
|
-
* Prints the missing-model guidance and exits with the historical non-zero status code.
|
|
28464
|
-
*/
|
|
28465
|
-
function exitForMissingModel(agentName, availableModels, exampleUsages) {
|
|
28466
|
-
console.error(colors__default["default"].red(`Error: --model is required when using --harness ${agentName}`));
|
|
28467
|
-
console.error('');
|
|
28468
|
-
if (availableModels && availableModels.length > 0) {
|
|
28469
|
-
console.error(colors__default["default"].cyan('Available models:'));
|
|
28470
|
-
for (const model of availableModels) {
|
|
28471
|
-
console.error(colors__default["default"].gray(` - ${model}`));
|
|
28422
|
+
function resolveRunnerModel(agentName, providedModel) {
|
|
28423
|
+
if (providedModel === DEFAULT_MODEL_NAME) {
|
|
28424
|
+
if (agentName === 'gemini' || agentName === 'qwen-code' || agentName === 'cline') {
|
|
28425
|
+
return HARNESS_DEFAULT_MODELS[agentName];
|
|
28472
28426
|
}
|
|
28473
|
-
|
|
28474
|
-
}
|
|
28475
|
-
console.error(colors__default["default"].cyan('Example usage:'));
|
|
28476
|
-
for (const exampleUsage of exampleUsages) {
|
|
28477
|
-
console.error(colors__default["default"].gray(` ${exampleUsage}`));
|
|
28427
|
+
return undefined;
|
|
28478
28428
|
}
|
|
28479
|
-
|
|
28429
|
+
return providedModel || HARNESS_DEFAULT_MODELS[agentName];
|
|
28480
28430
|
}
|
|
28481
28431
|
|
|
28482
28432
|
/**
|
|
@@ -44826,7 +44776,7 @@
|
|
|
44826
44776
|
{
|
|
44827
44777
|
scriptName: 'coder:run',
|
|
44828
44778
|
scriptCommand: [
|
|
44829
|
-
'npx ptbk coder run --harness openai-codex --
|
|
44779
|
+
'npx ptbk coder run --harness openai-codex --thinking-level max',
|
|
44830
44780
|
`--agent ${formatDisplayPath(CODER_DEVELOPER_AGENT_FILE_PATH)}`,
|
|
44831
44781
|
`--context ${formatDisplayPath(AGENTS_FILE_PATH)}`,
|
|
44832
44782
|
`--test "npm run ${CODER_TEST_SCRIPT_NAME}" --test-before yes-and-fix`,
|