@opencode/ai 0.0.0-dev-21920 → 0.0.0-dev-21922

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +22 -2
  2. package/dist/cache-policy.d.ts +4 -0
  3. package/dist/cache-policy.js +20 -6
  4. package/dist/protocols/alibaba-chat.d.ts +4 -0
  5. package/dist/protocols/alibaba-messages.d.ts +19 -19
  6. package/dist/protocols/anthropic-messages.d.ts +59 -59
  7. package/dist/protocols/anthropic-messages.js +3 -5
  8. package/dist/protocols/bedrock-converse.d.ts +12 -12
  9. package/dist/protocols/meta-messages.d.ts +19 -19
  10. package/dist/protocols/meta-messages.js +2 -1
  11. package/dist/protocols/openai-chat.d.ts +585 -1
  12. package/dist/protocols/openai-chat.js +7 -2
  13. package/dist/protocols/openai-compatible-chat.d.ts +4 -0
  14. package/dist/protocols/openai-responses.d.ts +24 -0
  15. package/dist/protocols/openai-responses.js +5 -0
  16. package/dist/protocols/utils/bedrock-cache.d.ts +2 -2
  17. package/dist/protocols/utils/bedrock-cache.js +7 -6
  18. package/dist/protocols/utils/cache.d.ts +14 -3
  19. package/dist/protocols/utils/cache.js +11 -4
  20. package/dist/protocols/venice-chat.d.ts +3 -0
  21. package/dist/protocols/venice-chat.js +1 -1
  22. package/dist/protocols/zai-chat.d.ts +4 -0
  23. package/dist/protocols/zai-messages.d.ts +19 -19
  24. package/dist/providers/alibaba.d.ts +23 -19
  25. package/dist/providers/amazon-bedrock-mantle.d.ts +23 -19
  26. package/dist/providers/amazon-bedrock.d.ts +4 -4
  27. package/dist/providers/anthropic-compatible.d.ts +19 -19
  28. package/dist/providers/anthropic.d.ts +19 -19
  29. package/dist/providers/azure.d.ts +12 -0
  30. package/dist/providers/baseten.d.ts +8 -0
  31. package/dist/providers/cerebras.d.ts +8 -0
  32. package/dist/providers/cloudflare-ai-gateway.d.ts +54 -38
  33. package/dist/providers/cloudflare-workers-ai.d.ts +8 -0
  34. package/dist/providers/cohere.d.ts +8 -0
  35. package/dist/providers/deepinfra.d.ts +8 -0
  36. package/dist/providers/deepseek.d.ts +8 -0
  37. package/dist/providers/digitalocean.d.ts +12 -0
  38. package/dist/providers/fireworks.d.ts +8 -0
  39. package/dist/providers/google-vertex-chat.d.ts +4 -0
  40. package/dist/providers/google-vertex-messages.d.ts +19 -19
  41. package/dist/providers/groq.d.ts +8 -0
  42. package/dist/providers/meta.d.ts +23 -19
  43. package/dist/providers/minimax.d.ts +23 -19
  44. package/dist/providers/moonshot.d.ts +23 -19
  45. package/dist/providers/openai-compatible.d.ts +4 -0
  46. package/dist/providers/openai.d.ts +8 -0
  47. package/dist/providers/openrouter.d.ts +16 -0
  48. package/dist/providers/togetherai.d.ts +8 -0
  49. package/dist/providers/venice.d.ts +3 -0
  50. package/dist/providers/xai.d.ts +4 -0
  51. package/dist/providers/zai-coding-plan.d.ts +23 -19
  52. package/dist/providers/zai.d.ts +4 -0
  53. package/dist/schema/messages.d.ts +2 -2
  54. package/dist/schema/options.d.ts +5 -3
  55. package/dist/schema/options.js +8 -3
  56. package/package.json +3 -3
@@ -273,6 +273,10 @@ export declare const bodyFields: {
273
273
  }>>;
274
274
  store: Schema.optional<Schema.Boolean>;
275
275
  prompt_cache_key: Schema.optional<Schema.String>;
276
+ prompt_cache_retention: Schema.optional<Schema.String>;
277
+ prompt_cache_options: Schema.optional<Schema.Struct<{
278
+ readonly ttl: Schema.optional<Schema.String>;
279
+ }>>;
276
280
  reasoning_effort: Schema.optional<Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>>;
277
281
  verbosity: Schema.optional<Schema.declare<import("../schema/options.js").OpenString<"high" | "low" | "medium">, import("../schema/options.js").OpenString<"high" | "low" | "medium">>>;
278
282
  service_tier: Schema.optional<Schema.declare<import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority">, import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority">>>;
@@ -407,6 +411,10 @@ declare const OpenAIChatBody: Schema.Struct<{
407
411
  }>>;
408
412
  store: Schema.optional<Schema.Boolean>;
409
413
  prompt_cache_key: Schema.optional<Schema.String>;
414
+ prompt_cache_retention: Schema.optional<Schema.String>;
415
+ prompt_cache_options: Schema.optional<Schema.Struct<{
416
+ readonly ttl: Schema.optional<Schema.String>;
417
+ }>>;
410
418
  reasoning_effort: Schema.optional<Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>>;
411
419
  verbosity: Schema.optional<Schema.declare<import("../schema/options.js").OpenString<"high" | "low" | "medium">, import("../schema/options.js").OpenString<"high" | "low" | "medium">>>;
412
420
  service_tier: Schema.optional<Schema.declare<import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority">, import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority">>>;
