@nexface/agent 0.1.15-alpha.1 → 0.1.15-alpha.3
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/agent.js +887 -297
- package/dist/browser-policy/gpt.js +36 -12
- package/dist/browser-policy/jev.js +21 -9
- package/dist/browser-policy/response-error.js +4 -2
- package/dist/browser-policy/shared.js +49 -21
- package/dist/browser-prompt.generated.js +0 -1
- package/dist/browser-prompt.js +0 -1
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +3 -4
- package/dist/history-compaction.js +47 -26
- package/dist/history-version.js +11 -4
- package/dist/index.js +0 -1
- package/dist/model/binding.js +0 -1
- package/dist/model/error.js +0 -1
- package/dist/model/internal-adapter.js +1 -2
- package/dist/model/types.js +0 -1
- package/dist/models/3.js +5553 -0
- package/dist/models/3e.js +4 -0
- package/dist/models/6.js +506 -0
- package/dist/models/anthropic-messages.js +5 -20
- package/dist/models/anthropic-messages~1.js +5629 -0
- package/dist/models/deferred-tools.js +28 -0
- package/dist/models/error-body.js +64 -0
- package/dist/models/google-generative-ai.js +4 -19
- package/dist/models/google-generative-ai~1.js +18305 -0
- package/dist/models/google-generative-ai~1.js.LICENSE.txt +5 -0
- package/dist/models/{39.js → k.js} +168 -336
- package/dist/models/openai-completions.js +3 -10
- package/dist/models/openai-completions~1.js +987 -0
- package/dist/models/openai-responses.js +3 -10
- package/dist/models/openai-responses~1.js +848 -0
- package/dist/models/rslib-runtime.js +32 -56
- package/dist/models/v.js +346 -0
- package/dist/page-decision.js +197 -59
- package/dist/page-decisions/gpt.js +0 -1
- package/dist/page-decisions/jev.js +0 -1
- package/dist/page-decisions/shared.js +26 -9
- package/dist/page-diagnostics.js +8 -3
- package/dist/page-observation.js +11 -6
- package/dist/request.js +169 -41
- package/dist/shared/definition.js +2 -3
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.js +0 -1
- package/dist/shared/page-protocol.js +0 -1
- package/dist/shared/page-tools.js +0 -1
- package/dist/shared/runtime-controller.d.ts +1 -0
- package/dist/shared/runtime-controller.js +0 -1
- package/dist/shared/runtime-execution.js +0 -1
- package/dist/shared/schema.js +45 -19
- package/dist/tool-catalog.js +23 -25
- package/dist/tool-result.js +7 -3
- package/dist/types.js +0 -1
- package/package.json +6 -2
- package/dist/agent.js.map +0 -1
- package/dist/browser-policy/gpt.js.map +0 -1
- package/dist/browser-policy/jev.js.map +0 -1
- package/dist/browser-policy/response-error.js.map +0 -1
- package/dist/browser-policy/shared.js.map +0 -1
- package/dist/browser-prompt.generated.js.map +0 -1
- package/dist/browser-prompt.js.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/history-compaction.js.map +0 -1
- package/dist/history-version.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/model/binding.js.map +0 -1
- package/dist/model/error.js.map +0 -1
- package/dist/model/internal-adapter.js.map +0 -1
- package/dist/model/types.js.map +0 -1
- package/dist/models/851.js +0 -10
- package/dist/models/_chunks/360-7e580bb2.js +0 -1189
- package/dist/models/_chunks/474-e1813138.js +0 -8304
- package/dist/models/_chunks/86-c0c5ac98.js +0 -453
- package/dist/models/_chunks/anthropic-messages~1-d35e3e7d.js +0 -8057
- package/dist/models/_chunks/deferred-tools-90f3c977.js +0 -37
- package/dist/models/_chunks/error-body-8bee35c2.js +0 -134
- package/dist/models/_chunks/google-generative-ai~1-2ba71457.js +0 -22104
- package/dist/models/_chunks/openai-completions~1-b340f0e0.js +0 -1285
- package/dist/models/_chunks/openai-responses~1-b53c65c2.js +0 -958
- package/dist/page-decision.js.map +0 -1
- package/dist/page-decisions/gpt.js.map +0 -1
- package/dist/page-decisions/jev.js.map +0 -1
- package/dist/page-decisions/shared.js.map +0 -1
- package/dist/page-diagnostics.js.map +0 -1
- package/dist/page-observation.js.map +0 -1
- package/dist/request.js.map +0 -1
- package/dist/shared/definition.js.map +0 -1
- package/dist/shared/errors.js.map +0 -1
- package/dist/shared/page-protocol.js.map +0 -1
- package/dist/shared/page-tools.js.map +0 -1
- package/dist/shared/runtime-controller.js.map +0 -1
- package/dist/shared/runtime-execution.js.map +0 -1
- package/dist/shared/schema.js.map +0 -1
- package/dist/tool-catalog.js.map +0 -1
- package/dist/tool-result.js.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { flattenModelCatalog } from "./k.js";
|
|
2
|
+
var openai_namespaceObject = /*#__PURE__*/ JSON.parse('{"openai-responses":{"gpt-4":{"id":"gpt-4","name":"GPT-4","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text"],"cost":{"input":30,"output":60,"cacheRead":0,"cacheWrite":0},"contextWindow":8192,"maxTokens":8192,"compat":{"supportsStrictMode":true}},"gpt-4-turbo":{"id":"gpt-4-turbo","name":"GPT-4 Turbo","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":10,"output":30,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":4096,"compat":{"supportsStrictMode":true}},"gpt-4.1":{"id":"gpt-4.1","name":"GPT-4.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2,"output":8,"cacheRead":0.5,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true}},"gpt-4.1-mini":{"id":"gpt-4.1-mini","name":"GPT-4.1 mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.4,"output":1.6,"cacheRead":0.1,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true}},"gpt-4.1-nano":{"id":"gpt-4.1-nano","name":"GPT-4.1 nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.1,"output":0.4,"cacheRead":0.025,"cacheWrite":0},"contextWindow":1047576,"maxTokens":32768,"compat":{"supportsStrictMode":true}},"gpt-4o":{"id":"gpt-4o","name":"GPT-4o","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true}},"gpt-4o-2024-05-13":{"id":"gpt-4o-2024-05-13","name":"GPT-4o (2024-05-13)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":15,"cacheRead":0,"cacheWrite":0},"contextWindow":128000,"maxTokens":4096,"compat":{"supportsStrictMode":true}},"gpt-4o-2024-08-06":{"id":"gpt-4o-2024-08-06","name":"GPT-4o (2024-08-06)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true}},"gpt-4o-2024-11-20":{"id":"gpt-4o-2024-11-20","name":"GPT-4o (2024-11-20)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":2.5,"output":10,"cacheRead":1.25,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true}},"gpt-4o-mini":{"id":"gpt-4o-mini","name":"GPT-4o mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":0.15,"output":0.6,"cacheRead":0.075,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"compat":{"supportsStrictMode":true}},"gpt-5":{"id":"gpt-5","name":"GPT-5","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5-chat-latest":{"id":"gpt-5-chat-latest","name":"GPT-5 Chat Latest","api":"openai-responses","baseUrl":"https://api.openai.com/v1","provider":"openai","reasoning":false,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5-mini":{"id":"gpt-5-mini","name":"GPT-5 Mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.25,"output":2,"cacheRead":0.025,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5-nano":{"id":"gpt-5-nano","name":"GPT-5 Nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.05,"output":0.4,"cacheRead":0.005,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5-pro":{"id":"gpt-5-pro","name":"GPT-5 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":120,"cacheRead":0,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":null,"high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.1":{"id":"gpt-5.1","name":"GPT-5.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.25,"output":10,"cacheRead":0.125,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.2":{"id":"gpt-5.2","name":"GPT-5.2","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.2-chat-latest":{"id":"gpt-5.2-chat-latest","name":"GPT-5.2 Chat","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":null,"xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.2-pro":{"id":"gpt-5.2-pro","name":"GPT-5.2 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":21,"output":168,"cacheRead":0,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.3-chat-latest":{"id":"gpt-5.3-chat-latest","name":"GPT-5.3 Chat (latest)","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":false,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":16384,"thinkingLevelMap":{"off":null,"xhigh":"xhigh"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.3-codex":{"id":"gpt-5.3-codex","name":"GPT-5.3 Codex","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.3-codex-spark":{"id":"gpt-5.3-codex-spark","name":"GPT-5.3 Codex Spark","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.75,"output":14,"cacheRead":0.175,"cacheWrite":0},"contextWindow":128000,"maxTokens":32000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.4":{"id":"gpt-5.4","name":"GPT-5.4","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2.5,"output":15,"cacheRead":0.25,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":5,"output":22.5,"cacheRead":0.5,"cacheWrite":0}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true}},"gpt-5.4-mini":{"id":"gpt-5.4-mini","name":"GPT-5.4 mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.75,"output":4.5,"cacheRead":0.075,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true}},"gpt-5.4-nano":{"id":"gpt-5.4-nano","name":"GPT-5.4 nano","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.2,"output":1.25,"cacheRead":0.02,"cacheWrite":0},"contextWindow":400000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.4-pro":{"id":"gpt-5.4-pro","name":"GPT-5.4 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":30,"output":180,"cacheRead":0,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":60,"output":270,"cacheRead":0,"cacheWrite":0}]},"contextWindow":1050000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true}},"gpt-5.5":{"id":"gpt-5.5","name":"GPT-5.5","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":30,"cacheRead":0.5,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":10,"output":45,"cacheRead":1,"cacheWrite":0}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true}},"gpt-5.5-pro":{"id":"gpt-5.5-pro","name":"GPT-5.5 Pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":30,"output":180,"cacheRead":0,"cacheWrite":0,"tiers":[{"inputTokensAbove":272000,"input":60,"output":270,"cacheRead":0,"cacheWrite":0}]},"contextWindow":1050000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"minimal":null,"low":null,"medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true}},"gpt-5.6-luna":{"id":"gpt-5.6-luna","name":"GPT-5.6 Luna","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":0.2,"output":1.2,"cacheRead":0.02,"cacheWrite":0.25,"tiers":[{"inputTokensAbove":272000,"input":0.4,"output":1.8,"cacheRead":0.04,"cacheWrite":0.5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true,"supportsExplicitPromptCacheMode":true}},"gpt-5.6-sol":{"id":"gpt-5.6-sol","name":"GPT-5.6 Sol","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":30,"cacheRead":0.5,"cacheWrite":6.25,"tiers":[{"inputTokensAbove":272000,"input":10,"output":45,"cacheRead":1,"cacheWrite":12.5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true,"supportsExplicitPromptCacheMode":true}},"gpt-5.6-terra":{"id":"gpt-5.6-terra","name":"GPT-5.6 Terra","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":12,"cacheRead":0.2,"cacheWrite":2.5,"tiers":[{"inputTokensAbove":272000,"input":4,"output":18,"cacheRead":0.4,"cacheWrite":5}]},"contextWindow":272000,"maxTokens":128000,"thinkingLevelMap":{"off":"none","minimal":null,"low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":"max"},"compat":{"supportsStrictMode":true,"supportsOpenAIGrammarTools":true,"supportsToolSearch":true,"supportsExplicitPromptCacheMode":true}},"gpt-realtime-2.1":{"id":"gpt-realtime-2.1","name":"GPT-Realtime-2.1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":24,"cacheRead":0.4,"cacheWrite":0},"contextWindow":128000,"maxTokens":32000,"thinkingLevelMap":{"off":null,"minimal":"minimal","low":"low","medium":"medium","high":"high","xhigh":"xhigh","max":null},"compat":{"supportsStrictMode":true}},"o1":{"id":"o1","name":"o1","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":60,"cacheRead":7.5,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}},"o1-pro":{"id":"o1-pro","name":"o1-pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":150,"output":600,"cacheRead":0,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}},"o3":{"id":"o3","name":"o3","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":8,"cacheRead":0.5,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}},"o3-mini":{"id":"o3-mini","name":"o3-mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text"],"cost":{"input":1.1,"output":4.4,"cacheRead":0.55,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}},"o3-pro":{"id":"o3-pro","name":"o3-pro","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":20,"output":80,"cacheRead":0,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}},"o4-mini":{"id":"o4-mini","name":"o4-mini","api":"openai-responses","provider":"openai","baseUrl":"https://api.openai.com/v1","reasoning":true,"input":["text","image"],"cost":{"input":1.1,"output":4.4,"cacheRead":0.275,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000,"thinkingLevelMap":{"off":null,"minimal":null,"low":"low","medium":"medium","high":"high","xhigh":null,"max":null},"compat":{"supportsStrictMode":true}}}}');
|
|
3
|
+
const OPENAI_MODELS = flattenModelCatalog("openai", openai_namespaceObject);
|
|
4
|
+
export { OPENAI_MODELS };
|
package/dist/models/6.js
ADDED
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
function calculateCost(model, usage) {
|
|
2
|
+
const inputTokens = usage.input + usage.cacheRead + usage.cacheWrite;
|
|
3
|
+
let rates = model.cost;
|
|
4
|
+
let matchedThreshold = -1;
|
|
5
|
+
for (const tier of model.cost.tiers ?? [])if (inputTokens > tier.inputTokensAbove && tier.inputTokensAbove > matchedThreshold) {
|
|
6
|
+
rates = tier;
|
|
7
|
+
matchedThreshold = tier.inputTokensAbove;
|
|
8
|
+
}
|
|
9
|
+
const longWrite = usage.cacheWrite1h ?? 0;
|
|
10
|
+
const shortWrite = usage.cacheWrite - longWrite;
|
|
11
|
+
usage.cost.input = rates.input / 1000000 * usage.input;
|
|
12
|
+
usage.cost.output = rates.output / 1000000 * usage.output;
|
|
13
|
+
usage.cost.cacheRead = rates.cacheRead / 1000000 * usage.cacheRead;
|
|
14
|
+
usage.cost.cacheWrite = (rates.cacheWrite * shortWrite + 2 * rates.input * longWrite) / 1000000;
|
|
15
|
+
usage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;
|
|
16
|
+
return usage.cost;
|
|
17
|
+
}
|
|
18
|
+
const EXTENDED_THINKING_LEVELS = [
|
|
19
|
+
"off",
|
|
20
|
+
"minimal",
|
|
21
|
+
"low",
|
|
22
|
+
"medium",
|
|
23
|
+
"high",
|
|
24
|
+
"xhigh",
|
|
25
|
+
"max"
|
|
26
|
+
];
|
|
27
|
+
function getSupportedThinkingLevels(model) {
|
|
28
|
+
if (!model.reasoning) return [
|
|
29
|
+
"off"
|
|
30
|
+
];
|
|
31
|
+
return EXTENDED_THINKING_LEVELS.filter((level)=>{
|
|
32
|
+
const mapped = model.thinkingLevelMap?.[level];
|
|
33
|
+
if (null === mapped) return false;
|
|
34
|
+
if ("xhigh" === level || "max" === level) return void 0 !== mapped;
|
|
35
|
+
return true;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function clampThinkingLevel(model, level) {
|
|
39
|
+
const availableLevels = getSupportedThinkingLevels(model);
|
|
40
|
+
if (availableLevels.includes(level)) return level;
|
|
41
|
+
const requestedIndex = EXTENDED_THINKING_LEVELS.indexOf(level);
|
|
42
|
+
if (-1 === requestedIndex) return availableLevels[0] ?? "off";
|
|
43
|
+
for(let i = requestedIndex; i < EXTENDED_THINKING_LEVELS.length; i++){
|
|
44
|
+
const candidate = EXTENDED_THINKING_LEVELS[i];
|
|
45
|
+
if (availableLevels.includes(candidate)) return candidate;
|
|
46
|
+
}
|
|
47
|
+
for(let i = requestedIndex - 1; i >= 0; i--){
|
|
48
|
+
const candidate = EXTENDED_THINKING_LEVELS[i];
|
|
49
|
+
if (availableLevels.includes(candidate)) return candidate;
|
|
50
|
+
}
|
|
51
|
+
return availableLevels[0] ?? "off";
|
|
52
|
+
}
|
|
53
|
+
function headersToRecord(headers) {
|
|
54
|
+
const result = {};
|
|
55
|
+
for (const [key, value] of headers.entries())result[key] = value;
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
function providerHeadersToRecord(headers) {
|
|
59
|
+
if (!headers) return;
|
|
60
|
+
const result = {};
|
|
61
|
+
for (const [key, value] of Object.entries(headers))if (null !== value) result[key] = value;
|
|
62
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
63
|
+
}
|
|
64
|
+
const DEFAULT_MAX_RETRY_DELAY_MS = 60_000;
|
|
65
|
+
function isProviderError(error) {
|
|
66
|
+
if (!(error instanceof Error) || !("status" in error) || !("headers" in error)) return false;
|
|
67
|
+
return (void 0 === error.status || "number" == typeof error.status) && (void 0 === error.headers || error.headers instanceof Headers);
|
|
68
|
+
}
|
|
69
|
+
function isRetryableProviderError(error) {
|
|
70
|
+
const shouldRetry = error.headers?.get("x-should-retry");
|
|
71
|
+
if ("true" === shouldRetry) return true;
|
|
72
|
+
if ("false" === shouldRetry) return false;
|
|
73
|
+
if (void 0 === error.status) return true;
|
|
74
|
+
return 408 === error.status || 409 === error.status || 429 === error.status || "number" == typeof error.status && error.status >= 500;
|
|
75
|
+
}
|
|
76
|
+
function validateServerRetryDelayMs(delayMs, maxRetryDelayMs, providerErrorMessage) {
|
|
77
|
+
const maxDelayMs = maxRetryDelayMs ?? DEFAULT_MAX_RETRY_DELAY_MS;
|
|
78
|
+
if (maxDelayMs > 0 && delayMs > maxDelayMs) throw new Error(`Server requested ${Math.ceil(delayMs / 1000)}s retry delay (max: ${Math.ceil(maxDelayMs / 1000)}s). ${providerErrorMessage}`);
|
|
79
|
+
return delayMs;
|
|
80
|
+
}
|
|
81
|
+
function getRetryDelayMs(error, retryIndex, maxRetryDelayMs) {
|
|
82
|
+
const retryAfterMs = error.headers?.get("retry-after-ms");
|
|
83
|
+
if (retryAfterMs) {
|
|
84
|
+
const value = Number.parseFloat(retryAfterMs);
|
|
85
|
+
if (!Number.isNaN(value)) return validateServerRetryDelayMs(value, maxRetryDelayMs, error.message);
|
|
86
|
+
}
|
|
87
|
+
const retryAfter = error.headers?.get("retry-after");
|
|
88
|
+
if (retryAfter) {
|
|
89
|
+
const seconds = Number.parseFloat(retryAfter);
|
|
90
|
+
const delayMs = Number.isNaN(seconds) ? Date.parse(retryAfter) - Date.now() : 1000 * seconds;
|
|
91
|
+
return validateServerRetryDelayMs(delayMs, maxRetryDelayMs, error.message);
|
|
92
|
+
}
|
|
93
|
+
const exponentialDelay = 1000 * Math.min(0.5 * 2 ** retryIndex, 8);
|
|
94
|
+
return exponentialDelay * (1 - 0.25 * Math.random());
|
|
95
|
+
}
|
|
96
|
+
function createAbortError() {
|
|
97
|
+
const error = new Error("Request aborted");
|
|
98
|
+
error.name = "AbortError";
|
|
99
|
+
return error;
|
|
100
|
+
}
|
|
101
|
+
function abortableSleep(ms, signal) {
|
|
102
|
+
return new Promise((resolve, reject)=>{
|
|
103
|
+
if (signal?.aborted) return void reject(createAbortError());
|
|
104
|
+
const onAbort = ()=>{
|
|
105
|
+
clearTimeout(timeout);
|
|
106
|
+
reject(createAbortError());
|
|
107
|
+
};
|
|
108
|
+
const timeout = setTimeout(()=>{
|
|
109
|
+
signal?.removeEventListener("abort", onAbort);
|
|
110
|
+
resolve();
|
|
111
|
+
}, Math.max(0, ms));
|
|
112
|
+
signal?.addEventListener("abort", onAbort, {
|
|
113
|
+
once: true
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
async function retryProviderRequest(request, options = {}) {
|
|
118
|
+
const maxRetries = options.maxRetries ?? 0;
|
|
119
|
+
let retriesRemaining = maxRetries;
|
|
120
|
+
for(;;)try {
|
|
121
|
+
return await request();
|
|
122
|
+
} catch (error) {
|
|
123
|
+
if (options.signal?.aborted) throw createAbortError();
|
|
124
|
+
if (retriesRemaining <= 0 || !isProviderError(error) || !isRetryableProviderError(error)) throw error;
|
|
125
|
+
const retryIndex = maxRetries - retriesRemaining;
|
|
126
|
+
retriesRemaining--;
|
|
127
|
+
await abortableSleep(getRetryDelayMs(error, retryIndex, options.maxRetryDelayMs), options.signal);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function sanitizeSurrogates(text) {
|
|
131
|
+
return text.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g, "");
|
|
132
|
+
}
|
|
133
|
+
function getGrammarToolInput(toolName, arguments_, inputProperty) {
|
|
134
|
+
const input = arguments_[inputProperty];
|
|
135
|
+
if ("string" != typeof input) throw new Error(`Grammar tool call "${toolName}" requires argument "${inputProperty}" to be a string.`);
|
|
136
|
+
return input;
|
|
137
|
+
}
|
|
138
|
+
function appendGrammarToolInputJsonDelta(buffer, inputProperty, nextInput, close) {
|
|
139
|
+
if (buffer.closed) {
|
|
140
|
+
if (close && nextInput === buffer.input) return;
|
|
141
|
+
throw new Error(`grammar tool input for property "${inputProperty}" changed after it was closed`);
|
|
142
|
+
}
|
|
143
|
+
if (!nextInput.startsWith(buffer.input)) throw new Error(`grammar tool input for property "${inputProperty}" changed non-monotonically`);
|
|
144
|
+
const inputDelta = nextInput.slice(buffer.input.length);
|
|
145
|
+
if (!close && 0 === inputDelta.length) return;
|
|
146
|
+
let delta = "";
|
|
147
|
+
if (!buffer.started) {
|
|
148
|
+
delta += `{${JSON.stringify(inputProperty)}:"`;
|
|
149
|
+
buffer.started = true;
|
|
150
|
+
}
|
|
151
|
+
delta += JSON.stringify(inputDelta).slice(1, -1);
|
|
152
|
+
buffer.input = nextInput;
|
|
153
|
+
if (close) {
|
|
154
|
+
delta += '"}';
|
|
155
|
+
buffer.closed = true;
|
|
156
|
+
}
|
|
157
|
+
return delta;
|
|
158
|
+
}
|
|
159
|
+
function inferGrammarInputProperty(tool) {
|
|
160
|
+
const schema = tool.parameters;
|
|
161
|
+
if ("object" !== schema.type) throw new Error("grammar constrained sampling requires an object parameter schema");
|
|
162
|
+
if (!Array.isArray(schema.required) || 1 !== schema.required.length || "string" != typeof schema.required[0]) throw new Error("grammar constrained sampling requires exactly one required string property");
|
|
163
|
+
const inputProperty = schema.required[0];
|
|
164
|
+
if (!schema.properties?.[inputProperty]) throw new Error(`grammar constrained sampling requires a properties entry for ${inputProperty}`);
|
|
165
|
+
if (schema.properties[inputProperty]?.type !== "string") throw new Error(`grammar constrained sampling property ${inputProperty} must have type string`);
|
|
166
|
+
return inputProperty;
|
|
167
|
+
}
|
|
168
|
+
function resolveJsonSchemaStrictSampling(tool, supportsStrictMode) {
|
|
169
|
+
const config = tool.constrainedSampling;
|
|
170
|
+
if (!config || "json_schema" !== config.type) return;
|
|
171
|
+
if (supportsStrictMode) return true;
|
|
172
|
+
if ("require" === config.strict) throw new Error(`Tool "${tool.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`);
|
|
173
|
+
}
|
|
174
|
+
function resolveGrammarConstrainedSampling(tool, supportsOpenAIGrammarTools) {
|
|
175
|
+
const config = tool.constrainedSampling;
|
|
176
|
+
if (!config || "grammar" !== config.type) return;
|
|
177
|
+
if (!supportsOpenAIGrammarTools) return;
|
|
178
|
+
const larkDefinition = config.variants.openai_lark;
|
|
179
|
+
const regexDefinition = config.variants.openai_regex;
|
|
180
|
+
const hasLarkDefinition = "string" == typeof larkDefinition && larkDefinition.trim().length > 0;
|
|
181
|
+
const hasRegexDefinition = "string" == typeof regexDefinition && regexDefinition.trim().length > 0;
|
|
182
|
+
if (!hasLarkDefinition && !hasRegexDefinition) throw new Error(`Tool "${tool.name}" cannot use grammar constrained sampling: no supported grammar variant was provided.`);
|
|
183
|
+
try {
|
|
184
|
+
return {
|
|
185
|
+
format: hasLarkDefinition ? "lark" : "regex",
|
|
186
|
+
definition: hasLarkDefinition ? larkDefinition : regexDefinition,
|
|
187
|
+
inputProperty: inferGrammarInputProperty(tool)
|
|
188
|
+
};
|
|
189
|
+
} catch (error) {
|
|
190
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
191
|
+
throw new Error(`Tool "${tool.name}" cannot use grammar constrained sampling: ${message}.`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function createGrammarToolInputProperties(tools, supportsOpenAIGrammarTools) {
|
|
195
|
+
const properties = new Map();
|
|
196
|
+
for (const tool of tools ?? []){
|
|
197
|
+
const grammar = resolveGrammarConstrainedSampling(tool, supportsOpenAIGrammarTools);
|
|
198
|
+
if (grammar) properties.set(tool.name, grammar.inputProperty);
|
|
199
|
+
}
|
|
200
|
+
return properties;
|
|
201
|
+
}
|
|
202
|
+
const CHARS_PER_TOKEN = 4;
|
|
203
|
+
const ESTIMATED_IMAGE_CHARS = 4800;
|
|
204
|
+
function calculateContextTokens(usage) {
|
|
205
|
+
return usage.totalTokens || usage.input + usage.output + usage.cacheRead + usage.cacheWrite;
|
|
206
|
+
}
|
|
207
|
+
function safeJsonStringify(value) {
|
|
208
|
+
try {
|
|
209
|
+
return JSON.stringify(value) ?? "undefined";
|
|
210
|
+
} catch {
|
|
211
|
+
return "[unserializable]";
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function estimateTextAndImageContentChars(content) {
|
|
215
|
+
if ("string" == typeof content) return content.length;
|
|
216
|
+
let chars = 0;
|
|
217
|
+
for (const block of content)chars += "text" === block.type ? block.text.length : ESTIMATED_IMAGE_CHARS;
|
|
218
|
+
return chars;
|
|
219
|
+
}
|
|
220
|
+
function estimateTextTokens(text) {
|
|
221
|
+
return Math.ceil(text.length / CHARS_PER_TOKEN);
|
|
222
|
+
}
|
|
223
|
+
function estimateTextAndImageContentTokens(content) {
|
|
224
|
+
return Math.ceil(estimateTextAndImageContentChars(content) / CHARS_PER_TOKEN);
|
|
225
|
+
}
|
|
226
|
+
function estimateMessageTokens(message) {
|
|
227
|
+
let chars = 0;
|
|
228
|
+
if ("user" === message.role) return estimateTextAndImageContentTokens(message.content);
|
|
229
|
+
if ("toolResult" === message.role) return estimateTextAndImageContentTokens(message.content);
|
|
230
|
+
for (const block of message.content)if ("text" === block.type) chars += block.text.length;
|
|
231
|
+
else if ("thinking" === block.type) chars += block.thinking.length;
|
|
232
|
+
else chars += block.name.length + safeJsonStringify(block.arguments).length;
|
|
233
|
+
return Math.ceil(chars / CHARS_PER_TOKEN);
|
|
234
|
+
}
|
|
235
|
+
function getLastAssistantUsageInfo(messages) {
|
|
236
|
+
let latestPrefixTimestamp = -1 / 0;
|
|
237
|
+
let usageInfo;
|
|
238
|
+
for(let i = 0; i < messages.length; i++){
|
|
239
|
+
const message = messages[i];
|
|
240
|
+
if ("assistant" === message.role) {
|
|
241
|
+
const assistant = message;
|
|
242
|
+
const usageAppliesToPrefix = assistant.timestamp >= latestPrefixTimestamp;
|
|
243
|
+
if (usageAppliesToPrefix && "aborted" !== assistant.stopReason && "error" !== assistant.stopReason && calculateContextTokens(assistant.usage) > 0) usageInfo = {
|
|
244
|
+
usage: assistant.usage,
|
|
245
|
+
index: i
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
latestPrefixTimestamp = Math.max(latestPrefixTimestamp, message.timestamp);
|
|
249
|
+
}
|
|
250
|
+
return usageInfo;
|
|
251
|
+
}
|
|
252
|
+
function estimateMessages(messages) {
|
|
253
|
+
const usageInfo = getLastAssistantUsageInfo(messages);
|
|
254
|
+
if (usageInfo) {
|
|
255
|
+
const usageTokens = calculateContextTokens(usageInfo.usage);
|
|
256
|
+
let trailingTokens = 0;
|
|
257
|
+
for(let i = usageInfo.index + 1; i < messages.length; i++)trailingTokens += estimateMessageTokens(messages[i]);
|
|
258
|
+
return {
|
|
259
|
+
tokens: usageTokens + trailingTokens,
|
|
260
|
+
usageTokens,
|
|
261
|
+
trailingTokens,
|
|
262
|
+
lastUsageIndex: usageInfo.index
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
let tokens = 0;
|
|
266
|
+
for (const message of messages)tokens += estimateMessageTokens(message);
|
|
267
|
+
return {
|
|
268
|
+
tokens,
|
|
269
|
+
usageTokens: 0,
|
|
270
|
+
trailingTokens: tokens,
|
|
271
|
+
lastUsageIndex: null
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function estimateToolsTokens(tools) {
|
|
275
|
+
if (!tools || 0 === tools.length) return 0;
|
|
276
|
+
return estimateTextTokens(safeJsonStringify(tools));
|
|
277
|
+
}
|
|
278
|
+
function isMessageArray(value) {
|
|
279
|
+
return Array.isArray(value);
|
|
280
|
+
}
|
|
281
|
+
function estimateContextTokens(context) {
|
|
282
|
+
if (isMessageArray(context)) return estimateMessages(context);
|
|
283
|
+
const estimate = estimateMessages(context.messages);
|
|
284
|
+
if (null !== estimate.lastUsageIndex) {
|
|
285
|
+
const addedNames = new Set(context.messages.slice(estimate.lastUsageIndex + 1).filter((message)=>"toolResult" === message.role).flatMap((message)=>message.addedToolNames ?? []));
|
|
286
|
+
const addedToolTokens = estimateToolsTokens(context.tools?.filter((tool)=>addedNames.has(tool.name)));
|
|
287
|
+
return {
|
|
288
|
+
tokens: estimate.tokens + addedToolTokens,
|
|
289
|
+
usageTokens: estimate.usageTokens,
|
|
290
|
+
trailingTokens: estimate.trailingTokens + addedToolTokens,
|
|
291
|
+
lastUsageIndex: estimate.lastUsageIndex
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
const prefixTokens = (context.systemPrompt ? estimateTextTokens(context.systemPrompt) : 0) + estimateToolsTokens(context.tools);
|
|
295
|
+
return {
|
|
296
|
+
tokens: estimate.tokens + prefixTokens,
|
|
297
|
+
usageTokens: estimate.usageTokens,
|
|
298
|
+
trailingTokens: estimate.trailingTokens + prefixTokens,
|
|
299
|
+
lastUsageIndex: estimate.lastUsageIndex
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
const CONTEXT_SAFETY_TOKENS = 4096;
|
|
303
|
+
const MIN_MAX_TOKENS = 1;
|
|
304
|
+
function clampMaxTokensToContext(model, context, maxTokens) {
|
|
305
|
+
if (model.contextWindow <= 0) return Math.max(MIN_MAX_TOKENS, maxTokens);
|
|
306
|
+
const available = model.contextWindow - estimateContextTokens(context).tokens - CONTEXT_SAFETY_TOKENS;
|
|
307
|
+
return Math.min(maxTokens, Math.max(MIN_MAX_TOKENS, available));
|
|
308
|
+
}
|
|
309
|
+
function buildBaseOptions(model, context, options, apiKey) {
|
|
310
|
+
const samplingParams = model.samplingParams || options?.samplingParams ? {
|
|
311
|
+
...model.samplingParams,
|
|
312
|
+
...options?.samplingParams
|
|
313
|
+
} : void 0;
|
|
314
|
+
return {
|
|
315
|
+
temperature: options?.temperature,
|
|
316
|
+
samplingParams,
|
|
317
|
+
maxTokens: clampMaxTokensToContext(model, context, options?.maxTokens ?? model.maxTokens),
|
|
318
|
+
signal: options?.signal,
|
|
319
|
+
telemetryContext: options?.telemetryContext,
|
|
320
|
+
apiKey: apiKey || options?.apiKey,
|
|
321
|
+
fetch: options?.fetch,
|
|
322
|
+
transport: options?.transport,
|
|
323
|
+
cacheRetention: options?.cacheRetention,
|
|
324
|
+
sessionId: options?.sessionId,
|
|
325
|
+
headers: options?.headers,
|
|
326
|
+
onPayload: options?.onPayload,
|
|
327
|
+
onResponse: options?.onResponse,
|
|
328
|
+
timeoutMs: options?.timeoutMs,
|
|
329
|
+
websocketConnectTimeoutMs: options?.websocketConnectTimeoutMs,
|
|
330
|
+
maxRetries: options?.maxRetries,
|
|
331
|
+
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
332
|
+
metadata: options?.metadata,
|
|
333
|
+
env: options?.env
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
const MIN_ANSWER_TOKENS = 1024;
|
|
337
|
+
function clampReasoning(effort) {
|
|
338
|
+
return "xhigh" === effort || "max" === effort ? "high" : effort;
|
|
339
|
+
}
|
|
340
|
+
function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLevel, customBudgets) {
|
|
341
|
+
const defaultBudgets = {
|
|
342
|
+
minimal: 1024,
|
|
343
|
+
low: 2048,
|
|
344
|
+
medium: 8192,
|
|
345
|
+
high: 16384
|
|
346
|
+
};
|
|
347
|
+
const budgets = {
|
|
348
|
+
...defaultBudgets,
|
|
349
|
+
...customBudgets
|
|
350
|
+
};
|
|
351
|
+
const level = clampReasoning(reasoningLevel);
|
|
352
|
+
let thinkingBudget = budgets[level];
|
|
353
|
+
const maxTokens = void 0 === baseMaxTokens ? modelMaxTokens : Math.min(baseMaxTokens + thinkingBudget, modelMaxTokens);
|
|
354
|
+
if (maxTokens <= thinkingBudget) thinkingBudget = Math.max(0, maxTokens - MIN_ANSWER_TOKENS);
|
|
355
|
+
return {
|
|
356
|
+
maxTokens,
|
|
357
|
+
thinkingBudget
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
const NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
|
|
361
|
+
const NON_VISION_TOOL_IMAGE_PLACEHOLDER = "(tool image omitted: model does not support images)";
|
|
362
|
+
function replaceImagesWithPlaceholder(content, placeholder) {
|
|
363
|
+
const result = [];
|
|
364
|
+
let previousWasPlaceholder = false;
|
|
365
|
+
for (const block of content){
|
|
366
|
+
if ("image" === block.type) {
|
|
367
|
+
if (!previousWasPlaceholder) result.push({
|
|
368
|
+
type: "text",
|
|
369
|
+
text: placeholder
|
|
370
|
+
});
|
|
371
|
+
previousWasPlaceholder = true;
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
result.push(block);
|
|
375
|
+
previousWasPlaceholder = block.text === placeholder;
|
|
376
|
+
}
|
|
377
|
+
return result;
|
|
378
|
+
}
|
|
379
|
+
function downgradeUnsupportedImages(messages, model) {
|
|
380
|
+
if (model.input.includes("image")) return messages;
|
|
381
|
+
return messages.map((msg)=>{
|
|
382
|
+
if ("user" === msg.role && Array.isArray(msg.content)) return {
|
|
383
|
+
...msg,
|
|
384
|
+
content: replaceImagesWithPlaceholder(msg.content, NON_VISION_USER_IMAGE_PLACEHOLDER)
|
|
385
|
+
};
|
|
386
|
+
if ("toolResult" === msg.role) return {
|
|
387
|
+
...msg,
|
|
388
|
+
content: replaceImagesWithPlaceholder(msg.content, NON_VISION_TOOL_IMAGE_PLACEHOLDER)
|
|
389
|
+
};
|
|
390
|
+
return msg;
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
function transformMessages(messages, model, normalizeToolCallId) {
|
|
394
|
+
const toolCallIdMap = new Map();
|
|
395
|
+
const normalizedMessages = messages.map((msg)=>null == msg.content ? {
|
|
396
|
+
...msg,
|
|
397
|
+
content: []
|
|
398
|
+
} : msg);
|
|
399
|
+
const imageAwareMessages = downgradeUnsupportedImages(normalizedMessages, model);
|
|
400
|
+
const transformed = imageAwareMessages.map((msg)=>{
|
|
401
|
+
if ("user" === msg.role) return msg;
|
|
402
|
+
if ("toolResult" === msg.role) {
|
|
403
|
+
const normalizedId = toolCallIdMap.get(msg.toolCallId);
|
|
404
|
+
if (normalizedId && normalizedId !== msg.toolCallId) return {
|
|
405
|
+
...msg,
|
|
406
|
+
toolCallId: normalizedId
|
|
407
|
+
};
|
|
408
|
+
return msg;
|
|
409
|
+
}
|
|
410
|
+
if ("assistant" === msg.role) {
|
|
411
|
+
const assistantMsg = msg;
|
|
412
|
+
const isSameModel = assistantMsg.provider === model.provider && assistantMsg.api === model.api && assistantMsg.model === model.id;
|
|
413
|
+
const transformedContent = assistantMsg.content.flatMap((block)=>{
|
|
414
|
+
if ("thinking" === block.type) {
|
|
415
|
+
if (block.redacted) return isSameModel ? block : [];
|
|
416
|
+
if (isSameModel && block.thinkingSignature) return block;
|
|
417
|
+
if (!block.thinking || "" === block.thinking.trim()) return [];
|
|
418
|
+
if (isSameModel) return block;
|
|
419
|
+
return {
|
|
420
|
+
type: "text",
|
|
421
|
+
text: block.thinking
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
if ("text" === block.type) {
|
|
425
|
+
if (isSameModel) return block;
|
|
426
|
+
return {
|
|
427
|
+
type: "text",
|
|
428
|
+
text: block.text
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
if ("toolCall" === block.type) {
|
|
432
|
+
const toolCall = block;
|
|
433
|
+
let normalizedToolCall = toolCall;
|
|
434
|
+
if (!isSameModel && toolCall.thoughtSignature) {
|
|
435
|
+
normalizedToolCall = {
|
|
436
|
+
...toolCall
|
|
437
|
+
};
|
|
438
|
+
delete normalizedToolCall.thoughtSignature;
|
|
439
|
+
}
|
|
440
|
+
if (!isSameModel && normalizeToolCallId) {
|
|
441
|
+
const normalizedId = normalizeToolCallId(toolCall.id, model, assistantMsg);
|
|
442
|
+
if (normalizedId !== toolCall.id) {
|
|
443
|
+
toolCallIdMap.set(toolCall.id, normalizedId);
|
|
444
|
+
normalizedToolCall = {
|
|
445
|
+
...normalizedToolCall,
|
|
446
|
+
id: normalizedId
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return normalizedToolCall;
|
|
451
|
+
}
|
|
452
|
+
return block;
|
|
453
|
+
});
|
|
454
|
+
return {
|
|
455
|
+
...assistantMsg,
|
|
456
|
+
content: transformedContent
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
return msg;
|
|
460
|
+
});
|
|
461
|
+
const result = [];
|
|
462
|
+
let pendingToolCalls = [];
|
|
463
|
+
let existingToolResultIds = new Set();
|
|
464
|
+
const insertSyntheticToolResults = ()=>{
|
|
465
|
+
if (pendingToolCalls.length > 0) {
|
|
466
|
+
for (const tc of pendingToolCalls)if (!existingToolResultIds.has(tc.id)) result.push({
|
|
467
|
+
role: "toolResult",
|
|
468
|
+
toolCallId: tc.id,
|
|
469
|
+
toolName: tc.name,
|
|
470
|
+
content: [
|
|
471
|
+
{
|
|
472
|
+
type: "text",
|
|
473
|
+
text: "No result provided"
|
|
474
|
+
}
|
|
475
|
+
],
|
|
476
|
+
isError: true,
|
|
477
|
+
timestamp: Date.now()
|
|
478
|
+
});
|
|
479
|
+
pendingToolCalls = [];
|
|
480
|
+
existingToolResultIds = new Set();
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
for(let i = 0; i < transformed.length; i++){
|
|
484
|
+
const msg = transformed[i];
|
|
485
|
+
if ("assistant" === msg.role) {
|
|
486
|
+
insertSyntheticToolResults();
|
|
487
|
+
const assistantMsg = msg;
|
|
488
|
+
if ("error" === assistantMsg.stopReason || "aborted" === assistantMsg.stopReason) continue;
|
|
489
|
+
const toolCalls = assistantMsg.content.filter((b)=>"toolCall" === b.type);
|
|
490
|
+
if (toolCalls.length > 0) {
|
|
491
|
+
pendingToolCalls = toolCalls;
|
|
492
|
+
existingToolResultIds = new Set();
|
|
493
|
+
}
|
|
494
|
+
result.push(msg);
|
|
495
|
+
} else if ("toolResult" === msg.role) {
|
|
496
|
+
existingToolResultIds.add(msg.toolCallId);
|
|
497
|
+
result.push(msg);
|
|
498
|
+
} else if ("user" === msg.role) {
|
|
499
|
+
insertSyntheticToolResults();
|
|
500
|
+
result.push(msg);
|
|
501
|
+
} else result.push(msg);
|
|
502
|
+
}
|
|
503
|
+
insertSyntheticToolResults();
|
|
504
|
+
return result;
|
|
505
|
+
}
|
|
506
|
+
export { adjustMaxTokensForThinking, appendGrammarToolInputJsonDelta, buildBaseOptions, calculateCost, clampMaxTokensToContext, clampReasoning, clampThinkingLevel, createGrammarToolInputProperties, getGrammarToolInput, headersToRecord, providerHeadersToRecord, resolveGrammarConstrainedSampling, resolveJsonSchemaStrictSampling, retryProviderRequest, sanitizeSurrogates, transformMessages };
|
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
import { lazyApi, AgentModelError, flattenModelCatalog, createProtocolModelConfig } from "./
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const anthropicMessagesApi = () => lazyApi(() => import("./_chunks/anthropic-messages~1-d35e3e7d.js").then(m => m.anthropic_messages_namespaceObject));
|
|
5
|
-
//# sourceMappingURL=anthropic-messages.lazy.js.map
|
|
6
|
-
var anthropic_namespaceObject = /*#__PURE__*/JSON.parse('{"anthropic-messages":{"claude-fable-5":{"id":"claude-fable-5","name":"Claude Fable 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-haiku-4-5":{"id":"claude-haiku-4-5","name":"Claude Haiku 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-haiku-4-5-20251001":{"id":"claude-haiku-4-5-20251001","name":"Claude Haiku 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-5":{"id":"claude-opus-4-5","name":"Claude Opus 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-5-20251101":{"id":"claude-opus-4-5-20251101","name":"Claude Opus 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-6":{"id":"claude-opus-4-6","name":"Claude Opus 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-opus-4-7":{"id":"claude-opus-4-7","name":"Claude Opus 4.7","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-opus-4-8":{"id":"claude-opus-4-8","name":"Claude Opus 4.8","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-opus-5":{"id":"claude-opus-5","name":"Claude Opus 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-sonnet-4-5":{"id":"claude-sonnet-4-5","name":"Claude Sonnet 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-sonnet-4-5-20250929":{"id":"claude-sonnet-4-5-20250929","name":"Claude Sonnet 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-sonnet-4-6":{"id":"claude-sonnet-4-6","name":"Claude Sonnet 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-sonnet-5":{"id":"claude-sonnet-5","name":"Claude Sonnet 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}}}}')
|
|
7
|
-
// This file is auto-generated by scripts/generate-models.ts
|
|
8
|
-
// Do not edit manually - run 'npm run generate-models' to update
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { lazyApi, AgentModelError, flattenModelCatalog, createProtocolModelConfig } from "./k.js";
|
|
2
|
+
const anthropicMessagesApi = ()=>lazyApi(()=>import("./anthropic-messages~1.js").then((m)=>m.anthropic_messages_namespaceObject));
|
|
3
|
+
var anthropic_namespaceObject = /*#__PURE__*/ JSON.parse('{"anthropic-messages":{"claude-fable-5":{"id":"claude-fable-5","name":"Claude Fable 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"off":null,"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-haiku-4-5":{"id":"claude-haiku-4-5","name":"Claude Haiku 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-haiku-4-5-20251001":{"id":"claude-haiku-4-5-20251001","name":"Claude Haiku 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-5":{"id":"claude-opus-4-5","name":"Claude Opus 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-5-20251101":{"id":"claude-opus-4-5-20251101","name":"Claude Opus 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-opus-4-6":{"id":"claude-opus-4-6","name":"Claude Opus 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-opus-4-7":{"id":"claude-opus-4-7","name":"Claude Opus 4.7","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-opus-4-8":{"id":"claude-opus-4-8","name":"Claude Opus 4.8","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-opus-5":{"id":"claude-opus-5","name":"Claude Opus 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsTemperature":false,"supportsStrictTools":true}},"claude-sonnet-4-5":{"id":"claude-sonnet-4-5","name":"Claude Sonnet 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-sonnet-4-5-20250929":{"id":"claude-sonnet-4-5-20250929","name":"Claude Sonnet 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":64000,"compat":{"supportsStrictTools":true}},"claude-sonnet-4-6":{"id":"claude-sonnet-4-6","name":"Claude Sonnet 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}},"claude-sonnet-5":{"id":"claude-sonnet-5","name":"Claude Sonnet 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000,"thinkingLevelMap":{"xhigh":"xhigh","max":"max"},"compat":{"forceAdaptiveThinking":true,"supportsStrictTools":true}}}}');
|
|
11
4
|
const ANTHROPIC_MODELS = flattenModelCatalog("anthropic", anthropic_namespaceObject);
|
|
12
|
-
//# sourceMappingURL=anthropic.models.js.map
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
5
|
function createModelConfig(config) {
|
|
18
|
-
const hasAuthorizationHeader = Object.keys(config.headers ?? {}).some((name)=>name.toLowerCase()
|
|
19
|
-
if (hasAuthorizationHeader || config.apiKey?.includes("sk-ant-oat") || Object.values(config.headers ?? {}).some((value)=>typeof value
|
|
20
|
-
throw new AgentModelError("MODEL_CONFIG_INVALID", "Anthropic OAuth tokens and Authorization headers are not supported by the browser model entry.");
|
|
21
|
-
}
|
|
6
|
+
const hasAuthorizationHeader = Object.keys(config.headers ?? {}).some((name)=>"authorization" === name.toLowerCase());
|
|
7
|
+
if (hasAuthorizationHeader || config.apiKey?.includes("sk-ant-oat") || Object.values(config.headers ?? {}).some((value)=>"string" == typeof value && value.includes("sk-ant-oat"))) throw new AgentModelError("MODEL_CONFIG_INVALID", "Anthropic OAuth tokens and Authorization headers are not supported by the browser model entry.");
|
|
22
8
|
return createProtocolModelConfig({
|
|
23
9
|
provider: "anthropic",
|
|
24
10
|
api: "anthropic-messages",
|
|
@@ -28,5 +14,4 @@ function createModelConfig(config) {
|
|
|
28
14
|
resolveCatalogModel: (model)=>Object.values(ANTHROPIC_MODELS).find(({ id })=>id === model)
|
|
29
15
|
}, config);
|
|
30
16
|
}
|
|
31
|
-
|
|
32
17
|
export { createModelConfig };
|