Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 67 additions & 42 deletions branding/qbraid/generate-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,39 @@ const models = {
id: "qbraid",
name: "qBraid",
env: ["QBRAID_API_KEY"],
npm: "@ai-sdk/openai-compatible",
api: "https://api.qbraid.com/ai/v1",
npm: "@ai-sdk/qbraid",
api: "https://account.qbraid.com/api/ai/v1",
models: {
"claude-sonnet-4": {
id: "claude-sonnet-4",
name: "Claude Sonnet 4",
family: "claude",
release_date: "2025-05-22",
"claude-opus-4-8": {
id: "claude-opus-4-8",
name: "Claude Opus 4.8",
family: "claude-opus",
release_date: "2026-01-01",
attachment: true,
reasoning: true,
temperature: true,
tool_call: true,
cost: {
input: 5,
output: 25,
cache_read: 0.5,
cache_write: 6.25,
},
limit: {
context: 1000000,
output: 128000,
},
modalities: {
input: ["text", "image", "pdf"],
output: ["text"],
},
options: {},
},
"claude-sonnet-4-6": {
id: "claude-sonnet-4-6",
name: "Claude 4.6 Sonnet",
family: "claude-sonnet",
release_date: "2026-01-01",
attachment: true,
reasoning: true,
temperature: true,
Expand All @@ -60,8 +85,8 @@ const models = {
cache_write: 3.75,
},
limit: {
context: 200000,
output: 16000,
context: 1000000,
output: 64000,
},
modalities: {
input: ["text", "image", "pdf"],
Expand All @@ -71,73 +96,73 @@ const models = {
},
"claude-haiku-4-5": {
id: "claude-haiku-4-5",
name: "Claude Haiku 4.5",
family: "claude",
release_date: "2025-05-22",
name: "Claude 4.5 Haiku",
family: "claude-haiku",
release_date: "2025-10-15",
attachment: true,
reasoning: false,
reasoning: true,
temperature: true,
tool_call: true,
cost: {
input: 0.8,
output: 4,
cache_read: 0.08,
cache_write: 1,
input: 1,
output: 5,
cache_read: 0.1,
cache_write: 1.25,
},
limit: {
context: 200000,
output: 8192,
output: 64000,
},
modalities: {
input: ["text", "image", "pdf"],
output: ["text"],
},
options: {},
},
"gpt-4o": {
id: "gpt-4o",
name: "GPT-4o",
family: "gpt",
release_date: "2024-05-13",
"gemini-3.1-pro": {
id: "gemini-3.1-pro",
name: "Gemini 3.1 Pro",
family: "gemini-pro",
release_date: "2026-01-01",
attachment: true,
reasoning: false,
reasoning: true,
temperature: true,
tool_call: true,
cost: {
input: 2.5,
output: 10,
cache_read: 1.25,
input: 2,
output: 12,
cache_read: 0.2,
},
limit: {
context: 128000,
output: 16384,
context: 1048576,
output: 65536,
},
modalities: {
input: ["text", "image"],
input: ["text", "image", "video", "audio", "pdf"],
output: ["text"],
},
options: {},
},
"gpt-4o-mini": {
id: "gpt-4o-mini",
name: "GPT-4o Mini",
family: "gpt",
release_date: "2024-07-18",
"gemini-3.5-flash": {
id: "gemini-3.5-flash",
name: "Gemini 3.5 Flash",
family: "gemini-flash",
release_date: "2026-05-19",
attachment: true,
reasoning: false,
reasoning: true,
temperature: true,
tool_call: true,
cost: {
input: 0.15,
output: 0.6,
cache_read: 0.075,
input: 0.5,
output: 3,
cache_read: 0.05,
},
limit: {
context: 128000,
output: 16384,
context: 1048576,
output: 65535,
},
modalities: {
input: ["text", "image"],
input: ["text", "image", "video", "audio", "pdf"],
output: ["text"],
},
options: {},
Expand Down
66 changes: 21 additions & 45 deletions branding/qbraid/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"name": "qBraid",
"env": ["QBRAID_API_KEY"],
"npm": "@ai-sdk/qbraid",
"api": "https://account-v2.qbraid.com/api/ai/v1",
"api": "https://account.qbraid.com/api/ai/v1",
"models": {
"claude-opus-4-6": {
"id": "claude-opus-4-6",
"name": "Claude 4.6 Opus",
"claude-opus-4-8": {
"id": "claude-opus-4-8",
"name": "Claude Opus 4.8",
"family": "claude-opus",
"release_date": "2026-02-06",
"release_date": "2026-01-01",
"attachment": true,
"reasoning": true,
"temperature": true,
Expand All @@ -26,16 +26,16 @@
"cache_write": 6.25
},
"limit": {
"context": 200000,
"output": 64000
"context": 1000000,
"output": 128000
},
"options": {}
},
"claude-sonnet-4-5": {
"id": "claude-sonnet-4-5",
"name": "Claude 4.5 Sonnet",
"claude-sonnet-4-6": {
"id": "claude-sonnet-4-6",
"name": "Claude 4.6 Sonnet",
"family": "claude-sonnet",
"release_date": "2025-09-29",
"release_date": "2026-01-01",
"attachment": true,
"reasoning": true,
"temperature": true,
Expand All @@ -51,7 +51,7 @@
"cache_write": 3.75
},
"limit": {
"context": 200000,
"context": 1000000,
"output": 64000
},
"options": {}
Expand Down Expand Up @@ -81,11 +81,11 @@
},
"options": {}
},
"gemini-3-pro": {
"id": "gemini-3-pro",
"name": "Gemini 3 Pro",
"gemini-3.1-pro": {
"id": "gemini-3.1-pro",
"name": "Gemini 3.1 Pro",
"family": "gemini-pro",
"release_date": "2025-11-18",
"release_date": "2026-01-01",
"attachment": true,
"reasoning": true,
"temperature": true,
Expand All @@ -110,11 +110,11 @@
},
"options": {}
},
"gemini-3-flash": {
"id": "gemini-3-flash",
"name": "Gemini 3 Flash",
"gemini-3.5-flash": {
"id": "gemini-3.5-flash",
"name": "Gemini 3.5 Flash",
"family": "gemini-flash",
"release_date": "2025-12-17",
"release_date": "2026-05-19",
"attachment": true,
"reasoning": true,
"temperature": true,
Expand All @@ -135,31 +135,7 @@
},
"limit": {
"context": 1048576,
"output": 65536
},
"options": {}
},
"grok-4.1-fast": {
"id": "grok-4.1-fast",
"name": "Grok 4.1 Fast",
"family": "grok",
"release_date": "2025-11-19",
"attachment": true,
"reasoning": false,
"temperature": true,
"tool_call": true,
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"cost": {
"input": 0.2,
"output": 0.5,
"cache_read": 0.05
},
"limit": {
"context": 2000000,
"output": 30000
"output": 65535
},
"options": {}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/opencode/src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { CodexAuthPlugin } from "./codex"
import { Session } from "../session"
import { NamedError } from "@opencode-ai/util/error"
import { CopilotAuthPlugin } from "./copilot"
import { QBraidAuthPlugin } from "./qbraid"
import { gitlabAuthPlugin as GitlabAuthPlugin } from "@gitlab/opencode-gitlab-auth"

export namespace Plugin {
Expand All @@ -19,7 +20,7 @@ export namespace Plugin {
const BUILTIN = ["opencode-anthropic-auth@0.0.13"]

// Built-in plugins that are directly imported (not installed from npm)
const INTERNAL_PLUGINS: PluginInstance[] = [CodexAuthPlugin, CopilotAuthPlugin, GitlabAuthPlugin]
const INTERNAL_PLUGINS: PluginInstance[] = [CodexAuthPlugin, CopilotAuthPlugin, QBraidAuthPlugin, GitlabAuthPlugin]

const state = Instance.state(async () => {
const client = createOpencodeClient({
Expand Down
55 changes: 55 additions & 0 deletions packages/opencode/src/plugin/qbraid.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import type { Hooks, PluginInput } from "@opencode-ai/plugin"
import { QBRAID_BASE_URL } from "@/provider/qbraid-models"

/**
* Built-in qBraid auth plugin.
*
* Enables `opencode auth login` -> "qBraid" -> paste API token.
* The token is a qBraid access token (qbr-at_...) or API key, stored as a
* standard API credential and sent to the qBraid AI proxy as a Bearer token
* by the qBraid provider SDK.
*/
export async function QBraidAuthPlugin(_input: PluginInput): Promise<Hooks> {
return {
auth: {
provider: "qbraid",
async loader(getAuth) {
const info = await getAuth()
if (!info || info.type !== "api") return {}
return {
apiKey: info.key,
baseURL: QBRAID_BASE_URL,
}
},
methods: [
{
type: "api",
label: "qBraid API Key",
prompts: [
{
type: "text",
key: "key",
message: "Enter your qBraid API token",
placeholder: "qbr-at_...",
validate: (value) => {
if (!value) return "API token is required"
if (!value.startsWith("qbr-at_") && !value.startsWith("qbr_"))
return "Expected a qBraid token (qbr-at_... or qbr_...)"
return undefined
},
},
],
async authorize(inputs = {}) {
const key = inputs.key
if (!key) return { type: "failed" as const }
return {
type: "success" as const,
key,
provider: "qbraid",
}
},
},
],
},
}
}
Loading