{"id":390,"date":"2026-04-09T16:02:18","date_gmt":"2026-04-09T08:02:18","guid":{"rendered":"https:\/\/feiyangblog.eu.org\/?p=390"},"modified":"2026-10-17T02:02:18","modified_gmt":"2026-10-16T18:02:18","slug":"vs-code-%e4%bd%bf%e7%94%a8continue%e6%8f%92%e4%bb%b6%e6%8e%a5%e5%85%a5openai-%e5%85%bc%e5%ae%b9%e6%8f%90%e4%be%9b%e5%95%86api","status":"publish","type":"post","link":"https:\/\/feiyangblog.eu.org\/?p=390","title":{"rendered":"VS Code \u4f7f\u7528Continue\u63d2\u4ef6\u63a5\u5165OpenAI \u517c\u5bb9\u63d0\u4f9b\u5546API"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u4e00\u3001\u5b89\u88c5Continue\u63d2\u4ef6<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728 VScode \u5e94\u7528\u5546\u5e97\u641c\u7d22  Continue &#8211; open-source AI code agent  \u5b89\u88c5\u63d2\u4ef6<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u65b0\u5efanode\u9879\u76ee\uff08\u4ee5\u9879\u76ee\u540d\u5b57 openAPI \u4e3a\u4f8b\uff0c\u76ee\u5f55\u4e3a D:\/openAPI\uff09<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u65b0\u5efa\u9879\u76ee\u6587\u4ef6\u5939 openAPI \uff0c\u5728\u8be5\u9879\u76ee\u6587\u4ef6\u5939\u4e0b\u6253\u5f00cmd\u7ec8\u7aef\uff0c\u8f93\u5165<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm init -y  <\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install axios<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u5728\u9879\u76ee\u4e0b\u65b0\u5efa  generate-config.js  \u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const axios = require('axios');\nconst fs = require('fs');\nconst path = require('path');\n\n\/\/ \u4ee3\u7406API\u5730\u5740\nconst apiBaseUrl = 'https:\/\/modelapi.com\/v1'; \/\/\u66ff\u6362\u4e3a\u4f60\u7684API\u5730\u5740\nconst apiKey = 'sk-modelkey';\/\/\u66ff\u6362\u4e3a\u4f60\u7684API\u5bc6\u94a5\n\n\/\/ Continue \u914d\u7f6e\u6587\u4ef6\u5730\u5740\nconst outputPath = 'C:\\\\Users\\\\feiyang\\\\.continue\\\\config.yaml';  \/\/\u66ff\u6362\u4e3a\u4f60\u7684Continue \u914d\u7f6e\u6587\u4ef6\u5730\u5740\n\n\/\/ \u83b7\u53d6\u6a21\u578b\u5217\u8868\nasync function getModels() {\n  try {\n    const response = await axios.get(`${apiBaseUrl}\/models`, {\n      headers: {\n        Authorization: `Bearer ${apiKey}`,\n      },\n      timeout: 20000,\n    });\n\n    \/\/ \u83b7\u53d6\u6a21\u578b\u6570\u636e\n    const models = response.data.data || &#91;];\n\n    if (!Array.isArray(models) || models.length === 0) {\n      console.log('\u6ca1\u6709\u83b7\u53d6\u5230\u6a21\u578b\u5217\u8868');\n      return;\n    }\n    \/\/ \u751f\u6210\u914d\u7f6e\u5185\u5bb9\n    const config = {\n      name: 'Local Config',\n      version: '1.0.0',\n      schema: 'v1',\n      models: models.map((model) =&gt; ({\n        name: model.id,\n        provider: 'openai',\n        model: model.id,\n        apiBase: apiBaseUrl,\n        apiKey: apiKey,\n        useResponsesApi: false,\n      })),\n    };\n\n    \/\/ \u786e\u4fdd\u76ee\u5f55\u5b58\u5728\n    fs.mkdirSync(path.dirname(outputPath), { recursive: true });\n\n    \/\/ \u76f4\u63a5\u8986\u76d6 Continue \u914d\u7f6e\u6587\u4ef6\n    fs.writeFileSync(outputPath, generateYaml(config), 'utf8');\n\n    console.log(`Continue \u914d\u7f6e\u6587\u4ef6\u5df2\u751f\u6210\u5e76\u8986\u76d6\uff1a${outputPath}`);\n    console.log(`\u5171\u5199\u5165 ${config.models.length} \u4e2a\u6a21\u578b`);\n  } catch (error) {\n    console.error('\u83b7\u53d6\u6a21\u578b\u5217\u8868\u65f6\u51fa\u9519:');\n\n    if (error.response) {\n      console.error('\u72b6\u6001\u7801:', error.response.status);\n      console.error('\u8fd4\u56de\u5185\u5bb9:', error.response.data);\n    } else {\n      console.error(error.message);\n    }\n  }\n}\n\n\/\/ \u751f\u6210 YAML \u914d\u7f6e\u5185\u5bb9\nfunction generateYaml(config) {\n  let yaml = `name: ${config.name}\\nversion: ${config.version}\\nschema: ${config.schema}\\n\\nmodels:\\n`;\n\n  config.models.forEach((model, index) =&gt; {\n    yaml += `  - name: ${model.name}\\n`;\n    yaml += `    provider: ${model.provider}\\n`;\n    yaml += `    model: ${model.model}\\n`;\n    yaml += `    apiBase: ${model.apiBase}\\n`;\n    yaml += `    apiKey: ${model.apiKey}\\n`;\n    yaml += `    useResponsesApi: ${model.useResponsesApi}\\n`;\n\n    \/\/ \u6700\u540e\u4e00\u9879\u540e\u9762\u4e0d\u518d\u989d\u5916\u8865\u7a7a\u884c\n    if (index !== config.models.length - 1) {\n      yaml += ``;\n    }\n  });\n\n  return yaml;\n}\n\n\/\/ \u6267\u884c\u83b7\u53d6\u6a21\u578b\u5e76\u751f\u6210\u914d\u7f6e\u6587\u4ef6\ngetModels();  <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u8fd0\u884c\u9879\u76ee<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node D:\\openAPI\\generate-config.js<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c31\u53ef\u4ee5\u751f\u6210Continue\u7684\u914d\u7f6e\u6587\u4ef6\u5e76\u66ff\u6362Continue\u539f\u6709\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u6837\u5c31\u53ef\u4ee5\u81ea\u52a8\u751f\u6210\u914d\u7f6e\u6587\u4ef6\uff0c\u4e0d\u9700\u8981\u4e00\u4e2a\u4e2a\u53bb\u914d\u7f6e\u6a21\u578b<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001\u5728windows\u4efb\u4f55\u4f4d\u7f6e\u7ec8\u7aef\u4e0b\u66f4\u65b0\u914d\u7f6e\u6587\u4ef6\uff08\u53ef\u9009\uff09<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u9879\u76ee\u6587\u4ef6\u5939\u65b0\u5efabin\u76ee\u5f55 \u540d\u5b57\u968f\u610f\uff0c\u518d\u5728\u8be5\u6587\u4ef6\u76ee\u5f55\u4e0b\u65b0\u5efaupm.bat \u6587\u4ef6\uff0c\u540d\u5b57\u968f\u610f\u5c3d\u91cf\u7b80\u77ed<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@echo off\nnode D:\\openAPI\\generate-config.js\ntimeout \/t 2 \/nobreak &gt;nul<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728upm.bat\u91cc\u9762\u6dfb\u52a0\u4ee5\u4e0a\u4ee3\u7801<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06D:\\openAPI\\bin \u6dfb\u52a0\u5230windows\u73af\u5883\u53d8\u91cf\u7684path<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6253\u5f00\u4e00\u4e2a\u65b0\u7684cmd\u7ec8\u7aef\u8f93\u5165 upm \u5c31\u53ef\u4ee5\u66f4\u65b0Continue\u7684\u914d\u7f6e\u6587\u4ef6\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<div class=\"posilafejo\"><div style=\"position:absolute;top:-8726px;\"><p><div style=\"position:absolute;top: -9973px;\">Good examples turn abstract instructions into decisions that readers can evaluate, which is why they remain central to teaching, product design, public policy, and technical documentation. A strong illustration does more than repeat a rule: it identifies the relevant conditions, shows the process in sequence, and makes clear why one outcome follows from another. In classroom assessment, a short <a href=\"https:\/\/example175.com\">test<\/a> built around a realistic case measures whether students can transfer a principle to new facts rather than merely recall its definition. The surrounding explanation should then distinguish essential details from distracting ones, since learners often mistake familiar wording for genuine understanding. Comparisons are especially effective when they place a successful approach beside a plausible but flawed alternative and explain the difference without oversimplifying it. Used with restraint, concrete illustrations improve clarity while leaving enough complexity for readers to apply the underlying idea independently.<\/div><\/p><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u5b89\u88c5Continue\u63d2\u4ef6 \u5728 VScode \u5e94\u7528\u5546\u5e97\u641c\u7d22 Continue &#8211; open-so [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"wpai_generated_summary":"","wpai_meta_description":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-390","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"views":576,"_links":{"self":[{"href":"https:\/\/feiyangblog.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/feiyangblog.eu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/feiyangblog.eu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/feiyangblog.eu.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/feiyangblog.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=390"}],"version-history":[{"count":5,"href":"https:\/\/feiyangblog.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/390\/revisions"}],"predecessor-version":[{"id":451,"href":"https:\/\/feiyangblog.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/390\/revisions\/451"}],"wp:attachment":[{"href":"https:\/\/feiyangblog.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/feiyangblog.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/feiyangblog.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}