MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / ensureClient

Method ensureClient

src/api/providers/qwen-code.ts:66–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64 }
65
66 private ensureClient(): OpenAI {
67 if (!this.client) {
68 // Create the client instance with dummy key initially
69 // The API key will be updated dynamically via ensureAuthenticated
70 this.client = new OpenAI({
71 apiKey: "dummy-key-will-be-replaced",
72 baseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1",
73 defaultHeaders: {
74 "User-Agent": `QwenCode/1.0.0 (${os.platform()}; ${os.arch()})`,
75 "X-DashScope-CacheControl": "enable",
76 "X-DashScope-UserAgent": `QwenCode/1.0.0 (${os.platform()}; ${os.arch()})`,
77 "X-DashScope-AuthType": "qwen-oauth",
78 },
79 timeout: this.timeoutMs,
80 })
81 }
82 return this.client
83 }
84
85 private async loadCachedQwenCredentials(): Promise<QwenOAuthCredentials> {
86 try {

Callers 4

ensureAuthenticatedMethod · 0.95
callApiWithRetryMethod · 0.95
createMessageMethod · 0.95
completePromptMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected