@ljoukov/llm 7.0.16 → 7.0.18

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/dist/index.d.cts CHANGED
@@ -15,8 +15,9 @@ type LlmUsageTokens = {
15
15
  readonly totalTokens?: number;
16
16
  readonly toolUsePromptTokens?: number;
17
17
  };
18
- declare function estimateCallCostUsd({ modelId, tokens, responseImages, imageSize, imageQuality, }: {
18
+ declare function estimateCallCostUsd({ modelId, pricingModelId, tokens, responseImages, imageSize, imageQuality, }: {
19
19
  modelId: string;
20
+ pricingModelId?: string;
20
21
  tokens: LlmUsageTokens | undefined;
21
22
  responseImages: number;
22
23
  imageSize?: string;
@@ -435,13 +436,27 @@ type LlmImageData = {
435
436
  readonly mimeType?: string;
436
437
  readonly data: Buffer$1;
437
438
  };
438
- type LlmOpenAiImageResolution = OpenAiGptImage2Resolution;
439
- type LlmOpenAiImageQuality = OpenAiGptImage2Quality;
440
- type LlmOpenAiImageOutputFormat = OpenAiGptImage2OutputFormat;
441
- type LlmOpenAiImageBackground = OpenAiGptImage2Background;
442
- type LlmOpenAiImageModeration = OpenAiGptImage2Moderation;
443
- type LlmOpenAiImagePartialImageCount = OpenAiGptImage2PartialImageCount;
444
- type LlmOpenAiImageNumImages = OpenAiGptImage2NumImages;
439
+ type LlmGptImage2Resolution = OpenAiGptImage2Resolution;
440
+ type LlmGptImage2Quality = OpenAiGptImage2Quality;
441
+ type LlmGptImage2OutputFormat = OpenAiGptImage2OutputFormat;
442
+ type LlmGptImage2Background = OpenAiGptImage2Background;
443
+ type LlmGptImage2Moderation = OpenAiGptImage2Moderation;
444
+ type LlmGptImage2PartialImageCount = OpenAiGptImage2PartialImageCount;
445
+ type LlmGptImage2NumImages = OpenAiGptImage2NumImages;
446
+ type LlmOpenAiImageResolution = LlmGptImage2Resolution;
447
+ type LlmOpenAiImageQuality = LlmGptImage2Quality;
448
+ type LlmOpenAiImageOutputFormat = LlmGptImage2OutputFormat;
449
+ type LlmOpenAiImageBackground = LlmGptImage2Background;
450
+ type LlmOpenAiImageModeration = LlmGptImage2Moderation;
451
+ type LlmOpenAiImagePartialImageCount = LlmGptImage2PartialImageCount;
452
+ type LlmOpenAiImageNumImages = LlmGptImage2NumImages;
453
+ type LlmChatGptImageResolution = LlmGptImage2Resolution;
454
+ type LlmChatGptImageQuality = LlmGptImage2Quality;
455
+ type LlmChatGptImageOutputFormat = LlmGptImage2OutputFormat;
456
+ type LlmChatGptImageBackground = LlmGptImage2Background;
457
+ type LlmChatGptImageModeration = LlmGptImage2Moderation;
458
+ type LlmChatGptImageNumImages = LlmGptImage2NumImages;
459
+ type LlmChatGptImageAction = "auto" | "generate" | "edit";
445
460
  type LlmGenerateImagesRequestBase = {
446
461
  readonly stylePrompt: string;
447
462
  readonly styleImages?: readonly LlmImageData[];
@@ -462,7 +477,14 @@ type LlmOpenAiGenerateImagesRequest = LlmGenerateImagesRequestBase & {
462
477
  };
463
478
  type LlmChatGptGenerateImagesRequest = LlmGenerateImagesRequestBase & {
464
479
  readonly model: ChatGptImageModelId;
465
- readonly numImages?: LlmOpenAiImageNumImages;
480
+ readonly imageResolution?: LlmChatGptImageResolution;
481
+ readonly imageQuality?: LlmChatGptImageQuality;
482
+ readonly outputFormat?: LlmChatGptImageOutputFormat;
483
+ readonly outputCompression?: number;
484
+ readonly background?: LlmChatGptImageBackground;
485
+ readonly moderation?: LlmChatGptImageModeration;
486
+ readonly action?: LlmChatGptImageAction;
487
+ readonly numImages?: LlmChatGptImageNumImages;
466
488
  };
467
489
  type LlmGeminiGenerateImagesRequest = LlmGenerateImagesRequestBase & {
468
490
  readonly model: GeminiImageModelId;
@@ -1172,4 +1194,4 @@ declare const FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL: FireworksModelId;
1172
1194
  declare function isFireworksModelId(value: string): value is FireworksModelId;
1173
1195
  declare function resolveFireworksModelId(model: string): string | undefined;
1174
1196
 
1175
- export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLogLineSink, type AgentLoggingConfig, type AgentLoggingSelection, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type ApplyPatchAccessContext, type ApplyPatchAccessHook, type ApplyPatchRequest, type ApplyPatchResult, type ApplyPatchToolInput, type AssessmentSubagentInput, CHATGPT_IMAGE_MODEL_IDS, CHATGPT_MODEL_IDS, CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_LARK_GRAMMAR, type CandidateAssessment, type CandidateEvolutionOptions, type CandidateEvolutionResult, type CandidateEvolutionSnapshot, type CandidateEvolutionStats, type CandidateFeedbackEntry, type CandidateIssue, type CandidateProposal, type CandidateRecord, type ChatGptAuthProfile, type ChatGptImageModelId, type ChatGptModelId, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CodexViewImageToolInput, type CreateApplyPatchToolOptions, DEFAULT_FILE_TTL_SECONDS, DEFAULT_SIGNED_URL_TTL_SECONDS, EXPERIMENTAL_CHATGPT_MODEL_PREFIX, type ExperimentalChatGptModelId, FIREWORKS_DEFAULT_GLM_MODEL, FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL, FIREWORKS_DEFAULT_KIMI_MODEL, FIREWORKS_DEFAULT_MINIMAX_MODEL, FIREWORKS_MODEL_IDS, type FeedbackScope, type FireworksModelId, GEMINI_IMAGE_MODEL_IDS, GEMINI_MODEL_IDS, GEMINI_TEXT_MODEL_IDS, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiImageModelId, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReplaceToolInput, type GeminiRgSearchToolInput, type GeminiTextModelId, type GeminiWriteFileToolInput, type GenerationSubagent, type GenerationSubagentInput, InMemoryAgentFilesystem, type JsonSchema, LLM_IMAGE_MODEL_IDS, LLM_MODEL_IDS, LLM_TEXT_MODEL_IDS, type ListedChatGptModelId, type LlmBaseRequest, type LlmBlockedEvent, type LlmCallCompletedTelemetryEvent, type LlmCallStartedTelemetryEvent, type LlmCallStreamTelemetryEvent, type LlmChatGptGenerateImagesRequest, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFileCreateParams, type LlmFileDeleted, type LlmFileUploadBackend, type LlmFileUploadEvent, type LlmFileUploadMetrics, type LlmFileUploadMode, type LlmFileUploadSource, type LlmFunctionTool, type LlmGeminiGenerateImagesRequest, type LlmGenerateImagesRequest, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputFilePart, type LlmInputImagePart, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmMediaResolution, type LlmModelEvent, type LlmModelId, type LlmOpenAiContainer, type LlmOpenAiContainerCreateOptions, type LlmOpenAiContainerFile, type LlmOpenAiContainerFileUpload, type LlmOpenAiContainerNetworkPolicy, type LlmOpenAiGenerateImagesRequest, type LlmOpenAiImageBackground, type LlmOpenAiImageModeration, type LlmOpenAiImageNumImages, type LlmOpenAiImageOutputFormat, type LlmOpenAiImagePartialImageCount, type LlmOpenAiImageQuality, type LlmOpenAiImageResolution, type LlmOpenAiResponseContainerReference, type LlmOpenAiResponseMetadata, type LlmOpenAiShellEnvironment, type LlmOpenAiShellNetworkPolicy, type LlmProvider, type LlmStoredFile, type LlmStreamEvent, type LlmTelemetryOperation, type LlmTextDeltaEvent, type LlmTextModelId, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmThinkingLevel, type LlmToolCallCompletedEvent, type LlmToolCallContext, type LlmToolCallResult, type LlmToolCallStartedEvent, type LlmToolCallStreamEvent, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopSteeringAppendResult, type LlmToolLoopSteeringChannel, type LlmToolLoopSteeringInput, type LlmToolLoopSteeringMessage, type LlmToolLoopStep, type LlmToolLoopStream, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, type ModelConcurrencyConfig, type ModelConcurrencyProvider, OPENAI_GPT_IMAGE_2_AUTO_RESOLUTION, OPENAI_GPT_IMAGE_2_BACKGROUNDS, OPENAI_GPT_IMAGE_2_MODERATION_LEVELS, OPENAI_GPT_IMAGE_2_NUM_IMAGES, OPENAI_GPT_IMAGE_2_OUTPUT_FORMATS, OPENAI_GPT_IMAGE_2_PARTIAL_IMAGE_COUNTS, OPENAI_GPT_IMAGE_2_POPULAR_RESOLUTIONS, OPENAI_GPT_IMAGE_2_QUALITY_LEVELS, OPENAI_GPT_IMAGE_2_RESOLUTIONS, OPENAI_GPT_IMAGE_2_SIZE_CONSTRAINTS, OPENAI_IMAGE_MODEL_IDS, OPENAI_MODEL_IDS, type OpenAiGptImage2Background, type OpenAiGptImage2CustomResolution, type OpenAiGptImage2ListedResolution, type OpenAiGptImage2Moderation, type OpenAiGptImage2NumImages, type OpenAiGptImage2OutputFormat, type OpenAiGptImage2PartialImageCount, type OpenAiGptImage2PopularResolution, type OpenAiGptImage2Quality, type OpenAiGptImage2Resolution, type OpenAiGptImage2ResolutionValidationResult, type OpenAiImageModelId, type OpenAiModelId, type ParentSelectionConfig, type ParentSelectionMidpoint, type PostCheckRejection, type PostGenerationCheckInput, type RunAgentLoopRequest, type TelemetryConfig, type TelemetryEvent, type TelemetrySelection, type TelemetrySink, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, configureTelemetry, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createOpenAiContainer, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, deleteOpenAiContainer, downloadOpenAiContainerFile, downloadOpenAiContainerFileText, emptyFileUploadMetrics, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, files, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptImageModelId, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiImageModelId, isOpenAiModelId, listOpenAiContainerFiles, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveChatGptImageProviderModel, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool, uploadOpenAiContainerFile, validateOpenAiGptImage2Resolution };
1197
+ export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLogLineSink, type AgentLoggingConfig, type AgentLoggingSelection, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type ApplyPatchAccessContext, type ApplyPatchAccessHook, type ApplyPatchRequest, type ApplyPatchResult, type ApplyPatchToolInput, type AssessmentSubagentInput, CHATGPT_IMAGE_MODEL_IDS, CHATGPT_MODEL_IDS, CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_LARK_GRAMMAR, type CandidateAssessment, type CandidateEvolutionOptions, type CandidateEvolutionResult, type CandidateEvolutionSnapshot, type CandidateEvolutionStats, type CandidateFeedbackEntry, type CandidateIssue, type CandidateProposal, type CandidateRecord, type ChatGptAuthProfile, type ChatGptImageModelId, type ChatGptModelId, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CodexViewImageToolInput, type CreateApplyPatchToolOptions, DEFAULT_FILE_TTL_SECONDS, DEFAULT_SIGNED_URL_TTL_SECONDS, EXPERIMENTAL_CHATGPT_MODEL_PREFIX, type ExperimentalChatGptModelId, FIREWORKS_DEFAULT_GLM_MODEL, FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL, FIREWORKS_DEFAULT_KIMI_MODEL, FIREWORKS_DEFAULT_MINIMAX_MODEL, FIREWORKS_MODEL_IDS, type FeedbackScope, type FireworksModelId, GEMINI_IMAGE_MODEL_IDS, GEMINI_MODEL_IDS, GEMINI_TEXT_MODEL_IDS, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiImageModelId, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReplaceToolInput, type GeminiRgSearchToolInput, type GeminiTextModelId, type GeminiWriteFileToolInput, type GenerationSubagent, type GenerationSubagentInput, InMemoryAgentFilesystem, type JsonSchema, LLM_IMAGE_MODEL_IDS, LLM_MODEL_IDS, LLM_TEXT_MODEL_IDS, type ListedChatGptModelId, type LlmBaseRequest, type LlmBlockedEvent, type LlmCallCompletedTelemetryEvent, type LlmCallStartedTelemetryEvent, type LlmCallStreamTelemetryEvent, type LlmChatGptGenerateImagesRequest, type LlmChatGptImageAction, type LlmChatGptImageBackground, type LlmChatGptImageModeration, type LlmChatGptImageNumImages, type LlmChatGptImageOutputFormat, type LlmChatGptImageQuality, type LlmChatGptImageResolution, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFileCreateParams, type LlmFileDeleted, type LlmFileUploadBackend, type LlmFileUploadEvent, type LlmFileUploadMetrics, type LlmFileUploadMode, type LlmFileUploadSource, type LlmFunctionTool, type LlmGeminiGenerateImagesRequest, type LlmGenerateImagesRequest, type LlmGptImage2Background, type LlmGptImage2Moderation, type LlmGptImage2NumImages, type LlmGptImage2OutputFormat, type LlmGptImage2PartialImageCount, type LlmGptImage2Quality, type LlmGptImage2Resolution, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputFilePart, type LlmInputImagePart, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmMediaResolution, type LlmModelEvent, type LlmModelId, type LlmOpenAiContainer, type LlmOpenAiContainerCreateOptions, type LlmOpenAiContainerFile, type LlmOpenAiContainerFileUpload, type LlmOpenAiContainerNetworkPolicy, type LlmOpenAiGenerateImagesRequest, type LlmOpenAiImageBackground, type LlmOpenAiImageModeration, type LlmOpenAiImageNumImages, type LlmOpenAiImageOutputFormat, type LlmOpenAiImagePartialImageCount, type LlmOpenAiImageQuality, type LlmOpenAiImageResolution, type LlmOpenAiResponseContainerReference, type LlmOpenAiResponseMetadata, type LlmOpenAiShellEnvironment, type LlmOpenAiShellNetworkPolicy, type LlmProvider, type LlmStoredFile, type LlmStreamEvent, type LlmTelemetryOperation, type LlmTextDeltaEvent, type LlmTextModelId, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmThinkingLevel, type LlmToolCallCompletedEvent, type LlmToolCallContext, type LlmToolCallResult, type LlmToolCallStartedEvent, type LlmToolCallStreamEvent, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopSteeringAppendResult, type LlmToolLoopSteeringChannel, type LlmToolLoopSteeringInput, type LlmToolLoopSteeringMessage, type LlmToolLoopStep, type LlmToolLoopStream, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, type ModelConcurrencyConfig, type ModelConcurrencyProvider, OPENAI_GPT_IMAGE_2_AUTO_RESOLUTION, OPENAI_GPT_IMAGE_2_BACKGROUNDS, OPENAI_GPT_IMAGE_2_MODERATION_LEVELS, OPENAI_GPT_IMAGE_2_NUM_IMAGES, OPENAI_GPT_IMAGE_2_OUTPUT_FORMATS, OPENAI_GPT_IMAGE_2_PARTIAL_IMAGE_COUNTS, OPENAI_GPT_IMAGE_2_POPULAR_RESOLUTIONS, OPENAI_GPT_IMAGE_2_QUALITY_LEVELS, OPENAI_GPT_IMAGE_2_RESOLUTIONS, OPENAI_GPT_IMAGE_2_SIZE_CONSTRAINTS, OPENAI_IMAGE_MODEL_IDS, OPENAI_MODEL_IDS, type OpenAiGptImage2Background, type OpenAiGptImage2CustomResolution, type OpenAiGptImage2ListedResolution, type OpenAiGptImage2Moderation, type OpenAiGptImage2NumImages, type OpenAiGptImage2OutputFormat, type OpenAiGptImage2PartialImageCount, type OpenAiGptImage2PopularResolution, type OpenAiGptImage2Quality, type OpenAiGptImage2Resolution, type OpenAiGptImage2ResolutionValidationResult, type OpenAiImageModelId, type OpenAiModelId, type ParentSelectionConfig, type ParentSelectionMidpoint, type PostCheckRejection, type PostGenerationCheckInput, type RunAgentLoopRequest, type TelemetryConfig, type TelemetryEvent, type TelemetrySelection, type TelemetrySink, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, configureTelemetry, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createOpenAiContainer, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, deleteOpenAiContainer, downloadOpenAiContainerFile, downloadOpenAiContainerFileText, emptyFileUploadMetrics, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, files, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptImageModelId, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiImageModelId, isOpenAiModelId, listOpenAiContainerFiles, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveChatGptImageProviderModel, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool, uploadOpenAiContainerFile, validateOpenAiGptImage2Resolution };
package/dist/index.d.ts CHANGED
@@ -15,8 +15,9 @@ type LlmUsageTokens = {
15
15
  readonly totalTokens?: number;
16
16
  readonly toolUsePromptTokens?: number;
17
17
  };
18
- declare function estimateCallCostUsd({ modelId, tokens, responseImages, imageSize, imageQuality, }: {
18
+ declare function estimateCallCostUsd({ modelId, pricingModelId, tokens, responseImages, imageSize, imageQuality, }: {
19
19
  modelId: string;
20
+ pricingModelId?: string;
20
21
  tokens: LlmUsageTokens | undefined;
21
22
  responseImages: number;
22
23
  imageSize?: string;
@@ -435,13 +436,27 @@ type LlmImageData = {
435
436
  readonly mimeType?: string;
436
437
  readonly data: Buffer$1;
437
438
  };
438
- type LlmOpenAiImageResolution = OpenAiGptImage2Resolution;
439
- type LlmOpenAiImageQuality = OpenAiGptImage2Quality;
440
- type LlmOpenAiImageOutputFormat = OpenAiGptImage2OutputFormat;
441
- type LlmOpenAiImageBackground = OpenAiGptImage2Background;
442
- type LlmOpenAiImageModeration = OpenAiGptImage2Moderation;
443
- type LlmOpenAiImagePartialImageCount = OpenAiGptImage2PartialImageCount;
444
- type LlmOpenAiImageNumImages = OpenAiGptImage2NumImages;
439
+ type LlmGptImage2Resolution = OpenAiGptImage2Resolution;
440
+ type LlmGptImage2Quality = OpenAiGptImage2Quality;
441
+ type LlmGptImage2OutputFormat = OpenAiGptImage2OutputFormat;
442
+ type LlmGptImage2Background = OpenAiGptImage2Background;
443
+ type LlmGptImage2Moderation = OpenAiGptImage2Moderation;
444
+ type LlmGptImage2PartialImageCount = OpenAiGptImage2PartialImageCount;
445
+ type LlmGptImage2NumImages = OpenAiGptImage2NumImages;
446
+ type LlmOpenAiImageResolution = LlmGptImage2Resolution;
447
+ type LlmOpenAiImageQuality = LlmGptImage2Quality;
448
+ type LlmOpenAiImageOutputFormat = LlmGptImage2OutputFormat;
449
+ type LlmOpenAiImageBackground = LlmGptImage2Background;
450
+ type LlmOpenAiImageModeration = LlmGptImage2Moderation;
451
+ type LlmOpenAiImagePartialImageCount = LlmGptImage2PartialImageCount;
452
+ type LlmOpenAiImageNumImages = LlmGptImage2NumImages;
453
+ type LlmChatGptImageResolution = LlmGptImage2Resolution;
454
+ type LlmChatGptImageQuality = LlmGptImage2Quality;
455
+ type LlmChatGptImageOutputFormat = LlmGptImage2OutputFormat;
456
+ type LlmChatGptImageBackground = LlmGptImage2Background;
457
+ type LlmChatGptImageModeration = LlmGptImage2Moderation;
458
+ type LlmChatGptImageNumImages = LlmGptImage2NumImages;
459
+ type LlmChatGptImageAction = "auto" | "generate" | "edit";
445
460
  type LlmGenerateImagesRequestBase = {
446
461
  readonly stylePrompt: string;
447
462
  readonly styleImages?: readonly LlmImageData[];
@@ -462,7 +477,14 @@ type LlmOpenAiGenerateImagesRequest = LlmGenerateImagesRequestBase & {
462
477
  };
463
478
  type LlmChatGptGenerateImagesRequest = LlmGenerateImagesRequestBase & {
464
479
  readonly model: ChatGptImageModelId;
465
- readonly numImages?: LlmOpenAiImageNumImages;
480
+ readonly imageResolution?: LlmChatGptImageResolution;
481
+ readonly imageQuality?: LlmChatGptImageQuality;
482
+ readonly outputFormat?: LlmChatGptImageOutputFormat;
483
+ readonly outputCompression?: number;
484
+ readonly background?: LlmChatGptImageBackground;
485
+ readonly moderation?: LlmChatGptImageModeration;
486
+ readonly action?: LlmChatGptImageAction;
487
+ readonly numImages?: LlmChatGptImageNumImages;
466
488
  };
467
489
  type LlmGeminiGenerateImagesRequest = LlmGenerateImagesRequestBase & {
468
490
  readonly model: GeminiImageModelId;
@@ -1172,4 +1194,4 @@ declare const FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL: FireworksModelId;
1172
1194
  declare function isFireworksModelId(value: string): value is FireworksModelId;
1173
1195
  declare function resolveFireworksModelId(model: string): string | undefined;
1174
1196
 
1175
- export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLogLineSink, type AgentLoggingConfig, type AgentLoggingSelection, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type ApplyPatchAccessContext, type ApplyPatchAccessHook, type ApplyPatchRequest, type ApplyPatchResult, type ApplyPatchToolInput, type AssessmentSubagentInput, CHATGPT_IMAGE_MODEL_IDS, CHATGPT_MODEL_IDS, CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_LARK_GRAMMAR, type CandidateAssessment, type CandidateEvolutionOptions, type CandidateEvolutionResult, type CandidateEvolutionSnapshot, type CandidateEvolutionStats, type CandidateFeedbackEntry, type CandidateIssue, type CandidateProposal, type CandidateRecord, type ChatGptAuthProfile, type ChatGptImageModelId, type ChatGptModelId, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CodexViewImageToolInput, type CreateApplyPatchToolOptions, DEFAULT_FILE_TTL_SECONDS, DEFAULT_SIGNED_URL_TTL_SECONDS, EXPERIMENTAL_CHATGPT_MODEL_PREFIX, type ExperimentalChatGptModelId, FIREWORKS_DEFAULT_GLM_MODEL, FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL, FIREWORKS_DEFAULT_KIMI_MODEL, FIREWORKS_DEFAULT_MINIMAX_MODEL, FIREWORKS_MODEL_IDS, type FeedbackScope, type FireworksModelId, GEMINI_IMAGE_MODEL_IDS, GEMINI_MODEL_IDS, GEMINI_TEXT_MODEL_IDS, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiImageModelId, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReplaceToolInput, type GeminiRgSearchToolInput, type GeminiTextModelId, type GeminiWriteFileToolInput, type GenerationSubagent, type GenerationSubagentInput, InMemoryAgentFilesystem, type JsonSchema, LLM_IMAGE_MODEL_IDS, LLM_MODEL_IDS, LLM_TEXT_MODEL_IDS, type ListedChatGptModelId, type LlmBaseRequest, type LlmBlockedEvent, type LlmCallCompletedTelemetryEvent, type LlmCallStartedTelemetryEvent, type LlmCallStreamTelemetryEvent, type LlmChatGptGenerateImagesRequest, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFileCreateParams, type LlmFileDeleted, type LlmFileUploadBackend, type LlmFileUploadEvent, type LlmFileUploadMetrics, type LlmFileUploadMode, type LlmFileUploadSource, type LlmFunctionTool, type LlmGeminiGenerateImagesRequest, type LlmGenerateImagesRequest, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputFilePart, type LlmInputImagePart, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmMediaResolution, type LlmModelEvent, type LlmModelId, type LlmOpenAiContainer, type LlmOpenAiContainerCreateOptions, type LlmOpenAiContainerFile, type LlmOpenAiContainerFileUpload, type LlmOpenAiContainerNetworkPolicy, type LlmOpenAiGenerateImagesRequest, type LlmOpenAiImageBackground, type LlmOpenAiImageModeration, type LlmOpenAiImageNumImages, type LlmOpenAiImageOutputFormat, type LlmOpenAiImagePartialImageCount, type LlmOpenAiImageQuality, type LlmOpenAiImageResolution, type LlmOpenAiResponseContainerReference, type LlmOpenAiResponseMetadata, type LlmOpenAiShellEnvironment, type LlmOpenAiShellNetworkPolicy, type LlmProvider, type LlmStoredFile, type LlmStreamEvent, type LlmTelemetryOperation, type LlmTextDeltaEvent, type LlmTextModelId, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmThinkingLevel, type LlmToolCallCompletedEvent, type LlmToolCallContext, type LlmToolCallResult, type LlmToolCallStartedEvent, type LlmToolCallStreamEvent, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopSteeringAppendResult, type LlmToolLoopSteeringChannel, type LlmToolLoopSteeringInput, type LlmToolLoopSteeringMessage, type LlmToolLoopStep, type LlmToolLoopStream, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, type ModelConcurrencyConfig, type ModelConcurrencyProvider, OPENAI_GPT_IMAGE_2_AUTO_RESOLUTION, OPENAI_GPT_IMAGE_2_BACKGROUNDS, OPENAI_GPT_IMAGE_2_MODERATION_LEVELS, OPENAI_GPT_IMAGE_2_NUM_IMAGES, OPENAI_GPT_IMAGE_2_OUTPUT_FORMATS, OPENAI_GPT_IMAGE_2_PARTIAL_IMAGE_COUNTS, OPENAI_GPT_IMAGE_2_POPULAR_RESOLUTIONS, OPENAI_GPT_IMAGE_2_QUALITY_LEVELS, OPENAI_GPT_IMAGE_2_RESOLUTIONS, OPENAI_GPT_IMAGE_2_SIZE_CONSTRAINTS, OPENAI_IMAGE_MODEL_IDS, OPENAI_MODEL_IDS, type OpenAiGptImage2Background, type OpenAiGptImage2CustomResolution, type OpenAiGptImage2ListedResolution, type OpenAiGptImage2Moderation, type OpenAiGptImage2NumImages, type OpenAiGptImage2OutputFormat, type OpenAiGptImage2PartialImageCount, type OpenAiGptImage2PopularResolution, type OpenAiGptImage2Quality, type OpenAiGptImage2Resolution, type OpenAiGptImage2ResolutionValidationResult, type OpenAiImageModelId, type OpenAiModelId, type ParentSelectionConfig, type ParentSelectionMidpoint, type PostCheckRejection, type PostGenerationCheckInput, type RunAgentLoopRequest, type TelemetryConfig, type TelemetryEvent, type TelemetrySelection, type TelemetrySink, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, configureTelemetry, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createOpenAiContainer, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, deleteOpenAiContainer, downloadOpenAiContainerFile, downloadOpenAiContainerFileText, emptyFileUploadMetrics, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, files, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptImageModelId, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiImageModelId, isOpenAiModelId, listOpenAiContainerFiles, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveChatGptImageProviderModel, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool, uploadOpenAiContainerFile, validateOpenAiGptImage2Resolution };
1197
+ export { type AgentDirectoryEntry, type AgentFilesystem, type AgentFilesystemToolAccessContext, type AgentFilesystemToolAccessHook, type AgentFilesystemToolAction, type AgentFilesystemToolConfig, type AgentFilesystemToolName, type AgentFilesystemToolProfile, type AgentFilesystemToolSelection, type AgentFilesystemToolsOptions, type AgentLogLineSink, type AgentLoggingConfig, type AgentLoggingSelection, type AgentLoopStream, type AgentPathInfo, type AgentPathKind, type AgentRunCompletedTelemetryEvent, type AgentRunStartedTelemetryEvent, type AgentRunStreamTelemetryEvent, type AgentSubagentToolConfig, type AgentSubagentToolPromptPattern, type AgentSubagentToolSelection, type ApplyPatchAccessContext, type ApplyPatchAccessHook, type ApplyPatchRequest, type ApplyPatchResult, type ApplyPatchToolInput, type AssessmentSubagentInput, CHATGPT_IMAGE_MODEL_IDS, CHATGPT_MODEL_IDS, CODEX_APPLY_PATCH_FREEFORM_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_JSON_TOOL_DESCRIPTION, CODEX_APPLY_PATCH_LARK_GRAMMAR, type CandidateAssessment, type CandidateEvolutionOptions, type CandidateEvolutionResult, type CandidateEvolutionSnapshot, type CandidateEvolutionStats, type CandidateFeedbackEntry, type CandidateIssue, type CandidateProposal, type CandidateRecord, type ChatGptAuthProfile, type ChatGptImageModelId, type ChatGptModelId, type CodexApplyPatchToolInput, type CodexGrepFilesToolInput, type CodexListDirToolInput, type CodexReadFileToolInput, type CodexViewImageToolInput, type CreateApplyPatchToolOptions, DEFAULT_FILE_TTL_SECONDS, DEFAULT_SIGNED_URL_TTL_SECONDS, EXPERIMENTAL_CHATGPT_MODEL_PREFIX, type ExperimentalChatGptModelId, FIREWORKS_DEFAULT_GLM_MODEL, FIREWORKS_DEFAULT_GPT_OSS_120B_MODEL, FIREWORKS_DEFAULT_KIMI_MODEL, FIREWORKS_DEFAULT_MINIMAX_MODEL, FIREWORKS_MODEL_IDS, type FeedbackScope, type FireworksModelId, GEMINI_IMAGE_MODEL_IDS, GEMINI_MODEL_IDS, GEMINI_TEXT_MODEL_IDS, type GeminiGlobToolInput, type GeminiGrepSearchToolInput, type GeminiImageModelId, type GeminiListDirectoryToolInput, type GeminiModelId, type GeminiReadFileToolInput, type GeminiReplaceToolInput, type GeminiRgSearchToolInput, type GeminiTextModelId, type GeminiWriteFileToolInput, type GenerationSubagent, type GenerationSubagentInput, InMemoryAgentFilesystem, type JsonSchema, LLM_IMAGE_MODEL_IDS, LLM_MODEL_IDS, LLM_TEXT_MODEL_IDS, type ListedChatGptModelId, type LlmBaseRequest, type LlmBlockedEvent, type LlmCallCompletedTelemetryEvent, type LlmCallStartedTelemetryEvent, type LlmCallStreamTelemetryEvent, type LlmChatGptGenerateImagesRequest, type LlmChatGptImageAction, type LlmChatGptImageBackground, type LlmChatGptImageModeration, type LlmChatGptImageNumImages, type LlmChatGptImageOutputFormat, type LlmChatGptImageQuality, type LlmChatGptImageResolution, type LlmContent, type LlmContentPart, type LlmCustomTool, type LlmCustomToolInputFormat, type LlmExecutableTool, type LlmFileCreateParams, type LlmFileDeleted, type LlmFileUploadBackend, type LlmFileUploadEvent, type LlmFileUploadMetrics, type LlmFileUploadMode, type LlmFileUploadSource, type LlmFunctionTool, type LlmGeminiGenerateImagesRequest, type LlmGenerateImagesRequest, type LlmGptImage2Background, type LlmGptImage2Moderation, type LlmGptImage2NumImages, type LlmGptImage2OutputFormat, type LlmGptImage2PartialImageCount, type LlmGptImage2Quality, type LlmGptImage2Resolution, type LlmImageData, type LlmImageModelId, type LlmImageSize, type LlmInput, type LlmInputFilePart, type LlmInputImagePart, type LlmInputMessage, LlmJsonCallError, type LlmJsonRequest, type LlmJsonStream, type LlmJsonStreamEvent, type LlmJsonStreamRequest, type LlmMediaResolution, type LlmModelEvent, type LlmModelId, type LlmOpenAiContainer, type LlmOpenAiContainerCreateOptions, type LlmOpenAiContainerFile, type LlmOpenAiContainerFileUpload, type LlmOpenAiContainerNetworkPolicy, type LlmOpenAiGenerateImagesRequest, type LlmOpenAiImageBackground, type LlmOpenAiImageModeration, type LlmOpenAiImageNumImages, type LlmOpenAiImageOutputFormat, type LlmOpenAiImagePartialImageCount, type LlmOpenAiImageQuality, type LlmOpenAiImageResolution, type LlmOpenAiResponseContainerReference, type LlmOpenAiResponseMetadata, type LlmOpenAiShellEnvironment, type LlmOpenAiShellNetworkPolicy, type LlmProvider, type LlmStoredFile, type LlmStreamEvent, type LlmTelemetryOperation, type LlmTextDeltaEvent, type LlmTextModelId, type LlmTextRequest, type LlmTextResult, type LlmTextStream, type LlmThinkingLevel, type LlmToolCallCompletedEvent, type LlmToolCallContext, type LlmToolCallResult, type LlmToolCallStartedEvent, type LlmToolCallStreamEvent, type LlmToolConfig, type LlmToolLoopRequest, type LlmToolLoopResult, type LlmToolLoopSteeringAppendResult, type LlmToolLoopSteeringChannel, type LlmToolLoopSteeringInput, type LlmToolLoopSteeringMessage, type LlmToolLoopStep, type LlmToolLoopStream, type LlmToolSet, type LlmUsageEvent, type LlmUsageTokens, type LlmWebSearchMode, type ModelConcurrencyConfig, type ModelConcurrencyProvider, OPENAI_GPT_IMAGE_2_AUTO_RESOLUTION, OPENAI_GPT_IMAGE_2_BACKGROUNDS, OPENAI_GPT_IMAGE_2_MODERATION_LEVELS, OPENAI_GPT_IMAGE_2_NUM_IMAGES, OPENAI_GPT_IMAGE_2_OUTPUT_FORMATS, OPENAI_GPT_IMAGE_2_PARTIAL_IMAGE_COUNTS, OPENAI_GPT_IMAGE_2_POPULAR_RESOLUTIONS, OPENAI_GPT_IMAGE_2_QUALITY_LEVELS, OPENAI_GPT_IMAGE_2_RESOLUTIONS, OPENAI_GPT_IMAGE_2_SIZE_CONSTRAINTS, OPENAI_IMAGE_MODEL_IDS, OPENAI_MODEL_IDS, type OpenAiGptImage2Background, type OpenAiGptImage2CustomResolution, type OpenAiGptImage2ListedResolution, type OpenAiGptImage2Moderation, type OpenAiGptImage2NumImages, type OpenAiGptImage2OutputFormat, type OpenAiGptImage2PartialImageCount, type OpenAiGptImage2PopularResolution, type OpenAiGptImage2Quality, type OpenAiGptImage2Resolution, type OpenAiGptImage2ResolutionValidationResult, type OpenAiImageModelId, type OpenAiModelId, type ParentSelectionConfig, type ParentSelectionMidpoint, type PostCheckRejection, type PostGenerationCheckInput, type RunAgentLoopRequest, type TelemetryConfig, type TelemetryEvent, type TelemetrySelection, type TelemetrySink, appendMarkdownSourcesSection, applyPatch, configureGemini, configureModelConcurrency, configureTelemetry, convertGooglePartsToLlmParts, createApplyPatchTool, createCodexApplyPatchTool, createCodexFilesystemToolSet, createCodexReadFileTool, createFilesystemToolSetForModel, createGeminiFilesystemToolSet, createGeminiReadFileTool, createGlobTool, createGrepFilesTool, createGrepSearchTool, createInMemoryAgentFilesystem, createListDirTool, createListDirectoryTool, createModelAgnosticFilesystemToolSet, createNodeAgentFilesystem, createOpenAiContainer, createReplaceTool, createRgSearchTool, createToolLoopSteeringChannel, createViewImageTool, createWriteFileTool, customTool, deleteOpenAiContainer, downloadOpenAiContainerFile, downloadOpenAiContainerFileText, emptyFileUploadMetrics, encodeChatGptAuthJson, encodeChatGptAuthJsonB64, estimateCallCostUsd, exchangeChatGptOauthCode, files, generateImageInBatches, generateImages, generateJson, generateText, getChatGptAuthProfile, getCurrentToolCallContext, isChatGptImageModelId, isChatGptModelId, isExperimentalChatGptModelId, isFireworksModelId, isGeminiImageModelId, isGeminiModelId, isGeminiTextModelId, isLlmImageModelId, isLlmModelId, isLlmTextModelId, isOpenAiImageModelId, isOpenAiModelId, listOpenAiContainerFiles, loadEnvFromFile, loadLocalEnv, parseJsonFromLlmText, refreshChatGptOauthToken, resetModelConcurrencyConfig, resetTelemetry, resolveChatGptImageProviderModel, resolveFilesystemToolProfile, resolveFireworksModelId, runAgentLoop, runCandidateEvolution, runToolLoop, sanitisePartForLogging, streamAgentLoop, streamJson, streamText, streamToolLoop, stripCodexCitationMarkers, toGeminiJsonSchema, tool, uploadOpenAiContainerFile, validateOpenAiGptImage2Resolution };
package/dist/index.js CHANGED
@@ -344,6 +344,7 @@ function resolveChatGptServiceTier(model) {
344
344
  // src/openai/pricing.ts
345
345
  var OPENAI_GPT_55_FAST_MODEL_IDS = ["gpt-5.5-fast", "chatgpt-gpt-5.5-fast"];
346
346
  var OPENAI_GPT_55_STANDARD_MODEL_IDS = ["gpt-5.5", "chatgpt-gpt-5.5"];
347
+ var OPENAI_GPT_55_CONCRETE_MODEL_ID_RE = /^(?:chatgpt-)?gpt-5\.5-\d{4}-\d{2}-\d{2}$/u;
347
348
  var OPENAI_GPT_54_FAST_MODEL_IDS = ["gpt-5.4-fast", "chatgpt-gpt-5.4-fast"];
348
349
  var OPENAI_GPT_54_MINI_MODEL_IDS = ["gpt-5.4-mini", "chatgpt-gpt-5.4-mini"];
349
350
  var OPENAI_GPT_54_NANO_MODEL_IDS = ["gpt-5.4-nano"];
@@ -410,7 +411,7 @@ function getOpenAiPricing(modelId) {
410
411
  if (OPENAI_GPT_55_FAST_MODEL_IDS.includes(modelId)) {
411
412
  return OPENAI_GPT_55_PRIORITY_PRICING;
412
413
  }
413
- if (OPENAI_GPT_55_STANDARD_MODEL_IDS.includes(modelId)) {
414
+ if (OPENAI_GPT_55_STANDARD_MODEL_IDS.includes(modelId) || OPENAI_GPT_55_CONCRETE_MODEL_ID_RE.test(modelId)) {
414
415
  return OPENAI_GPT_55_PRICING;
415
416
  }
416
417
  if (OPENAI_GPT_54_FAST_MODEL_IDS.includes(modelId)) {
@@ -443,12 +444,14 @@ function resolveUsageNumber(value) {
443
444
  }
444
445
  function estimateCallCostUsd({
445
446
  modelId,
447
+ pricingModelId,
446
448
  tokens,
447
449
  responseImages,
448
450
  imageSize,
449
451
  imageQuality
450
452
  }) {
451
- const openAiImagePricing = getOpenAiImagePricing(modelId);
453
+ const pricingModelIds = resolvePricingModelIds(modelId, pricingModelId);
454
+ const openAiImagePricing = resolvePricing(pricingModelIds, getOpenAiImagePricing);
452
455
  if (openAiImagePricing) {
453
456
  return estimateOpenAiImageCostUsd({
454
457
  pricing: openAiImagePricing,
@@ -468,7 +471,7 @@ function estimateCallCostUsd({
468
471
  const toolUsePromptTokens = resolveUsageNumber(tokens.toolUsePromptTokens);
469
472
  const promptTokenTotal = promptTokens + toolUsePromptTokens;
470
473
  const nonCachedPrompt = Math.max(0, promptTokenTotal - cachedTokens);
471
- const imagePreviewPricing = getGeminiImagePricing(modelId);
474
+ const imagePreviewPricing = resolvePricing(pricingModelIds, getGeminiImagePricing);
472
475
  if (imagePreviewPricing) {
473
476
  const resolvedImageSize = imageSize && imagePreviewPricing.imagePrices[imageSize] ? imageSize : "2K";
474
477
  const imageRate = imagePreviewPricing.imagePrices[resolvedImageSize] ?? 0;
@@ -488,7 +491,7 @@ function estimateCallCostUsd({
488
491
  const imageOutputCost = imageTokensForPricing * imagePreviewPricing.outputImageRate;
489
492
  return inputCost + cachedCost + textOutputCost + imageOutputCost;
490
493
  }
491
- const geminiPricing = getGeminiProPricing(modelId);
494
+ const geminiPricing = resolvePricing(pricingModelIds, getGeminiProPricing);
492
495
  if (geminiPricing) {
493
496
  const useHighTier = promptTokenTotal > geminiPricing.threshold;
494
497
  const inputRate = useHighTier ? geminiPricing.inputRateHigh : geminiPricing.inputRateLow;
@@ -500,7 +503,7 @@ function estimateCallCostUsd({
500
503
  const outputCost = outputTokens * outputRate;
501
504
  return inputCost + cachedCost + outputCost;
502
505
  }
503
- const fireworksPricing = getFireworksPricing(modelId);
506
+ const fireworksPricing = resolvePricing(pricingModelIds, getFireworksPricing);
504
507
  if (fireworksPricing) {
505
508
  const inputCost = nonCachedPrompt * fireworksPricing.inputRate;
506
509
  const cachedCost = cachedTokens * fireworksPricing.cachedRate;
@@ -508,7 +511,7 @@ function estimateCallCostUsd({
508
511
  const outputCost = outputTokens * fireworksPricing.outputRate;
509
512
  return inputCost + cachedCost + outputCost;
510
513
  }
511
- const openAiPricing = getOpenAiPricing(modelId);
514
+ const openAiPricing = resolvePricing(pricingModelIds, getOpenAiPricing);
512
515
  if (openAiPricing) {
513
516
  const inputCost = nonCachedPrompt * openAiPricing.inputRate;
514
517
  const cachedCost = cachedTokens * openAiPricing.cachedRate;
@@ -518,6 +521,21 @@ function estimateCallCostUsd({
518
521
  }
519
522
  return 0;
520
523
  }
524
+ function resolvePricingModelIds(modelId, pricingModelId) {
525
+ if (pricingModelId && pricingModelId !== modelId) {
526
+ return [pricingModelId, modelId];
527
+ }
528
+ return [modelId];
529
+ }
530
+ function resolvePricing(modelIds, resolve) {
531
+ for (const modelId of modelIds) {
532
+ const pricing = resolve(modelId);
533
+ if (pricing) {
534
+ return pricing;
535
+ }
536
+ }
537
+ return void 0;
538
+ }
521
539
  function estimateOpenAiImageCostUsd({
522
540
  pricing,
523
541
  responseImages,
@@ -8329,6 +8347,7 @@ async function runTextCall(params) {
8329
8347
  const outputAttachments = collectLoggedAttachmentsFromLlmParts(mergedParts, "output");
8330
8348
  const costUsd = estimateCallCostUsd({
8331
8349
  modelId: modelVersion,
8350
+ pricingModelId: request.model,
8332
8351
  tokens: latestUsage,
8333
8352
  responseImages,
8334
8353
  imageSize: request.imageSize
@@ -9072,6 +9091,7 @@ async function runToolLoop(request) {
9072
9091
  const modelCompletedAtMs = Date.now();
9073
9092
  const stepCostUsd = estimateCallCostUsd({
9074
9093
  modelId: modelVersion,
9094
+ pricingModelId: request.model,
9075
9095
  tokens: usageTokens,
9076
9096
  responseImages: 0
9077
9097
  });
@@ -9403,6 +9423,7 @@ async function runToolLoop(request) {
9403
9423
  usageTokens = extractChatGptUsageTokens(response.usage);
9404
9424
  const stepCostUsd = estimateCallCostUsd({
9405
9425
  modelId: modelVersion,
9426
+ pricingModelId: request.model,
9406
9427
  tokens: usageTokens,
9407
9428
  responseImages: 0
9408
9429
  });
@@ -9731,6 +9752,7 @@ async function runToolLoop(request) {
9731
9752
  usageTokens = extractFireworksUsageTokens(response.usage);
9732
9753
  const stepCostUsd = estimateCallCostUsd({
9733
9754
  modelId: modelVersion,
9755
+ pricingModelId: request.model,
9734
9756
  tokens: usageTokens,
9735
9757
  responseImages: 0
9736
9758
  });
@@ -10093,6 +10115,7 @@ async function runToolLoop(request) {
10093
10115
  );
10094
10116
  const stepCostUsd = estimateCallCostUsd({
10095
10117
  modelId: modelVersion,
10118
+ pricingModelId: request.model,
10096
10119
  tokens: usageTokens,
10097
10120
  responseImages: 0
10098
10121
  });
@@ -10447,7 +10470,7 @@ function buildOpenAiImagePrompt(params) {
10447
10470
  params.imagePrompt.trim()
10448
10471
  ].filter((line) => line.length > 0).join("\n");
10449
10472
  }
10450
- function resolveOpenAiImageRequestParams(request) {
10473
+ function resolveGptImage2RequestParams(request) {
10451
10474
  if (request.partialImages !== void 0) {
10452
10475
  throw new Error("partialImages is only supported for streaming image generation.");
10453
10476
  }
@@ -10461,7 +10484,7 @@ function resolveOpenAiImageRequestParams(request) {
10461
10484
  const sizeValidation = validateOpenAiGptImage2Resolution(size);
10462
10485
  if (!sizeValidation.valid) {
10463
10486
  throw new Error(
10464
- `imageResolution ${JSON.stringify(size)} is not supported by gpt-image-2: ${sizeValidation.reason}`
10487
+ `imageResolution ${JSON.stringify(size)} is not supported by ${request.model}: ${sizeValidation.reason}`
10465
10488
  );
10466
10489
  }
10467
10490
  return {
@@ -10504,7 +10527,7 @@ async function generateImagesWithOpenAiImageApi(request) {
10504
10527
  model: request.model
10505
10528
  });
10506
10529
  const startedAtMs = Date.now();
10507
- const params = resolveOpenAiImageRequestParams(request);
10530
+ const params = resolveGptImage2RequestParams(request);
10508
10531
  const styleImages = await createOpenAiStyleImageFiles(request.styleImages);
10509
10532
  const hasStyleImages = Boolean(styleImages && styleImages.length > 0);
10510
10533
  const outputMimeType = resolveOpenAiImageMimeType(params.outputFormat);
@@ -10632,7 +10655,8 @@ async function generateImagesWithChatGptImageTool(request) {
10632
10655
  model: request.model
10633
10656
  });
10634
10657
  const startedAtMs = Date.now();
10635
- const numImagesPerPrompt = request.numImages ?? 1;
10658
+ const params = resolveGptImage2RequestParams(request);
10659
+ const outputMimeType = resolveOpenAiImageMimeType(params.outputFormat);
10636
10660
  let totalUsage;
10637
10661
  let costUsd = 0;
10638
10662
  let outputImages = 0;
@@ -10640,7 +10664,7 @@ async function generateImagesWithChatGptImageTool(request) {
10640
10664
  type: "llm.call.started",
10641
10665
  imagePromptCount: promptEntries.length,
10642
10666
  styleImageCount: request.styleImages?.length ?? 0,
10643
- numImagesPerPrompt
10667
+ numImagesPerPrompt: params.n
10644
10668
  });
10645
10669
  try {
10646
10670
  const images = [];
@@ -10650,7 +10674,7 @@ async function generateImagesWithChatGptImageTool(request) {
10650
10674
  imagePrompt,
10651
10675
  hasStyleImages: Boolean(request.styleImages && request.styleImages.length > 0)
10652
10676
  });
10653
- for (let imageIndex = 0; imageIndex < numImagesPerPrompt; imageIndex += 1) {
10677
+ for (let imageIndex = 0; imageIndex < params.n; imageIndex += 1) {
10654
10678
  const chatGptInput = toChatGptInput(
10655
10679
  buildChatGptImageInputContent({
10656
10680
  prompt,
@@ -10667,11 +10691,22 @@ async function generateImagesWithChatGptImageTool(request) {
10667
10691
  model: providerInfo.model,
10668
10692
  store: false,
10669
10693
  stream: true,
10670
- instructions: chatGptInput.instructions ?? "Use the image_generation tool to generate exactly one PNG image. Do not return prose instead of the image.",
10694
+ instructions: chatGptInput.instructions ?? "Use the image_generation tool to generate exactly one image. Do not return prose instead of the image.",
10671
10695
  input: preparedInput,
10672
10696
  tool_choice: "required",
10673
10697
  parallel_tool_calls: false,
10674
- tools: [{ type: "image_generation", output_format: "png" }]
10698
+ tools: [
10699
+ {
10700
+ type: "image_generation",
10701
+ size: params.size,
10702
+ quality: params.quality,
10703
+ output_format: params.outputFormat ?? "png",
10704
+ ...request.outputCompression !== void 0 ? { output_compression: request.outputCompression } : {},
10705
+ ...params.background ? { background: params.background } : {},
10706
+ ...params.moderation ? { moderation: params.moderation } : {},
10707
+ ...request.action ? { action: request.action } : {}
10708
+ }
10709
+ ]
10675
10710
  },
10676
10711
  signal: request.signal
10677
10712
  });
@@ -10683,7 +10718,7 @@ async function generateImagesWithChatGptImageTool(request) {
10683
10718
  }
10684
10719
  for (const call of result.imageGenerationCalls) {
10685
10720
  images.push({
10686
- mimeType: "image/png",
10721
+ mimeType: outputMimeType,
10687
10722
  data: Buffer5.from(call.result, "base64")
10688
10723
  });
10689
10724
  }
@@ -10694,8 +10729,8 @@ async function generateImagesWithChatGptImageTool(request) {
10694
10729
  modelId: request.model,
10695
10730
  tokens: usage,
10696
10731
  responseImages: result.imageGenerationCalls.length,
10697
- imageSize: "1024x1024",
10698
- imageQuality: "medium"
10732
+ imageSize: params.size,
10733
+ imageQuality: params.quality
10699
10734
  });
10700
10735
  }
10701
10736
  }
@@ -10707,7 +10742,7 @@ async function generateImagesWithChatGptImageTool(request) {
10707
10742
  usage: totalUsage,
10708
10743
  costUsd,
10709
10744
  imageCount: images.length,
10710
- attempts: promptEntries.length * numImagesPerPrompt
10745
+ attempts: promptEntries.length * params.n
10711
10746
  });
10712
10747
  return images;
10713
10748
  } catch (error) {