@@ -604,6 +612,427 @@ interface LoweringOptions {
604
612
  export declare const fromRequest: (request: LLMRequest<import("../schema/options.js").LanguageModel<{
605
613
  readonly [x: string]: unknown;
606
614
  }, import("../route/client.js").CompactionOperations | undefined>>, options?: LoweringOptions | undefined) => Effect.Effect<{
615
+ prompt_cache_retention?: undefined;
616
+ prompt_cache_options?: undefined;
617
+ store?: boolean | undefined;
618
+ prompt_cache_key?: string | undefined;
619
+ reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
620
+ verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
621
+ service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
622
+ parallel_tool_calls?: boolean | undefined;
623
+ metadata?: {
624
+ readonly [x: string]: string;
625
+ } | undefined;
626
+ safety_identifier?: string | undefined;
627
+ model: string & import("effect/Brand").Brand<"AI.ModelID">;
628
+ messages: ({
629
+ readonly role: "system";
630
+ readonly content: string | readonly ({
631
+ readonly type: "image_url";
632
+ readonly image_url: {
633
+ readonly url: string;
634
+ };
635
+ } | {
636
+ readonly type: "video_url";
637
+ readonly video_url: {
638
+ readonly url: string;
639
+ };
640
+ } | {
641
+ readonly type: "file";
642
+ readonly file: {
643
+ readonly filename: string;
644
+ readonly file_data: string;
645
+ };
646
+ } | {
647
+ readonly type: "text";
648
+ readonly text: string;
649
+ readonly cache_control?: {
650
+ readonly type: "ephemeral";
651
+ readonly ttl?: string | undefined;
652
+ } | undefined;
653
+ })[];
654
+ } | {
655
+ readonly role: "user";
656
+ readonly content: string | readonly ({
657
+ readonly type: "image_url";
658
+ readonly image_url: {
659
+ readonly url: string;
660
+ };
661
+ } | {
662
+ readonly type: "video_url";
663
+ readonly video_url: {
664
+ readonly url: string;
665
+ };
666
+ } | {
667
+ readonly type: "file";
668
+ readonly file: {
669
+ readonly filename: string;
670
+ readonly file_data: string;
671
+ };
672
+ } | {
673
+ readonly type: "text";
674
+ readonly text: string;
675
+ readonly cache_control?: {
676
+ readonly type: "ephemeral";
677
+ readonly ttl?: string | undefined;
678
+ } | undefined;
679
+ })[];
680
+ } | {
681
+ readonly role: "tool";
682
+ readonly tool_call_id: string;
683
+ readonly content: string | readonly {
684
+ readonly type: "text";
685
+ readonly text: string;
686
+ readonly cache_control?: {
687
+ readonly type: "ephemeral";
688
+ readonly ttl?: string | undefined;
689
+ } | undefined;
690
+ }[];
691
+ } | {
692
+ readonly [x: string]: unknown;
693
+ readonly role: "assistant";
694
+ readonly content: string | readonly {
695
+ readonly type: "text";
696
+ readonly text: string;
697
+ readonly cache_control?: {
698
+ readonly type: "ephemeral";
699
+ readonly ttl?: string | undefined;
700
+ } | undefined;
701
+ }[] | null;
702
+ readonly tool_calls?: readonly {
703
+ readonly id: string;
704
+ readonly type: "function";
705
+ readonly function: {
706
+ readonly name: string;
707
+ readonly arguments: string;
708
+ };
709
+ readonly extra_content?: {
710
+ readonly google: {
711
+ readonly thought_signature: string;
712
+ };
713
+ } | undefined;
714
+ }[] | undefined;
715
+ readonly reasoning_content?: string | undefined;
716
+ readonly reasoning?: string | undefined;
717
+ readonly reasoning_text?: string | undefined;
718
+ readonly reasoning_details?: unknown;
719
+ })[];
720
+ tools: {
721
+ readonly type: "function";
722
+ readonly function: {
723
+ readonly name: string;
724
+ readonly description: string;
725
+ readonly parameters: {
726
+ readonly [x: string]: unknown;
727
+ };
728
+ readonly strict?: boolean | undefined;
729
+ };
730
+ readonly cache_control?: {
731
+ readonly type: "ephemeral";
732
+ readonly ttl?: string | undefined;
733
+ } | undefined;
734
+ }[] | undefined;
735
+ tool_choice: "auto" | "none" | "required" | {
736
+ type: "function";
737
+ function: {
738
+ name: string;
739
+ };
740
+ } | undefined;
741
+ stream: true;
742
+ stream_options?: {
743
+ include_usage: boolean;
744
+ } | undefined;
745
+ tool_stream?: boolean | undefined;
746
+ max_completion_tokens: number | undefined;
747
+ temperature: number | undefined;
748
+ top_p: number | undefined;
749
+ frequency_penalty: number | undefined;
750
+ presence_penalty: number | undefined;
751
+ seed: number | undefined;
752
+ stop: readonly string[] | undefined;
753
+ } | {
754
+ prompt_cache_retention: string;
755
+ prompt_cache_options?: undefined;
756
+ store?: boolean | undefined;
757
+ prompt_cache_key?: string | undefined;
758
+ reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
759
+ verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
760
+ service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
761
+ parallel_tool_calls?: boolean | undefined;
762
+ metadata?: {
763
+ readonly [x: string]: string;
764
+ } | undefined;
765
+ safety_identifier?: string | undefined;
766
+ model: string & import("effect/Brand").Brand<"AI.ModelID">;
767
+ messages: ({
768
+ readonly role: "system";
769
+ readonly content: string | readonly ({
770
+ readonly type: "image_url";
771
+ readonly image_url: {
772
+ readonly url: string;
773
+ };
774
+ } | {
775
+ readonly type: "video_url";
776
+ readonly video_url: {
777
+ readonly url: string;
778
+ };
779
+ } | {
780
+ readonly type: "file";
781
+ readonly file: {
782
+ readonly filename: string;
783
+ readonly file_data: string;
784
+ };
785
+ } | {
786
+ readonly type: "text";
787
+ readonly text: string;
788
+ readonly cache_control?: {
789
+ readonly type: "ephemeral";
790
+ readonly ttl?: string | undefined;
791
+ } | undefined;
792
+ })[];
793
+ } | {
794
+ readonly role: "user";
795
+ readonly content: string | readonly ({
796
+ readonly type: "image_url";
797
+ readonly image_url: {
798
+ readonly url: string;
799
+ };
800
+ } | {
801
+ readonly type: "video_url";
802
+ readonly video_url: {
803
+ readonly url: string;
804
+ };
805
+ } | {
806
+ readonly type: "file";
807
+ readonly file: {
808
+ readonly filename: string;
809
+ readonly file_data: string;
810
+ };
811
+ } | {
812
+ readonly type: "text";
813
+ readonly text: string;
814
+ readonly cache_control?: {
815
+ readonly type: "ephemeral";
816
+ readonly ttl?: string | undefined;
817
+ } | undefined;
818
+ })[];
819
+ } | {
820
+ readonly role: "tool";
821
+ readonly tool_call_id: string;
822
+ readonly content: string | readonly {
823
+ readonly type: "text";
824
+ readonly text: string;
825
+ readonly cache_control?: {
826
+ readonly type: "ephemeral";
827
+ readonly ttl?: string | undefined;
828
+ } | undefined;
829
+ }[];
830
+ } | {
831
+ readonly [x: string]: unknown;
832
+ readonly role: "assistant";
833
+ readonly content: string | readonly {
834
+ readonly type: "text";
835
+ readonly text: string;
836
+ readonly cache_control?: {
837
+ readonly type: "ephemeral";
838
+ readonly ttl?: string | undefined;
839
+ } | undefined;
840
+ }[] | null;
841
+ readonly tool_calls?: readonly {
842
+ readonly id: string;
843
+ readonly type: "function";
844
+ readonly function: {
845
+ readonly name: string;
846
+ readonly arguments: string;
847
+ };
848
+ readonly extra_content?: {
849
+ readonly google: {
850
+ readonly thought_signature: string;
851
+ };
852
+ } | undefined;
853
+ }[] | undefined;
854
+ readonly reasoning_content?: string | undefined;
855
+ readonly reasoning?: string | undefined;
856
+ readonly reasoning_text?: string | undefined;
857
+ readonly reasoning_details?: unknown;
858
+ })[];
859
+ tools: {
860
+ readonly type: "function";
861
+ readonly function: {
862
+ readonly name: string;
863
+ readonly description: string;
864
+ readonly parameters: {
865
+ readonly [x: string]: unknown;
866
+ };
867
+ readonly strict?: boolean | undefined;
868
+ };
869
+ readonly cache_control?: {
870
+ readonly type: "ephemeral";
871
+ readonly ttl?: string | undefined;
872
+ } | undefined;
873
+ }[] | undefined;
874
+ tool_choice: "auto" | "none" | "required" | {
875
+ type: "function";
876
+ function: {
877
+ name: string;
878
+ };
879
+ } | undefined;
880
+ stream: true;
881
+ stream_options?: {
882
+ include_usage: boolean;
883
+ } | undefined;
884
+ tool_stream?: boolean | undefined;
885
+ max_completion_tokens: number | undefined;
886
+ temperature: number | undefined;
887
+ top_p: number | undefined;
888
+ frequency_penalty: number | undefined;
889
+ presence_penalty: number | undefined;
890
+ seed: number | undefined;
891
+ stop: readonly string[] | undefined;
892
+ } | {
893
+ prompt_cache_retention?: undefined;
894
+ prompt_cache_options: {
895
+ ttl: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s`;
896
+ };
897
+ store?: boolean | undefined;
898
+ prompt_cache_key?: string | undefined;
899
+ reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
900
+ verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
901
+ service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
902
+ parallel_tool_calls?: boolean | undefined;
903
+ metadata?: {
904
+ readonly [x: string]: string;
905
+ } | undefined;
906
+ safety_identifier?: string | undefined;
907
+ model: string & import("effect/Brand").Brand<"AI.ModelID">;
908
+ messages: ({
909
+ readonly role: "system";
910
+ readonly content: string | readonly ({
911
+ readonly type: "image_url";
912
+ readonly image_url: {
913
+ readonly url: string;
914
+ };
915
+ } | {
916
+ readonly type: "video_url";
917
+ readonly video_url: {
918
+ readonly url: string;
919
+ };
920
+ } | {
921
+ readonly type: "file";
922
+ readonly file: {
923
+ readonly filename: string;
924
+ readonly file_data: string;
925
+ };
926
+ } | {
927
+ readonly type: "text";
928
+ readonly text: string;
929
+ readonly cache_control?: {
930
+ readonly type: "ephemeral";
931
+ readonly ttl?: string | undefined;
932
+ } | undefined;
933
+ })[];
934
+ } | {
935
+ readonly role: "user";
936
+ readonly content: string | readonly ({
937
+ readonly type: "image_url";
938
+ readonly image_url: {
939
+ readonly url: string;
940
+ };
941
+ } | {
942
+ readonly type: "video_url";
943
+ readonly video_url: {
944
+ readonly url: string;
945
+ };
946
+ } | {
947
+ readonly type: "file";
948
+ readonly file: {
949
+ readonly filename: string;
950
+ readonly file_data: string;
951
+ };
952
+ } | {
953
+ readonly type: "text";
954
+ readonly text: string;
955
+ readonly cache_control?: {
956
+ readonly type: "ephemeral";
957
+ readonly ttl?: string | undefined;
958
+ } | undefined;
959
+ })[];
960
+ } | {
961
+ readonly role: "tool";
962
+ readonly tool_call_id: string;
963
+ readonly content: string | readonly {
964
+ readonly type: "text";
965
+ readonly text: string;
966
+ readonly cache_control?: {
967
+ readonly type: "ephemeral";
968
+ readonly ttl?: string | undefined;
969
+ } | undefined;
970
+ }[];
971
+ } | {
972
+ readonly [x: string]: unknown;
973
+ readonly role: "assistant";
974
+ readonly content: string | readonly {
975
+ readonly type: "text";
976
+ readonly text: string;
977
+ readonly cache_control?: {
978
+ readonly type: "ephemeral";
979
+ readonly ttl?: string | undefined;
980
+ } | undefined;
981
+ }[] | null;
982
+ readonly tool_calls?: readonly {
983
+ readonly id: string;
984
+ readonly type: "function";
985
+ readonly function: {
986
+ readonly name: string;
987
+ readonly arguments: string;
988
+ };
989
+ readonly extra_content?: {
990
+ readonly google: {
991
+ readonly thought_signature: string;
992
+ };
993
+ } | undefined;
994
+ }[] | undefined;
995
+ readonly reasoning_content?: string | undefined;
996
+ readonly reasoning?: string | undefined;
997
+ readonly reasoning_text?: string | undefined;
998
+ readonly reasoning_details?: unknown;
999
+ })[];
1000
+ tools: {
1001
+ readonly type: "function";
1002
+ readonly function: {
1003
+ readonly name: string;
1004
+ readonly description: string;
1005
+ readonly parameters: {
1006
+ readonly [x: string]: unknown;
1007
+ };
1008
+ readonly strict?: boolean | undefined;
1009
+ };
1010
+ readonly cache_control?: {
1011
+ readonly type: "ephemeral";
1012
+ readonly ttl?: string | undefined;
1013
+ } | undefined;
1014
+ }[] | undefined;
1015
+ tool_choice: "auto" | "none" | "required" | {
1016
+ type: "function";
1017
+ function: {
1018
+ name: string;
1019
+ };
1020
+ } | undefined;
1021
+ stream: true;
1022
+ stream_options?: {
1023
+ include_usage: boolean;
1024
+ } | undefined;
1025
+ tool_stream?: boolean | undefined;
1026
+ max_completion_tokens: number | undefined;
1027
+ temperature: number | undefined;
1028
+ top_p: number | undefined;
1029
+ frequency_penalty: number | undefined;
1030
+ presence_penalty: number | undefined;
1031
+ seed: number | undefined;
1032
+ stop: readonly string[] | undefined;
1033
+ } | {
1034
+ prompt_cache_retention?: undefined;
1035
+ prompt_cache_options?: undefined;
607
1036
  store?: boolean | undefined;
608
1037
  prompt_cache_key?: string | undefined;
609
1038
  reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
@@ -733,7 +1162,146 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
733
1162
  include_usage: boolean;
734
1163
  } | undefined;
735
1164
  tool_stream?: boolean | undefined;
736
- max_completion_tokens: number | undefined;
1165
+ max_tokens: number | undefined;
1166
+ temperature: number | undefined;
1167
+ top_p: number | undefined;
1168
+ frequency_penalty: number | undefined;
1169
+ presence_penalty: number | undefined;
1170
+ seed: number | undefined;
1171
+ stop: readonly string[] | undefined;
1172
+ } | {
1173
+ prompt_cache_retention: string;
1174
+ prompt_cache_options?: undefined;
1175
+ store?: boolean | undefined;
1176
+ prompt_cache_key?: string | undefined;
1177
+ reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
1178
+ verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
1179
+ service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
1180
+ parallel_tool_calls?: boolean | undefined;
1181
+ metadata?: {
1182
+ readonly [x: string]: string;
1183
+ } | undefined;
1184
+ safety_identifier?: string | undefined;
1185
+ model: string & import("effect/Brand").Brand<"AI.ModelID">;
1186
+ messages: ({
1187
+ readonly role: "system";
1188
+ readonly content: string | readonly ({
1189
+ readonly type: "image_url";
1190
+ readonly image_url: {
1191
+ readonly url: string;
1192
+ };
1193
+ } | {
1194
+ readonly type: "video_url";
1195
+ readonly video_url: {
1196
+ readonly url: string;
1197
+ };
1198
+ } | {
1199
+ readonly type: "file";
1200
+ readonly file: {
1201
+ readonly filename: string;
1202
+ readonly file_data: string;
1203
+ };
1204
+ } | {
1205
+ readonly type: "text";
1206
+ readonly text: string;
1207
+ readonly cache_control?: {
1208
+ readonly type: "ephemeral";
1209
+ readonly ttl?: string | undefined;
1210
+ } | undefined;
1211
+ })[];
1212
+ } | {
1213
+ readonly role: "user";
1214
+ readonly content: string | readonly ({
1215
+ readonly type: "image_url";
1216
+ readonly image_url: {
1217
+ readonly url: string;
1218
+ };
1219
+ } | {
1220
+ readonly type: "video_url";
1221
+ readonly video_url: {
1222
+ readonly url: string;
1223
+ };
1224
+ } | {
1225
+ readonly type: "file";
1226
+ readonly file: {
1227
+ readonly filename: string;
1228
+ readonly file_data: string;
1229
+ };
1230
+ } | {
1231
+ readonly type: "text";
1232
+ readonly text: string;
1233
+ readonly cache_control?: {
1234
+ readonly type: "ephemeral";
1235
+ readonly ttl?: string | undefined;
1236
+ } | undefined;
1237
+ })[];
1238
+ } | {
1239
+ readonly role: "tool";
1240
+ readonly tool_call_id: string;
1241
+ readonly content: string | readonly {
1242
+ readonly type: "text";
1243
+ readonly text: string;
1244
+ readonly cache_control?: {
1245
+ readonly type: "ephemeral";
1246
+ readonly ttl?: string | undefined;
1247
+ } | undefined;
1248
+ }[];
1249
+ } | {
1250
+ readonly [x: string]: unknown;
1251
+ readonly role: "assistant";
1252
+ readonly content: string | readonly {
1253
+ readonly type: "text";
1254
+ readonly text: string;
1255
+ readonly cache_control?: {
1256
+ readonly type: "ephemeral";
1257
+ readonly ttl?: string | undefined;
1258
+ } | undefined;
1259
+ }[] | null;
1260
+ readonly tool_calls?: readonly {
1261
+ readonly id: string;
1262
+ readonly type: "function";
1263
+ readonly function: {
1264
+ readonly name: string;
1265
+ readonly arguments: string;
1266
+ };
1267
+ readonly extra_content?: {
1268
+ readonly google: {
1269
+ readonly thought_signature: string;
1270
+ };
1271
+ } | undefined;
1272
+ }[] | undefined;
1273
+ readonly reasoning_content?: string | undefined;
1274
+ readonly reasoning?: string | undefined;
1275
+ readonly reasoning_text?: string | undefined;
1276
+ readonly reasoning_details?: unknown;
1277
+ })[];
1278
+ tools: {
1279
+ readonly type: "function";
1280
+ readonly function: {
1281
+ readonly name: string;
1282
+ readonly description: string;
1283
+ readonly parameters: {
1284
+ readonly [x: string]: unknown;
1285
+ };
1286
+ readonly strict?: boolean | undefined;
1287
+ };
1288
+ readonly cache_control?: {
1289
+ readonly type: "ephemeral";
1290
+ readonly ttl?: string | undefined;
1291
+ } | undefined;
1292
+ }[] | undefined;
1293
+ tool_choice: "auto" | "none" | "required" | {
1294
+ type: "function";
1295
+ function: {
1296
+ name: string;
1297
+ };
1298
+ } | undefined;
1299
+ stream: true;
1300
+ stream_options?: {
1301
+ include_usage: boolean;
1302
+ } | undefined;
1303
+ tool_stream?: boolean | undefined;
1304
+ max_tokens: number | undefined;
737
1305
  temperature: number | undefined;
738
1306
  top_p: number | undefined;
739
1307
  frequency_penalty: number | undefined;
@@ -741,6 +1309,10 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
741
1309
  seed: number | undefined;
742
1310
  stop: readonly string[] | undefined;
743
1311
  } | {
1312
+ prompt_cache_retention?: undefined;
1313
+ prompt_cache_options: {
1314
+ ttl: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s`;
1315
+ };
744
1316
  store?: boolean | undefined;
745
1317
  prompt_cache_key?: string | undefined;
746
1318
  reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
@@ -1221,6 +1793,10 @@ export declare const protocol: Protocol<{
1221
1793
  } | undefined;
1222
1794
  readonly store?: boolean | undefined;
1223
1795
  readonly prompt_cache_key?: string | undefined;
1796
+ readonly prompt_cache_retention?: string | undefined;
1797
+ readonly prompt_cache_options?: {
1798
+ readonly ttl?: string | undefined;
1799
+ } | undefined;
1224
1800
  readonly reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
1225
1801
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
1226
1802
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -1433,6 +2009,10 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
1433
2009
  } | undefined;
1434
2010
  readonly store?: boolean | undefined;
1435
2011
  readonly prompt_cache_key?: string | undefined;
2012
+ readonly prompt_cache_retention?: string | undefined;
2013
+ readonly prompt_cache_options?: {
2014
+ readonly ttl?: string | undefined;
2015
+ } | undefined;
1436
2016
  readonly reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
1437
2017
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
1438
2018
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -1572,6 +2152,10 @@ export declare const route: Route<{
1572
2152
  } | undefined;
1573
2153
  readonly store?: boolean | undefined;
1574
2154
  readonly prompt_cache_key?: string | undefined;
2155
+ readonly prompt_cache_retention?: string | undefined;
2156
+ readonly prompt_cache_options?: {
2157
+ readonly ttl?: string | undefined;
2158
+ } | undefined;
1575
2159
  readonly reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
1576
2160
  readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
1577
2161
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
@@ -9,7 +9,8 @@ import { Protocol } from "../route/protocol.js";
9
9
  import { AIError, AIErrorReason, InvalidProviderOutputError, LLMEvent, ProviderInternalError, UnknownProviderError, Usage, } from "../schema/index.js";
10
10
  import { classifyProviderFailure } from "../provider-error.js";
11
11
  import { isRecord, JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js";
12
- import { cacheControl } from "./utils/cache.js";
12
+ import { placesMarkers, requestTTL } from "../cache-policy.js";
13
+ import * as Cache from "./utils/cache.js";
13
14
  import { resolveParallelToolCalls } from "./open-responses.js";
14
15
  import { OpenResponsesOptions } from "./utils/open-responses-options.js";
15
16
  import { Lifecycle } from "./utils/lifecycle.js";
@@ -140,6 +141,8 @@ export const bodyFields = {
140
141
  stream_options: Schema.optional(Schema.Struct({ include_usage: Schema.Boolean })),
141
142
  store: Schema.optional(Schema.Boolean),
142
143
  prompt_cache_key: Schema.optional(Schema.String),
144
+ prompt_cache_retention: Schema.optional(Schema.String),
145
+ prompt_cache_options: Schema.optional(Schema.Struct({ ttl: Schema.optional(Schema.String) })),
143
146
  reasoning_effort: Schema.optional(OpenResponsesOptions.ReasoningEffort),
144
147
  verbosity: Schema.optional(OpenResponsesOptions.TextVerbositySchema),
145
148
  service_tier: Schema.optional(OpenResponsesOptions.ServiceTierSchema),
@@ -610,6 +613,8 @@ const lowerOptions = (request, supportsStore, hasActiveTools) => {
610
613
  return {
611
614
  ...(supportsStore ? { store: options.store ?? false } : {}),
612
615
  ...(cacheKey ? { prompt_cache_key: cacheKey } : {}),
616
+ // Inline markers carry the lifetime when the policy places them.
617
+ ...(placesMarkers(request) ? {} : Cache.openAIRequestTTL(requestTTL(request))),
613
618
  ...(options.reasoningEffort ? { reasoning_effort: options.reasoningEffort } : {}),
614
619
  ...(options.textVerbosity ? { verbosity: options.textVerbosity } : {}),
615
620
  ...(options.serviceTier ? { service_tier: options.serviceTier } : {}),
@@ -661,7 +666,7 @@ export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (reques
661
666
  };
662
667
  });
663
668
  // Provider wrappers that pass their own marker writer keep it; otherwise a declared cache format adds one.
664
- const declaredCacheControl = (request) => request.model.compatibility?.cacheFormat === undefined ? undefined : cacheControl();
669
+ const declaredCacheControl = (request) => request.model.compatibility?.cacheFormat === undefined ? undefined : Cache.cacheControl();
665
670
  // =============================================================================
666
671
  // Stream Parsing
667
672
  // =============================================================================
@@ -127,6 +127,10 @@ export declare const route: Route<{
127
127
  } | undefined;
128
128
  readonly store?: boolean | undefined;
129
129
  readonly prompt_cache_key?: string | undefined;
130
+ readonly prompt_cache_retention?: string | undefined;
131
+ readonly prompt_cache_options?: {
132
+ readonly ttl?: string | undefined;
133
+ } | undefined;
130
134
  readonly reasoning_effort?: import("../effect.js").ReasoningEffort | undefined;
131
135
  readonly verbosity?: import("../effect.js").OpenString<"high" | "low" | "medium"> | undefined;
132
136
  readonly service_tier?: import("../effect.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;