DeepSeek
Access DeepSeek models through LangDB’s API using OpenAI SDK, enabling fast, reliable AI performance across platforms.
LangDB provides first class support for DeepSeek AI’s models.
You can use OpenAI SDK to run the deepseek models.
# Please install OpenAI SDK first: `pip3 install openai`
from openai import OpenAI
api_base = "https://api.us-east-1.langdb.ai" # LangDB API base URL
api_key = "xxxxx" # Replace with your LangDB token
default_headers = {"x-project-id": "xxxxx"} # LangDB Project ID
client = OpenAI(
base_url=api_base,
api_key=api_key,
)
response = client.chat.completions.create(
model="deepseek-reasoner",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Hello"}
],
stream=False
)
print(response.choices[0].message.content)
Was this helpful?