getdeepseekapi.comGuide
How to Use DeepSeek API in Claude Code: Real Options
If you are working out how to use DeepSeek API in Claude Code, the first thing to know is that Claude Code talks to Anthropic-style endpoints, while this service speaks the OpenAI format. A small translating proxy closes the gap, and this page shows how to set it up.
Updated
Key points
- Claude Code expects the Anthropic Messages API; this service offers OpenAI-compatible /v1/chat/completions.
- A local proxy such as LiteLLM can translate between the two formats.
- Aider, Continue and Cline accept an OpenAI-compatible base URL directly, with no proxy.
- This is not DeepSeek's official API: it is one independent open-weight model with the ID
uncensored.

Start with what will and will not work
Two clarifications save an hour of confusion. First, this service is not the official DeepSeek API, and it is not a router for DeepSeek or any other vendor. It hosts one open-weight model, run by an independent provider, under the model ID uncensored. If you need DeepSeek's own models, go to DeepSeek directly. Second, Claude Code is built around Anthropic's Messages API. You can change where it sends requests, but what it sends is still Anthropic-shaped JSON.
This service exposes POST /v1/chat/completions and GET /v1/models in the OpenAI format. Pointing Claude Code straight at it will not work, because the paths and payloads differ. The fix is a translation layer. You run a small proxy on your machine that accepts Anthropic-format calls from Claude Code and forwards them as OpenAI-format calls to https://api.getdeepseekapi.com/v1. Tools exist for exactly this, and the next section sets one up.
Before you start, one expectation check. Claude Code leans heavily on tool calling to read files, edit them and run commands. This API supports tool calling, including streamed tool_calls, but how well any given model drives a long agent loop is something to test on your own repository, not something to assume.
Get a key and confirm the endpoint
Create an account with Google or email and password, then open the API key page. New users can claim $0.50 of trial credit with one click. It lasts 7 days, needs no payment details, and is enough to test everything below. Note that a trial key allows 2 concurrent requests and 60 per minute, which matters for agent tools that fire several calls at once.
export UNCENSORED_API_KEY="paste-your-key-here"
curl https://api.getdeepseekapi.com/v1/chat/completions \
-H "Authorization: Bearer $UNCENSORED_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"uncensored","messages":[{"role":"user","content":"Reply with the word ready."}]}'
If that returns a completion, the upstream side is done. Everything left is wiring the proxy to it.
Option 1: a LiteLLM proxy in front of Claude Code
LiteLLM is an open-source project whose proxy server can present an Anthropic-compatible endpoint and route to OpenAI-compatible backends. Check its documentation for the current feature set, since this part of the ecosystem moves quickly.
Install and configure
pip install 'litellm[proxy]'
cat > litellm-config.yaml <<'EOF'
model_list:
- model_name: uncensored
litellm_params:
model: openai/uncensored
api_base: https://api.getdeepseekapi.com/v1
api_key: os.environ/UNCENSORED_API_KEY
EOF
litellm --config litellm-config.yaml --port 4000
The openai/ prefix tells LiteLLM to use the OpenAI-compatible adapter; the name after it is sent upstream as the model. Keep the terminal running.
Point Claude Code at the proxy
Claude Code reads its endpoint and credentials from environment variables. In a second terminal:
export ANTHROPIC_BASE_URL="http://localhost:4000"
export ANTHROPIC_AUTH_TOKEN="any-local-string"
export ANTHROPIC_MODEL="uncensored"
export ANTHROPIC_SMALL_FAST_MODEL="uncensored"
claude
The auth token here is just what your local proxy expects; the real key stays in the proxy's environment. Setting the small, fast model too matters, because Claude Code uses a second model for light background tasks. If you leave it unset, it may try to call an Anthropic model name that the proxy does not know. Newer versions can name this setting differently, so run claude --help or read the current Claude Code settings documentation if a variable seems ignored.
Option 2: tools that take an OpenAI base URL directly
If your goal is an AI coding assistant rather than Claude Code itself, several tools skip the proxy because they already speak the OpenAI format. Each lets you set a custom base URL and model name.
- Aider is a terminal pair-programmer. It reads
OPENAI_API_BASEandOPENAI_API_KEY, and you prefix the model withopenai/. - Continue is an editor extension where a model entry can carry an
apiBaseand an OpenAI-style provider. - Cline offers an OpenAI Compatible provider in its settings with fields for base URL, key and model ID.
With Aider the whole setup is three lines:
export OPENAI_API_BASE="https://api.getdeepseekapi.com/v1"
export OPENAI_API_KEY="$UNCENSORED_API_KEY"
aider --model openai/uncensored
These tools change their menus often, so treat the field names above as a guide and follow each project's current docs. The values you need never change: base URL https://api.getdeepseekapi.com/v1, your key, and the model ID uncensored.
Write your own thin agent loop
When a full coding assistant is overkill, a short script with tool calling covers a lot of ground. This one lets the model ask to read a file, then feeds the file back as a role: "tool" message.
import json, os
from openai import OpenAI
client = OpenAI(
base_url="https://api.getdeepseekapi.com/v1",
api_key=os.environ["UNCENSORED_API_KEY"],
)
tools = [{
"type": "function",
"function": {
"name": "read_file",
"description": "Read a text file from the project",
"parameters": {
"type": "object",
"properties": {"path": {"type": "string"}},
"required": ["path"],
},
},
}]
messages = [{"role": "user", "content": "What does main.py do? Read it first."}]
for _ in range(5):
r = client.chat.completions.create(model="uncensored", messages=messages, tools=tools)
msg = r.choices[0].message
messages.append(msg)
if not msg.tool_calls:
print(msg.content)
break
for call in msg.tool_calls:
args = json.loads(call.function.arguments)
with open(args["path"]) as f:
result = f.read()
messages.append({"role": "tool", "tool_call_id": call.id, "content": result})
The loop cap of five keeps a confused model from running forever. In a real tool you would also validate paths so the model cannot read files outside the project.
Rate limits, cost and fixing 429s
Agent tools are chatty. A single task can trigger dozens of requests, each resending a growing context. On a full key you get 8 concurrent requests and 300 per minute. A 429 with concurrency means too many calls overlap, and a 429 with rate_limited means too many per minute. During brief overload you will see a 429 with Retry-After: 5. LiteLLM can retry automatically if you add a retry setting; check its docs.
Cost is modest because pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Suppose an agent session makes 40 calls that each send 30,000 tokens of context and get back 600 tokens. Input is 1,200,000 tokens, which costs 1.2 x $0.15 = $0.18. Output is 24,000 tokens, which costs 0.024 x $0.50 = $0.012. The whole session lands at $0.192. The context window is 100,000 tokens, so keep files you load focused.
When the trial runs out, top up any whole amount from $20 to $500 by crypto (USDT on TRC20, USDC on Base). Bonuses are +5% from $50, +10% from $100 and +15% from $200. See the pricing page and the docs for the details.
Troubleshooting the proxy setup
| Symptom | Cause | What to try |
|---|---|---|
| Claude Code reports an unknown model | A background model name is not mapped | Set the small fast model variable to uncensored as well |
| Connection refused | Proxy is not running or the port differs | Start LiteLLM and match the port in ANTHROPIC_BASE_URL |
| 401 from upstream | Wrong key in the proxy environment | Re-export UNCENSORED_API_KEY and restart the proxy |
| Tool calls fail or loop | Model struggles with the agent format | Lower the temperature, shorten the prompt, or use Aider instead |
| Frequent 429 | Trial key concurrency of 2 | Top up for a full key with 8 concurrent slots |
Two habits keep the setup safe. Run the proxy on localhost only, so nobody else on your network can spend your credit, and keep the real key in the proxy's environment instead of in a project file that ends up in version control. Also watch the X-Balance-USD response header during your first long session, because agent loops can use more tokens than you expect. If the balance drops faster than the estimate above, shorten the files you feed in or cap the number of steps.
Requests that fail are not charged, so experimenting is cheap. Prompts are not used for training. For comparison with other gateways, read our API key overview.
More guides
Questions and answers
Can Claude Code connect directly to this API?
No. Claude Code uses Anthropic's Messages format and this API uses OpenAI's chat completions format. Put a translating proxy such as LiteLLM between them.
Is this the official DeepSeek API?
No. It hosts one independent open-weight model under the ID uncensored and is not affiliated with DeepSeek or any other vendor.
Which tools work without a proxy?
Tools with an OpenAI-compatible provider setting, such as Aider, Continue and Cline. Set the base URL, key and model ID uncensored.
Does tool calling work?
Yes, including streamed tool_calls and results sent back as role tool messages. Test your own agent workflow to see how the model handles it.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.