mirror of
https://github.com/sst/opencode.git
synced 2025-08-02 12:52:14 +00:00
vercel ai gateway
This commit is contained in:
parent
3c3a997d2a
commit
4bbbbac5f6
2 changed files with 8 additions and 2 deletions
|
@ -78,6 +78,8 @@ export const AuthLoginCommand = cmd({
|
||||||
"github-copilot": 1,
|
"github-copilot": 1,
|
||||||
openai: 2,
|
openai: 2,
|
||||||
google: 3,
|
google: 3,
|
||||||
|
openrouter: 4,
|
||||||
|
vercel: 5,
|
||||||
}
|
}
|
||||||
let provider = await prompts.select({
|
let provider = await prompts.select({
|
||||||
message: "Select provider",
|
message: "Select provider",
|
||||||
|
@ -108,7 +110,7 @@ export const AuthLoginCommand = cmd({
|
||||||
if (provider === "other") {
|
if (provider === "other") {
|
||||||
provider = await prompts.text({
|
provider = await prompts.text({
|
||||||
message: "Enter provider id",
|
message: "Enter provider id",
|
||||||
validate: (x) => (x.match(/^[a-z-]+$/) ? undefined : "a-z and hyphens only"),
|
validate: (x) => (x.match(/^[0-9a-z-]+$/) ? undefined : "a-z, 0-9 and hyphens only"),
|
||||||
})
|
})
|
||||||
if (prompts.isCancel(provider)) throw new UI.CancelledError()
|
if (prompts.isCancel(provider)) throw new UI.CancelledError()
|
||||||
provider = provider.replace(/^@ai-sdk\//, "")
|
provider = provider.replace(/^@ai-sdk\//, "")
|
||||||
|
@ -265,6 +267,10 @@ export const AuthLoginCommand = cmd({
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (provider === "vercel") {
|
||||||
|
prompts.log.info("You can create an api key in the dashboard")
|
||||||
|
}
|
||||||
|
|
||||||
const key = await prompts.password({
|
const key = await prompts.password({
|
||||||
message: "Enter your API key",
|
message: "Enter your API key",
|
||||||
validate: (x) => (x.length > 0 ? undefined : "Required"),
|
validate: (x) => (x.length > 0 ? undefined : "Required"),
|
||||||
|
|
|
@ -27,7 +27,7 @@ await Promise.all([
|
||||||
fs.mkdir(Global.Path.state, { recursive: true }),
|
fs.mkdir(Global.Path.state, { recursive: true }),
|
||||||
])
|
])
|
||||||
|
|
||||||
const CACHE_VERSION = "2"
|
const CACHE_VERSION = "3"
|
||||||
|
|
||||||
const version = await Bun.file(path.join(Global.Path.cache, "version"))
|
const version = await Bun.file(path.join(Global.Path.cache, "version"))
|
||||||
.text()
|
.text()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue