To get a DeepSeek API key, sign in to the official DeepSeek Platform API Keys page, create a new key, give it a recognizable name, and save the secret securely. Before making a model request, check that your account has enough API balance.
The key gives your application a way to authenticate with DeepSeek. It does not include unlimited usage or automatically fund your account. This guide walks through creation, app configuration, an optional first request, and the most common setup problems.
Documentation checked November 21, 2026. The code example follows the linked documentation; it was not tested with a live account.
What You Need Before You Start
Have your DeepSeek account credentials and a private place to save the key, such as a password manager. You do not need coding knowledge to create a key or enter it into an application that supports DeepSeek.
If you already use DeepSeek Chat, try signing in with that account. DeepSeek’s Open Platform terms confirm that Chat and the developer platform share an account. API balance and usage still need to be checked separately.
For the optional Python test later, you will also need a local terminal and Python 3.10 or newer, as required by the current OpenAI Python SDK. Readers connecting an existing app can skip that test.
How to Get a DeepSeek API Key, Step by Step
1. Sign In to the Official Developer Platform
Open platform.deepseek.com. Sign in with your existing account, or use the registration option and complete the verification requested on the page. Follow the sign-in options available for your account and region.
Use the account you intend to manage for API usage and billing. A key created through a different provider’s dashboard belongs to that provider’s service; it is not a credential issued by the official DeepSeek Platform.
2. Open API Keys
Find API Keys in the platform, or open the API Keys page directly. If you arrive at a sign-in screen, finish signing in and return to that page.

This is where you manage developer credentials. Your Chat password, an email verification code, and a browser session are not the API key an integration is asking for.
3. Create and Name the Key
Select the option to create a key. Integration documentation describes it as Create new API key or Create new secret key; the exact wording can vary. Enter a descriptive name if prompted, then confirm creation.

For example, personal-laptop-test is more useful than key1. A name helps you recognize a credential later; it is not the secret you paste into your application and does not, by itself, impose a spending limit.
4. Copy and Store the Secret
Copy the complete key while it is displayed and save it in your password manager or another appropriate secret store. Copy the secret value, not its name, a masked preview, or the page URL.
If you close the creation dialog without saving the secret and cannot retrieve it, create a replacement and revoke the unused key. Do not try to reconstruct a secret from its masked characters.
The create, name, and copy workflow is also documented in the official integration guides from Celigo and n8n. You do not need an account with either service to obtain a DeepSeek key.
Creation checkpoint: You now have a saved credential. Next, confirm the account balance before sending requests. If an existing app asked for your key, use the configuration table below; writing code is optional.
Is a DeepSeek API Key Free?
DeepSeek’s public pricing lists charges for API usage, not a separate key-issuance fee. Creating a credential and paying for model requests are separate steps. Having a key does not establish that your account has credit.
Model requests are billed by input and output tokens. DeepSeek deducts charges from available account balance, using granted credit before topped-up credit when both are available. Check the current pricing page for rates before estimating your costs.
Check Your Balance Before Your First Request
Open the platform’s Usage page and review your available balance. If you need funds, open Top up and review the amount and payment options shown for your account before paying.

Do not plan around an old article promising a fixed signup bonus or minimum payment. DeepSeek’s terms make current platform information the reference for payment methods and free quotas. Any credit actually granted to your account should be checked there.
Developers can also inspect the documented Get User Balance endpoint. It reports topped-up and unexpired granted balances, and an is_available field indicating whether the balance is sufficient for API calls. The existence of a granted-balance field does not promise a bonus to every new user.
Use Your DeepSeek API Key in an App
Follow the application’s DeepSeek setup guide and locate its provider or credentials settings. For an integration using DeepSeek’s OpenAI-compatible API, these are the basic values from the official first-call guide:
| Setting | What to enter |
|---|---|
| API key | Your complete DeepSeek secret key |
| Base URL | https://api.deepseek.com |
| Model for the example in this guide | deepseek-flash |
| Environment variable used in this guide | DEEPSEEK_API_KEY |
| Raw HTTP authentication header | Authorization: Bearer followed by a space and your key |
A normal API key field or the Python SDK’s api_key argument expects the secret itself. Do not add the word Bearer unless you are constructing the HTTP header. If a tool asks for a full request URL instead of a base URL, follow that tool’s instructions.

