It looks like you may prefer a different language. Switch anytime.

設置指南

如何在 VS Code 和 n8n 中添加 OpenAI API 金鑰

Add RunAPI's OpenAI-compatible key to Continue, Cody, or any VS Code AI extension in under 2 minutes. The same key works in n8n's OpenAI node. One key, one credit balance — GPT-4o, Claude, Gemini, and 100+ models at 50% off the direct price. No ChatGPT subscription needed.

更新日期:June 23, 2026 RunAPI 編輯部
一覽

本指南涵蓋哪些內容?

VS Code AI extensions and n8n both accept an OpenAI-compatible base URL and API key. RunAPI provides exactly that interface at api.runapi.ai/v1. You sign up once, generate a key, add credits, and paste the key into your tool of choice. Every call is billed per token at half the direct price — no subscription, no minimum spend, and no separate account per model. One thing to know upfront if you are also setting up OpenAI directly: a ChatGPT subscription does not grant API access. You need a separate API credit balance, and 429 errors almost always mean that balance is zero.

VS Code settings.json

任何從 settings.json 讀取 openai.apiKey 或自訂基礎 URL 的擴充套件都可以無需修改程式碼地指向 RunAPI。

Continue 擴充套件

Continue 的 config.yaml 接受帶有自訂 apiBase 的 provider: openai。輸入 api.runapi.ai/v1 和您的 RunAPI 金鑰即可。

n8n OpenAI 節點

n8n's OpenAI credential lets you override the base URL. Enter api.runapi.ai/v1 and your RunAPI key — all existing workflows keep working.

官方定價 50% 折扣

GPT-4o 輸入透過 OpenAI 每百萬 token 費用 $2.50。透過 RunAPI 則為 $1.25。同樣的折扣也適用於 Claude、Gemini 和 DeepSeek。

VS CODE

在 VS Code settings.json 中設定 API 金鑰

Open Command Palette (Cmd+Shift+P on macOS, Ctrl+Shift+P on Windows/Linux) and select Preferences: Open User Settings (JSON). Add or update the following block. Replace YOUR_RUNAPI_KEY with the key from your RunAPI dashboard. If your extension stores its key in its own settings panel (not in openai.apiKey), check the extension README for the exact field name — the base URL field is usually labeled apiBase or baseURL.

CONTINUE 擴充套件

將 RunAPI 添加到 Continue 擴充套件

Continue is a popular open-source AI coding assistant for VS Code and JetBrains. It stores its config in ~/.continue/config.yaml (or config.json for older versions). Pointing it to RunAPI gives you access to every model in the catalog through the same familiar chat and autocomplete interface. After saving the file, restart VS Code so Continue picks up the new config — the model you added will then appear in the Continue model picker.

N8N 自動化

如何在 n8n 中添加 OpenAI API 金鑰

n8n's OpenAI node uses a credential called OpenAI API. That credential has a Base URL field (hidden by default under Additional Fields) that lets you redirect all calls to any OpenAI-compatible endpoint. Set it to RunAPI and every workflow that calls the OpenAI node routes through RunAPI automatically — no other changes needed.

定價

透過 RunAPI 與直連各模型的費用對比

RunAPI charges 50% of the official vendor price for all LLM models. There is no monthly fee or subscription. You top up credits and pay only for what you use — failed requests are not charged. A ChatGPT Plus subscription is not required and does not grant API access; the API has separate billing regardless of which provider you use.

顯示的價格為輸入 token 費用。輸出 token 定價同樣享受 50% 折扣。完整列表請見 runapi.ai/pricing。

快速入門

如何獲取您的 RunAPI 金鑰並連接它

1

建立免費 RunAPI 帳戶

前往 runapi.ai,用您的電子郵件註冊。建立帳戶或生成 API 金鑰不需要信用卡。

2

生成 API 金鑰

Open your dashboard and navigate to API Keys. Click New Key, give it a name (e.g. vscode-dev), and copy the key immediately — it starts with rp- and is shown only once. Save it somewhere safe before closing the dialog.

3

添加點數

