|
160 | 160 | <PlatformIcon platform="grok" size="sm" /> |
161 | 161 | Grok |
162 | 162 | </button> |
| 163 | + <button |
| 164 | + type="button" |
| 165 | + @click="form.platform = 'opencode'; accountCategory = 'apikey'" |
| 166 | + :class="[ |
| 167 | + 'flex flex-1 items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium transition-all', |
| 168 | + form.platform === 'opencode' |
| 169 | + ? 'bg-white text-zinc-900 shadow-sm dark:bg-dark-600 dark:text-zinc-100' |
| 170 | + : 'text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200' |
| 171 | + ]" |
| 172 | + > |
| 173 | + <PlatformIcon platform="opencode" size="sm" /> |
| 174 | + OpenCode Go |
| 175 | + </button> |
163 | 176 | </div> |
164 | 177 | </div> |
165 | 178 |
|
|
1127 | 1140 | ? 'https://generativelanguage.googleapis.com' |
1128 | 1141 | : form.platform === 'grok' |
1129 | 1142 | ? 'https://api.x.ai/v1' |
1130 | | - : 'https://api.anthropic.com' |
| 1143 | + : form.platform === 'opencode' |
| 1144 | + ? 'https://opencode.ai/zen/go/v1' |
| 1145 | + : 'https://api.anthropic.com' |
1131 | 1146 | " |
1132 | 1147 | /> |
1133 | 1148 | <p v-if="baseUrlHint" class="input-hint">{{ baseUrlHint }}</p> |
|
1151 | 1166 | ? 'AIza...' |
1152 | 1167 | : form.platform === 'grok' |
1153 | 1168 | ? 'xai-...' |
1154 | | - : 'sk-ant-...' |
| 1169 | + : form.platform === 'opencode' |
| 1170 | + ? 'sk-opencode-...' |
| 1171 | + : 'sk-ant-...' |
1155 | 1172 | " |
1156 | 1173 | /> |
1157 | 1174 | <p v-if="apiKeyHint" class="input-hint">{{ apiKeyHint }}</p> |
@@ -5113,7 +5130,9 @@ const handleSubmit = async () => { |
5113 | 5130 | ? 'https://generativelanguage.googleapis.com' |
5114 | 5131 | : form.platform === 'grok' |
5115 | 5132 | ? 'https://api.x.ai/v1' |
5116 | | - : 'https://api.anthropic.com' |
| 5133 | + : form.platform === 'opencode' |
| 5134 | + ? 'https://opencode.ai/zen/go/v1' |
| 5135 | + : 'https://api.anthropic.com' |
5117 | 5136 |
|
5118 | 5137 | // Build credentials with optional model mapping |
5119 | 5138 | const credentials: Record<string, unknown> = { |
@@ -5294,6 +5313,17 @@ const createAccountAndFinish = async ( |
5294 | 5313 | delete credentials.model_mapping |
5295 | 5314 | } |
5296 | 5315 | } |
| 5316 | + if (platform === 'opencode') { |
| 5317 | + if (!credentials.base_url) { |
| 5318 | + credentials.base_url = apiKeyBaseUrl.value.trim() || 'https://opencode.ai/zen/go/v1' |
| 5319 | + } |
| 5320 | + const modelMapping = buildModelMappingObject(modelRestrictionMode.value, allowedModels.value, modelMappings.value) |
| 5321 | + if (modelMapping) { |
| 5322 | + credentials.model_mapping = modelMapping |
| 5323 | + } else { |
| 5324 | + delete credentials.model_mapping |
| 5325 | + } |
| 5326 | + } |
5297 | 5327 | await doCreateAccount({ |
5298 | 5328 | name: form.name, |
5299 | 5329 | notes: form.notes, |
|
0 commit comments