Keep the credential, endpoint, and provider together. A gateway may offer DeepSeek models but require its own account and key. Likewise, using the OpenAI Python package does not turn a DeepSeek key into an OpenAI credential.
Save the settings and use the app’s connection test if it offers one. Otherwise, send a short prompt after confirming your balance. A generated reply uses API credit. Once the app connects successfully, you can skip the Python section.
Optional: Test Your DeepSeek API Key With Python
This example sends a small, metered model request. It turns thinking off, limits generated output to 128 tokens, and disables automatic retries. Input tokens also count toward usage. Run it after checking your balance.
1. Save the Test Script
Create a working folder and save the following code as test_deepseek.py. It uses DEEPSEEK_API_KEY if you already configured that environment variable. Otherwise, it prompts for the key without displaying it in a normal local terminal.
import os
import warnings
from getpass import GetPassWarning, getpass
from openai import OpenAI
warnings.simplefilter("error", GetPassWarning)
api_key = os.environ.get("DEEPSEEK_API_KEY")
if not api_key:
api_key = getpass("Paste your DeepSeek API key: ")
api_key = api_key.strip()
if not api_key:
raise SystemExit("No API key provided.")
client = OpenAI(
api_key=api_key,
base_url="https://api.deepseek.com",
timeout=60.0,
max_retries=0,
)
response = client.chat.completions.create(
model="deepseek-flash",
messages=[
{"role": "user", "content": "Reply with one short greeting."}
],
extra_body={"thinking": {"type": "disabled"}},
max_tokens=128,
stream=False,
)
choice = response.choices[0]
print("Answer:", choice.message.content or "")
print("Finish reason:", choice.finish_reason)
print("Usage:", response.usage)
DeepSeek documents the thinking setting in its Thinking Mode guide and the output cap in its Chat Completions reference. The SDK’s retry option controls automatic repeat attempts.
2. Install the SDK and Run the Script
Open a terminal in the folder containing your script. These commands create a local Python virtual environment, install the SDK into it, and run the file.
macOS or Linux:
python3 -m venv .venv
.venv/bin/python -m pip install openai
.venv/bin/python test_deepseek.py
Windows PowerShell:
py -m venv .venv
.\.venv\Scripts\python.exe -m pip install openai
.\.venv\Scripts\python.exe test_deepseek.py
When prompted, paste the secret and press Enter. Hidden input may look blank while you paste. The script treats Python’s hidden-input warning as an error, so it stops if the terminal cannot hide the key. Use a local terminal rather than a notebook or an editor’s output panel.
3. Check the Result
A successful run prints a greeting, a finish reason, and token usage. The wording of the greeting can vary. If it fails, use the error table below before running it repeatedly.
The separate List Models endpoint is useful for checking currently available model IDs. A successful model-list response does not, on its own, prove that your account can fund a generation request.
Why Is Your DeepSeek API Key Not Working?
Start with the returned error. Authentication, balance, and request-format problems require different fixes. The HTTP meanings below follow DeepSeek’s error-code documentation.
| Problem | What to check |
|---|---|
| 401: Authentication failed | Check the complete key, provider, and base URL. Remove accidental whitespace. Never print the secret to debug it. |
| 402: Insufficient balance | Check API balance and top-up status. Creating another key does not add funds. |
| 400 or 422: Invalid request | Read the error details and correct the request format, model ID, or unsupported parameter. |
| 429: Rate limit | Wait and reduce request frequency or concurrent requests. |
| 500 or 503: Server problem | Check the service status and retry later. These errors do not establish that your key is invalid. |
Python cannot find openai | Use the same virtual environment for installation and execution, as shown above. |
For service incidents, check the official status page. If a support request is necessary, provide the error code and a sanitized description of your setup. Leave the full secret out of messages, logs, and screenshots.
Protect, Replace, or Revoke Your Key
DeepSeek’s API-key rules say to keep the credential private and exclude it from browser or other client-side code. For your own application, store the secret on the server or in an appropriate deployment secret manager.
- Keep keys out of source files, public repositories, shared notebooks, screenshots, and support conversations.
- If you use a local
.envfile, exclude it from version control and configure your application to load it. Creating the file alone does not set an environment variable. - Keep an inventory of the applications using each credential so you can update the right integrations when replacing it.
- Review account usage after connecting a new app, especially one that can send requests automatically.
If You Lose the Key
Check your private secret store first. If you cannot recover the full value, create a replacement, update the applications that need it, verify their connections, and revoke the old credential.
If the Key Is Exposed
Revoke the exposed key promptly, then create and deploy a replacement. DeepSeek’s official revocation instructions describe using the trash-bin control beside the affected key on the API Keys page and confirming Revoke.

Check usage and balance for activity you do not recognize, and remove exposed copies. Deleting a public post or code line cannot make a disclosed credential secret again. Applications using the revoked key will need the replacement before they can authenticate successfully.
Frequently Asked Questions
Where Do I Find My DeepSeek API Key?
Open the official API Keys dashboard to create and manage credentials. For the complete secret of an existing key, check where you saved it. If only a masked value is available and your saved copy is missing, replace the key.
How Can I Pay for DeepSeek API Credit?
DeepSeek’s funding FAQ lists PayPal, bank cards, Alipay, and WeChat Pay. Check the Top up page for the methods and amounts actually available to your account. The payment funds API usage; it is separate from the secret key itself.
Can I Use DeepSeek Chat Without an API Key?
Yes. You do not create a developer API key just to use DeepSeek’s consumer chat interface. A key is for applications and developer requests. Using Chat does not establish that your API account has a usable balance.
Do I Need a Different Key for Each DeepSeek Model?
The key authenticates your account; the request’s model field selects the model. Use a model ID currently listed in DeepSeek’s documentation, such as deepseek-flash or deepseek-v4-pro, subject to availability. A key’s name does not select the model.
Should I Use a Free API Key Posted Online?
Create and control your own credential. A publicly shared key may be revoked, may not belong to the person posting it, and provides no dependable control over access or billing. If another provider offers a legitimate trial, use that provider’s documented signup process and connection settings.
Once your key is saved, your balance is ready, and your app or test request connects successfully, you can start building. Keep the key private and monitor usage as you move from a small test to regular requests.
