Deepseek

Replace https://api.deepseek.com/ with https://llmfoundry.straive.com/deepseek/.

All Deepseek models and APIs are supported, including:

  • deepseek-chat
  • deepseek-coder

Curl

curl -X POST https://llmfoundry.straive.com/deepseek/chat/completions \
  -H "Authorization: Bearer $LLMFOUNDRY_TOKEN:my-test-project" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-chat", "messages": [{"role": "user", "content": "What is 2 + 2"}]}'

Python requests

import os
import requests  # Or replace requests with httpx

response = requests.post(
    "https://llmfoundry.straive.com/deepseek/chat/completions",
    headers={"Authorization": f"Bearer {os.environ['LLMFOUNDRY_TOKEN']}:my-test-project"},
    json={"model": "deepseek-chat", "messages": [{"role": "user", "content": "What is 2 + 2"}]}
)
print(response.json())

JavaScript

const token = process.env.LLMFOUNDRY_TOKEN;
const response = await fetch("https://llmfoundry.straive.com/deepseek/chat/completions", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}:my-test-project` },
  // If the user is already logged into LLM Foundry, use `credentials: "include"` to send **THEIR** API token instead of the `Authorization` header.
  credentials: "include",
  body: JSON.stringify({
    model: "deepseek-chat",
    messages: [{ role: "user", content: "What is 2 + 2" }],
  }),
});
console.log(await response.json());

Python OpenAI

import os
from openai import OpenAI

client = OpenAI(
    api_key=f'{os.environ.get("LLMFOUNDRY_TOKEN")}:my-test-project',
    base_url="https://llmfoundry.straive.com/deepseek/",
)

# Rest of your code is the same
chat_completion = client.chat.completions.create(
    messages=[{"role": "user", "content": "What is 2 + 2?"}],
    model="deepseek-chat",
)
print(chat_completion.json())

LangChain

import os
from langchain_openai import ChatOpenAI

chat_model = ChatOpenAI(
    openai_api_base="https://llmfoundry.straive.com/deepseek/",
    openai_api_key=f'{os.environ["LLMFOUNDRY_TOKEN"]}:my-test-project',
    model="deepseek-chat"
)
print(chat_model.invoke("What is 2 + 2?").content)