DeepSeek API Guide: V3 & R1 Setup, Pricing, and Code Examples (2026)

Call the cheapest high-performance AI models from Python, Node.js, Cursor, LangChain, and any OpenAI-compatible tool.

By Token1.US Team Updated July 20, 2026 9 min read

DeepSeek has emerged as one of the most disruptive AI model families of 2025-2026, offering performance that rivals GPT-4o and Claude at a fraction of the cost. Whether you need a budget-friendly chatbot backend, a powerful coding assistant, or a reasoning engine for complex problems, DeepSeek delivers exceptional value.

Why DeepSeek matters: DeepSeek-V3 costs about $0.14/1M tokens — roughly 95% less than GPT-4o ($2.50/1M) — while matching or exceeding it on many benchmarks. For cost-conscious developers, it is the cheapest high-quality AI API available.

DeepSeek Model Overview

DeepSeek offers two primary models, each designed for different use cases:

ModelBest ForInput / 1MOutput / 1MKey Feature
DeepSeek-V3 Chat, coding, analysis, general tasks $0.14 $0.28 Best price-to-performance ratio
DeepSeek-R1 Math, logic, complex reasoning $0.55 $2.19 Visible chain-of-thought reasoning

DeepSeek-V3 vs DeepSeek-R1: Which to Choose?

Quick Start: Python

from openai import OpenAI

client = OpenAI(
    api_key="your-token1-us-key",
    base_url="https://discount-token.com/v1"
)

response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[
        {"role": "system", "content": "You are a helpful coding assistant."},
        {"role": "user", "content": "Write a Python function to reverse a linked list."}
    ],
    max_tokens=1024
)

print(response.choices[0].message.content)
print(f"\nTokens: {response.usage.total_tokens}")

Streaming Response

stream = client.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "Explain Big-O notation."}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Quick Start: Node.js

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "your-token1-us-key",
  baseURL: "https://discount-token.com/v1",
});

const response = await client.chat.completions.create({
  model: "deepseek-chat",
  messages: [{ role: "user", content: "Explain Big-O notation simply." }],
});

console.log(response.choices[0].message.content);

Quick Start: curl

curl https://discount-token.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-token1-us-key" \
  -d '{
    "model": "deepseek-chat",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Using DeepSeek-R1 for Complex Reasoning

DeepSeek-R1 includes a visible chain-of-thought reasoning process. The model thinks step by step before producing the final answer, which you can see in the output:

response = client.chat.completions.create(
    model="deepseek-reasoner",
    messages=[{
        "role": "user",
        "content": "A farmer has 100 meters of fencing. What is the largest rectangular area they can enclose?"
    }],
    max_tokens=4096
)

# R1's response includes the reasoning process
print(response.choices[0].message.content)
When to use R1: Math problems, logic puzzles, multi-step debugging, competitive programming, scientific analysis, and any task where accuracy matters more than speed or cost.

Using DeepSeek with Popular Tools

Cursor IDE

Set Cursor's OpenAI Base URL to https://discount-token.com/v1 and enter your Token1.US API key. Select deepseek-chat as the model for affordable, high-quality code assistance that costs 90% less than GPT-4o.

LangChain

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="deepseek-chat",
    api_key="your-token1-us-key",
    base_url="https://discount-token.com/v1"
)

response = llm.invoke("What are the SOLID principles?")

Continue (VS Code Extension)

Add a custom model in Continue's config:

{
  "models": [{
    "title": "DeepSeek-V3",
    "provider": "openai",
    "model": "deepseek-chat",
    "apiBase": "https://discount-token.com/v1",
    "apiKey": "your-token1-us-key"
  }]
}

Dify

Add a model provider with base URL https://discount-token.com/v1 and your Token1.US API key. DeepSeek will be available as a model option in all Dify apps.

DeepSeek API Pricing: How Much Does It Cost?

DeepSeek is the cheapest high-quality AI API available. Here is what real-world usage costs:

ScenarioInput TokensOutput TokensCost (V3)
Single chat message50200$0.0001
Code generation200500$0.0002
1,000 API calls50,000200,000$0.063
10,000 API calls500,0002,000,000$0.63
100,000 API calls5,000,00020,000,000$6.30
Cost comparison: The same 100,000 API calls that cost $6.30 with DeepSeek-V3 would cost $212.50 with GPT-4o and $315.00 with Claude Sonnet. That is a 30-50x cost savings.

What DeepSeek Excels At

Coding and Programming

DeepSeek-V3 performs excellently on coding benchmarks, often matching GPT-4o. It is particularly strong at:

Chinese Language Tasks

DeepSeek was developed by a Chinese AI lab, giving it native-level Chinese understanding. For Chinese-language applications — chatbots, content generation, sentiment analysis — DeepSeek outperforms most Western models.

Bilingual Processing

DeepSeek handles mixed Chinese-English content naturally. If your application processes both languages (e.g., translation tools, international chatbots), DeepSeek is an excellent choice.

Mathematical Reasoning

DeepSeek-R1 is specifically trained for mathematical and logical reasoning. On math benchmarks, it competes with OpenAI's o1 model at a fraction of the cost.

DeepSeek vs Other AI Models

FeatureDeepSeek-V3GPT-4oClaude SonnetGLM-4-Plus
Input price$0.14/1M$2.50/1M$3.00/1M$0.70/1M
Output price$0.28/1M$10/1M$15/1M$0.70/1M
Coding qualityExcellentExcellentExcellentVery good
Chinese languageExcellentGoodGoodBest
Context window64K128K200K128K
Best valueYesNoNoGood

For a full comparison, see our detailed model comparison page.

Best Practices for DeepSeek API

Troubleshooting

ErrorCauseSolution
401 UnauthorizedInvalid API keyCheck your key in the dashboard
429 Too Many RequestsRate limit exceededAdd delays between requests
model_not_foundWrong model nameUse deepseek-chat or deepseek-reasoner
R1 too slowReasoning model thinks deeplyUse V3 for time-sensitive tasks

Frequently Asked Questions

What is the DeepSeek API?

The DeepSeek API provides programmatic access to DeepSeek AI models: DeepSeek-V3 for general chat and coding, and DeepSeek-R1 for complex reasoning. It is OpenAI-compatible and accessible through Token1.US.

How much does the DeepSeek API cost?

DeepSeek-V3 costs approximately $0.14/1M input and $0.28/1M output — the cheapest high-quality AI API available. DeepSeek-R1 costs $0.55/1M input and $2.19/1M output. See our pricing comparison.

Is DeepSeek API compatible with the OpenAI SDK?

Yes. DeepSeek API is fully OpenAI-compatible. Use the standard OpenAI SDK with base_url="https://discount-token.com/v1". All features work identically.

What is the difference between DeepSeek-V3 and DeepSeek-R1?

DeepSeek-V3 is a general-purpose model optimized for speed and cost. DeepSeek-R1 is a reasoning model that thinks step-by-step, making it better for math, logic, and complex coding but slower and more expensive.

Is DeepSeek good for coding?

Yes. DeepSeek-V3 performs excellently on coding benchmarks, often matching or exceeding GPT-4o. For coding tasks, DeepSeek offers the best value — similar quality at 95% lower cost.

Can I use DeepSeek with Cursor or LangChain?

Yes. Set the OpenAI base URL to https://discount-token.com/v1 in Cursor settings, or use base_url in LangChain. DeepSeek works with all OpenAI-compatible tools.

Is DeepSeek safe to use for production?

Yes. DeepSeek models are served through Token1.US with 99.9% uptime, global CDN, and HTTPS encryption. Request logs are retained for only 7 days. No content is permanently stored.

Start Building with DeepSeek

The cheapest high-quality AI API. 95% cheaper than GPT-4o.

Get Your API Key

Related Guides