Go to Billing and add a small top-up — $5 is enough to start. Credits never expire and you are only charged for successful API calls. Without a credit balance, API calls return a 429 error.

4

設定 VS Code

開啟 VS Code settings.json(Cmd+Shift+P > 偏好設定:開啟使用者設定 (JSON))。將 openai.baseURL 設定為 https://api.runapi.ai/v1,將 openai.apiKey 設定為您的 RunAPI 金鑰。

5

設定 Continue(可選)

如果您使用 Continue 擴充套件,開啟 ~/.continue/config.yaml 並添加一個模型條目,設定 provider: openai、apiBase: https://api.runapi.ai/v1 以及您的 apiKey。

6

設定 n8n(可選)

在 n8n 中,開啟設定 > 憑證 > OpenAI API。將您的 RunAPI 金鑰貼入 API 金鑰欄位,並在「其他欄位」下的基礎 URL 欄位中輸入 https://api.runapi.ai/v1。

7

透過測試呼叫進行驗證

Ask your VS Code extension a question or trigger an n8n workflow. Check your RunAPI dashboard under Usage to confirm the call went through.

常見問題

VS Code 和 n8n API 設定常見問題

Can I use my paid ChatGPT subscription instead of buying API credits?

No. A ChatGPT Plus or GPT-4 subscription gives you access to the chat interface only — it does not grant API access. The API has separate billing. You add a credit balance at platform.openai.com/billing and pay per call. If you skip that step, every API call comes back as a 429 error even though your subscription is active.

I set everything up but I keep getting a 429 error. What's wrong?

That means your credit balance is zero. OpenAI requires a billing credit balance above zero before any API call will go through — having an account and a valid key is not enough. Go to platform.openai.com/billing, add at least $5, and the 429 error stops. Through RunAPI you top up once and use any model with the same key.

I created an API key but forgot to save it. Can I see it again?

You cannot. The key is shown exactly once when you create it. Close the dialog before copying and it is gone — you will need to create a new key. Go back to the API Keys page, delete the old one, and create a fresh key. Copy it immediately and save it somewhere safe before closing the dialog.

Why does my API key have the word "project" in it? Is that normal?

Keys that show the word "project" in the name are project-scoped keys, which are the default type OpenAI now creates. They work exactly the same as personal keys for making API calls. The difference is they are tied to a specific OpenAI project in your dashboard rather than to your user account. Either type works fine — just copy and use it.

Can I use the same RunAPI key in both VS Code and n8n?

Yes. One RunAPI key works across all tools that accept an OpenAI-compatible API key and base URL. You can use the same key in VS Code extensions, n8n, Cursor, Claude Code, and any other OpenAI-compatible client without generating separate keys.

Which VS Code AI extensions work with a custom base URL?

Continue, Cody (via proxy mode), and most extensions that expose an openai.baseURL or equivalent setting work. GitHub Copilot does not support a custom base URL — it is locked to GitHub's endpoint. Copilot requires a paid GitHub subscription; there is no way to plug your own API key into it. For a Copilot alternative that accepts a custom key, Continue or Cody are the most common choices.

What model names do I use in VS Code or n8n?

Use the exact model IDs from RunAPI's catalog — for example gpt-4o, gpt-4o-mini, claude-sonnet-4-5, or gemini-2.0-flash. These identifiers match what you would pass to the OpenAI API directly. If a model ID is wrong, the API returns a 404. The complete list with per-token pricing is at runapi.ai/models.

在 VS Code 中全天使用 GPT-4o 透過 RunAPI 需要多少費用?

典型的編程會話大約生成 50,000–200,000 個輸入 token。按 RunAPI 的 GPT-4o 輸入費率每百萬 $1.25 計算,每天費用約為 $0.06–$0.25。輸出 token 以及擴充套件發送的任何額外上下文按相同的 50% 折扣單獨計費,以 OpenAI 官方費率為準。

相關內容

繼續探索

2 分鐘內設定您的 API 金鑰

建立一個免費的 RunAPI 帳戶,生成金鑰,然後將其貼入 VS Code 或 n8n。100 多個模型,享 50% 折扣——無需訂閱,無最低消費。