MCPcopy Create free account
hub / github.com/anomalyco/opencode / options

Function options

packages/opencode/src/provider/transform.ts:1075–1230  ·  view source on GitHub ↗
(input: {
  model: Provider.Model
  sessionID: string
  providerOptions?: Record<string, any>
})

Source from the content-addressed store, hash-verified

1073}
1074
1075export function options(input: {
1076 model: Provider.Model
1077 sessionID: string
1078 providerOptions?: Record<string, any>
1079}): Record<string, any> {
1080 const result: Record<string, any> = {}
1081
1082 if (
1083 input.model.api.npm === "@ai-sdk/google-vertex/anthropic" ||
1084 (!input.model.api.id.includes("claude") && input.model.api.npm === "@ai-sdk/anthropic")
1085 ) {
1086 result["toolStreaming"] = false
1087 }
1088
1089 // openai and providers using openai package should set store to false by default.
1090 if (
1091 input.model.providerID === "openai" ||
1092 input.model.api.npm === "@ai-sdk/openai" ||
1093 input.model.api.npm === "@ai-sdk/github-copilot" ||
1094 input.model.api.npm === "@ai-sdk/amazon-bedrock/mantle"
1095 ) {
1096 result["store"] = false
1097 }
1098
1099 if (input.model.api.npm === "@ai-sdk/azure") {
1100 result["store"] = false
1101 result["promptCacheKey"] = input.sessionID
1102 }
1103
1104 if (input.model.api.npm === "@openrouter/ai-sdk-provider" || input.model.api.npm === "@llmgateway/ai-sdk-provider") {
1105 result["usage"] = {
1106 include: true,
1107 }
1108 if (input.model.api.id.includes("gemini-3")) {
1109 result["reasoning"] = { effort: "high" }
1110 }
1111 }
1112
1113 if (
1114 input.model.providerID === "baseten" ||
1115 (input.model.providerID === "opencode" && ["kimi-k2-thinking", "glm-4.6"].includes(input.model.api.id))
1116 ) {
1117 result["chat_template_args"] = { enable_thinking: true }
1118 }
1119
1120 if (
1121 ["zai", "zhipuai"].some((id) => input.model.providerID.includes(id)) &&
1122 input.model.api.npm === "@ai-sdk/openai-compatible"
1123 ) {
1124 result["thinking"] = {
1125 type: "enabled",
1126 clear_thinking: false,
1127 }
1128 }
1129
1130 if (input.model.providerID === "openai" || input.providerOptions?.setCacheKey) {
1131 result["promptCacheKey"] = input.sessionID
1132 }

Callers 5

createPromptStateFunction · 0.50
selectFunction · 0.50
expandFunction · 0.50
runFunction · 0.50
submitPromptFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected