mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 11:41:04 +00:00
* docs: update quota exceeded alternatives to OpenRouter and Fireworks - Update README.md news section to recommend OpenRouter and Fireworks as primary alternatives, with ModelStudio as third option - Update retry.ts quota error message to include OpenRouter and Fireworks URLs for users whose OAuth quota has been exhausted Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(test): update retry test assertions to match new quota error message * docs: update free tier quota to 100 req/day with sunset notice and alternatives Update all references to reflect the Qwen OAuth free tier policy change: - 1,000 → 100 requests/day across code, i18n, and docs - Add 2026-04-15 sunset date everywhere - Guide users to OpenRouter, Fireworks AI, or ModelStudio in docs - Remove CHANGELOG.md --------- Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> Co-authored-by: tanzhenxin <tanzhenxing1987@gmail.com>
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Qwen Team
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { AuthType } from '@qwen-code/qwen-code-core';
|
|
import type { AuthMethod } from '@agentclientprotocol/sdk';
|
|
|
|
export function buildAuthMethods(): AuthMethod[] {
|
|
return [
|
|
{
|
|
id: AuthType.USE_OPENAI,
|
|
name: 'Use OpenAI API key',
|
|
description: 'Requires setting the `OPENAI_API_KEY` environment variable',
|
|
_meta: {
|
|
type: 'terminal',
|
|
args: ['--auth-type=openai'],
|
|
},
|
|
},
|
|
{
|
|
id: AuthType.QWEN_OAUTH,
|
|
name: 'Qwen OAuth',
|
|
description:
|
|
'OAuth authentication for Qwen models with free daily requests (ending 2026-04-15)',
|
|
_meta: {
|
|
type: 'terminal',
|
|
args: ['--auth-type=qwen-oauth'],
|
|
},
|
|
},
|
|
];
|
|
}
|
|
|
|
export function filterAuthMethodsById(
|
|
authMethods: AuthMethod[],
|
|
authMethodId: string,
|
|
): AuthMethod[] {
|
|
return authMethods.filter((method) => method.id === authMethodId);
|
|
}
|
|
|
|
export function pickAuthMethodsForDetails(details?: string): AuthMethod[] {
|
|
const authMethods = buildAuthMethods();
|
|
if (!details) {
|
|
return authMethods;
|
|
}
|
|
if (details.includes('qwen-oauth') || details.includes('Qwen OAuth')) {
|
|
const narrowed = filterAuthMethodsById(authMethods, AuthType.QWEN_OAUTH);
|
|
return narrowed.length ? narrowed : authMethods;
|
|
}
|
|
return authMethods;
|
|
}
|