Skip to content

Commit dfa22c0

Browse files
feat: feature openrouter in onboarding provider picker
1 parent b318f35 commit dfa22c0

6 files changed

Lines changed: 32 additions & 1 deletion

File tree

extensions/openrouter/index.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ type OpenRouterManifest = {
8787
groupLabel?: string;
8888
groupHint?: string;
8989
onboardingScopes?: string[];
90+
onboardingFeatured?: boolean;
9091
}>;
9192
};
9293

@@ -137,6 +138,7 @@ describe("openrouter provider hooks", () => {
137138
groupLabel: choice.groupLabel,
138139
groupHint: choice.groupHint,
139140
onboardingScopes: choice.onboardingScopes,
141+
onboardingFeatured: choice.onboardingFeatured,
140142
}));
141143

142144
expect(
@@ -160,6 +162,7 @@ describe("openrouter provider hooks", () => {
160162
groupLabel: method.wizard?.groupLabel,
161163
groupHint: method.wizard?.groupHint,
162164
onboardingScopes: method.wizard?.onboardingScopes,
165+
onboardingFeatured: method.wizard?.onboardingFeatured,
163166
})),
164167
).toEqual(manifestChoices);
165168

@@ -176,6 +179,20 @@ describe("openrouter provider hooks", () => {
176179
expect(oauthChoice?.method.id).toBe("oauth");
177180
});
178181

182+
it("features OpenRouter OAuth in the top-level onboarding picker", () => {
183+
const oauthChoice = readManifest().providerAuthChoices?.find(
184+
(choice) => choice.choiceId === "openrouter-oauth",
185+
);
186+
187+
expect(oauthChoice).toMatchObject({
188+
provider: "openrouter",
189+
method: "oauth",
190+
groupId: "openrouter",
191+
groupLabel: "OpenRouter",
192+
onboardingFeatured: true,
193+
});
194+
});
195+
179196
it("includes current Kimi models in the bundled catalog", () => {
180197
const modelIds = buildOpenrouterProvider().models?.map((model) => model.id) ?? [];
181198
expect(modelIds).toContain("moonshotai/kimi-k2.6");

extensions/openrouter/oauth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ export function createOpenRouterOAuthAuthMethod(): ProviderAuthMethod {
419419
groupHint: "OAuth or API key",
420420
methodId: OPENROUTER_OAUTH_METHOD_ID,
421421
onboardingScopes: ["text-inference", "music-generation"],
422+
onboardingFeatured: true,
422423
},
423424
run: async (ctx) => await loginOpenRouterOAuth(ctx),
424425
};

extensions/openrouter/openclaw.plugin.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
"groupId": "openrouter",
6868
"groupLabel": "OpenRouter",
6969
"groupHint": "OAuth or API key",
70-
"onboardingScopes": ["text-inference", "music-generation"]
70+
"onboardingScopes": ["text-inference", "music-generation"],
71+
"onboardingFeatured": true
7172
}
7273
],
7374
"contracts": {

extensions/openrouter/provider-contract-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export function createOpenrouterProvider(): ProviderPlugin {
3838
groupHint: "OAuth or API key",
3939
methodId: "oauth",
4040
onboardingScopes: ["text-inference", "music-generation"],
41+
onboardingFeatured: true,
4142
},
4243
},
4344
],

src/commands/auth-choice-options.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,15 @@ describe("buildAuthChoiceOptions", () => {
510510
groupId: "byteplus",
511511
groupLabel: "BytePlus",
512512
},
513+
{
514+
pluginId: "openrouter",
515+
providerId: "openrouter",
516+
methodId: "oauth",
517+
choiceId: "openrouter-oauth",
518+
choiceLabel: "OpenRouter OAuth",
519+
groupId: "openrouter",
520+
groupLabel: "OpenRouter",
521+
},
513522
]);
514523

515524
const { groups } = buildAuthChoiceGroups({
@@ -522,6 +531,7 @@ describe("buildAuthChoiceOptions", () => {
522531
"Anthropic",
523532
"xAI (Grok)",
524533
"Google",
534+
"OpenRouter",
525535
"BytePlus",
526536
"Custom Provider",
527537
"LiteLLM",

src/commands/auth-choice-options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const FEATURED_AUTH_GROUP_ORDER = new Map<string, number>([
2020
["anthropic", 1],
2121
["xai", 2],
2222
["google", 3],
23+
["openrouter", 4],
2324
]);
2425

2526
function compareAssistantOptions(a: AuthChoiceOption, b: AuthChoiceOption): number {

0 commit comments

Comments
 (0)