EN ▾
Get API key

Updated

DeepSeek API Key in VS Code: Setup With Our API

VS Code has no built-in field for a custom model key, but extensions such as Continue and Cline accept any OpenAI-compatible endpoint. Here is the setup, a test to run first, and what coding sessions cost.

Illustration of a code editor linked by a glowing cable to a server, representing an API connection in VS Code

The short version

You asked how to use deepseek api key in vscode, and the answer has two parts. First, VS Code itself does not take an API key for a language model; an extension does. Second, the key from this site is not a DeepSeek key. It belongs to an independent, OpenAI-compatible API that runs one open-weight model, tuned to answer without content refusals for lawful adult use, and it is not the official API of DeepSeek. If you hold a key from DeepSeek's own platform, enter it with DeepSeek's endpoint instead.

For this API, every extension needs the same three values:

  • Base URL: https://api.deepseekapikey.com/v1
  • API key: the key from your account, sent as a Bearer token
  • Model: uncensored

The sections below show where those values go in Continue and in extensions of the Cline family, then how to check that everything works and keep costs predictable.

Before you start: get a key and test it

Sign up on the API key page with Google or with email and password. New users can claim $0.50 of trial credit with one click, valid for 7 days, one per person, no card required. Paid top-ups start at $20.

Open the integrated terminal in VS Code (Ctrl+` or Cmd+`) and run a request. If this works, any later failure is an extension setting rather than a key problem.

export API_KEY="paste-your-key-here"

curl https://api.deepseekapikey.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a Python function that reverses a string."}],
    "max_tokens": 200
  }'

A JSON reply with a choices array means the key, URL and model name are right. A 401 means a bad key. A 404 usually means a wrong path. You can also hit GET /v1/models with the same header as a cheap check.

Option 1: the Continue extension

Continue is an open-source assistant extension for VS Code that lets you define your own models. Install it from the Extensions view, open its settings, and add a model that uses the OpenAI provider with a custom API base. Continue has moved its configuration format over time, from a JSON file to a YAML file, so check the extension's current documentation if your file looks different. The fields carry the same meaning in both. In the JSON form, a model entry looks like this:

{
  "models": [
    {
      "title": "Uncensored API",
      "provider": "openai",
      "model": "uncensored",
      "apiBase": "https://api.deepseekapikey.com/v1",
      "apiKey": "YOUR_KEY"
    }
  ]
}

In the YAML form, the model entry carries the same keys: a name, provider: openai, model: uncensored, apiBase set to the base URL, and the key. Save the file, pick the new model in Continue's model dropdown, and ask a question in the side panel.

Note that this API documents chat completions only. Chat, edit and explain features are the natural fit. Inline tab autocomplete usually relies on a different request style meant for completing text in the middle of a line, which is not listed among this API's features, so do not expect it to work. Keep a separate autocomplete provider for that if you need one.

The key sits in a file, so keep that file out of your repository. If you use a workspace-level config, add it to .gitignore, or use the global config in your home directory.

Option 2: Cline and similar agent extensions

Cline, and extensions derived from it such as Roo Code, run an agent that reads files, proposes edits and runs commands with your approval. Their settings panel has an API provider dropdown. Choose the entry for an OpenAI-compatible provider and fill in the form:

  1. Base URL: https://api.deepseekapikey.com/v1
  2. API key: your key
  3. Model ID: uncensored

Some versions ask for a context window size and a maximum output value for the custom model. Enter 100000 for the window, since that is the size of this API's context, prompt and completion together. Pick a maximum output of a few thousand tokens so that one reply cannot run away.

Agents use tool calling or a structured text format to act, and the API supports the OpenAI tool calling shape (tools, tool_choice, role: "tool" results) along with streaming. How well any model follows an agent's instructions varies, so start with small tasks, such as renaming a function across two files, and watch the first few steps before you let it run longer.

Agents also send many requests in a row. A full key allows 8 concurrent requests and 300 per minute, a trial key 2 and 60. A single agent is usually well inside those numbers, but two agents plus a chat panel on a trial key can reach the concurrency cap and produce 429 errors.

Calling the API from your own code in VS Code

Sometimes the goal is not an extension but a script you run from the editor. Any OpenAI SDK works. In Node:

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.deepseekapikey.com/v1",
  apiKey: process.env.API_KEY,
});

const res = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Review this function for off-by-one errors." }],
});
console.log(res.choices[0].message.content);

Keep the key in an environment variable, a .env file that is git-ignored, or your operating system's secret store, never in a committed file. The Python version of the same call uses OpenAI(base_url="https://api.deepseekapikey.com/v1", api_key=...). The quickstart has more examples, including streaming and JSON mode.

What coding sessions cost

The price is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Coding assistants send a lot of context, so input dominates. Take a request with 30,000 tokens of code and chat history and a 1,000-token answer:

  • Input: 30,000 / 1,000,000 x $0.15 = $0.0045
  • Output: 1,000 / 1,000,000 x $0.50 = $0.0005
  • Total: $0.005 per request, so 200 requests cost $1.00.

A full 100,000-token prompt with the same answer costs $0.015 + $0.0005 = $0.0155. That is still small, but agent loops repeat it many times, so keep the context tight: open the files that matter, not the whole repository, and start a new chat when the task changes.

Credit is prepaid and never expires, and there is no subscription. Failed or refused requests are not charged. Top up with any whole amount from $20 to $500, with +5% from $50, +10% from $100 and +15% from $200, paying by crypto (USDT on TRC20, USDC on Base). A $50 top-up credits $52.50. See the pricing page for the details.

Troubleshooting checklist

  • 401 Unauthorized. The key is wrong or has trailing whitespace. Remember that a key issued by DeepSeek's own platform will not work here.
  • 404 Not Found. Check the base URL. Some extensions append /chat/completions themselves, so give them the base ending in /v1. Others want the full path. Follow the hint in the field.
  • Model not found. The model ID must be exactly uncensored.
  • 429 with code concurrency. Too many requests at once. Close extra chats or agents. Streamed requests hold their slot until they finish.
  • 429 with Retry-After: 5. Temporary overload. Wait five seconds and the extension's retry usually succeeds.
  • Request too large. The body limit is 8 MB, and the context limit is 100,000 tokens. Trim attached files.

Prompts are not used for training, but your extension may keep its own logs and telemetry, so check its settings if you work with private code. The service is for lawful adult use and has a hard rule against sexual content involving minors. It generates text only, so code is fine and images are not. If you want the background on how this service differs from DeepSeek's own, the article on myths and facts covers it.

Questions and answers

Can I put a DeepSeek-issued key into this setup?

Not with this base URL. Keys are tied to the service that issued them. Use DeepSeek's endpoint and model name for their key, and this site's endpoint for this site's key.

Which VS Code extensions work?

Any extension that supports a custom OpenAI-compatible provider, such as Continue or Cline. Check the extension's current docs, since settings change between versions.

Does it work for tab autocomplete?

Do not count on it. The API documents chat completions, which suit chat, edits and agents. Use a separate provider if you need inline completion.

What model ID should I enter?

Enter uncensored in lowercase. The base URL is https://api.deepseekapikey.com/v1.

How much does it cost to code with it?

A request with 30,000 input tokens and a 1,000-token answer costs about $0.005. Two hundred such requests cost about $1.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API key