DeepSeek model license and usage terms
PREREQUISITES
Python 3.8+DeepSeek API keypip install openai>=1.0
Setup
To use DeepSeek models, you need to obtain an API key by registering on the DeepSeek platform. Install the openai Python SDK to interact with the API, as DeepSeek uses an OpenAI-compatible interface.
pip install openai>=1.0 Step by step
Here is a basic example to call the DeepSeek chat model using the OpenAI-compatible SDK. This demonstrates authorized usage under the license terms.
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["DEEPSEEK_API_KEY"], base_url="https://api.deepseek.com")
response = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Explain DeepSeek model license terms."}]
)
print(response.choices[0].message.content) DeepSeek models are provided under a license that permits API usage for commercial and research purposes while prohibiting redistribution and reverse engineering. Users must comply with rate limits and content policies.
Common variations
You can use different DeepSeek models like deepseek-reasoner for reasoning tasks. Async calls are possible by integrating with async HTTP clients, but the official SDK uses synchronous calls. Always ensure your usage complies with the latest terms on DeepSeek's website.
Troubleshooting
If you receive authentication errors, verify your DEEPSEEK_API_KEY environment variable is set correctly. For rate limit errors, reduce request frequency or contact DeepSeek support. Always check for updates to the license terms to avoid compliance issues.
Key Takeaways
- DeepSeek models require an API key and adherence to their licensing terms for usage.
- Commercial and research use is allowed, but redistribution and reverse engineering are prohibited.
- Use the OpenAI-compatible SDK with the correct base_url to access DeepSeek models.
- Check for rate limits and content policies to avoid service interruptions.
- Always verify the latest license terms on DeepSeek's official site before integration.