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