mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
@@ -88,6 +88,14 @@ export OPENAI_BASE_URL="https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
|
|||||||
export OPENAI_MODEL="qwen3-coder-plus"
|
export OPENAI_MODEL="qwen3-coder-plus"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
OpenRouter also provides free Qwen3-Coder model access:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export OPENAI_API_KEY="your_api_key_here"
|
||||||
|
export OPENAI_BASE_URL=https://openrouter.ai/api/v1
|
||||||
|
export OPENAI_MODEL="qwen/qwen3-coder:free"
|
||||||
|
```
|
||||||
|
|
||||||
## Usage Examples
|
## Usage Examples
|
||||||
|
|
||||||
### Explore Codebases
|
### Explore Codebases
|
||||||
|
|||||||
@@ -118,11 +118,21 @@ export class OpenAIContentGenerator implements ContentGenerator {
|
|||||||
timeoutConfig.maxRetries = contentGeneratorConfig.maxRetries;
|
timeoutConfig.maxRetries = contentGeneratorConfig.maxRetries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if using OpenRouter and add required headers
|
||||||
|
const isOpenRouter = baseURL.includes('openrouter.ai');
|
||||||
|
const defaultHeaders = isOpenRouter
|
||||||
|
? {
|
||||||
|
'HTTP-Referer': 'https://github.com/QwenLM/qwen-code.git',
|
||||||
|
'X-Title': 'Qwen Code',
|
||||||
|
}
|
||||||
|
: undefined;
|
||||||
|
|
||||||
this.client = new OpenAI({
|
this.client = new OpenAI({
|
||||||
apiKey,
|
apiKey,
|
||||||
baseURL,
|
baseURL,
|
||||||
timeout: timeoutConfig.timeout,
|
timeout: timeoutConfig.timeout,
|
||||||
maxRetries: timeoutConfig.maxRetries,
|
maxRetries: timeoutConfig.maxRetries,
|
||||||
|
defaultHeaders,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user