Guide

Use DeepSeek with the OpenAI SDK

You don't need DeepSeek's own SDK to call DeepSeek. Nicrron serves DeepSeek models through an OpenAI-compatible API, so the OpenAI SDK you already use calls them after two changes: the base URL and the key.

The same key also calls every other model on Nicrron, so trying DeepSeek against what you use today is a one-word change.

1. Get a key

Make an API key in the dashboard and add credit. Keep the key in an environment variable, for example NICRRON_API_KEY.

2. Point the SDK at Nicrron

Set base_url (Python) or baseURL (TypeScript) to https://api.nicrron.ai/v1, and use the model id deepseek/deepseek-v4-pro.

Python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.nicrron.ai/v1",
    api_key=os.environ["NICRRON_API_KEY"],
)

reply = client.chat.completions.create(
    model="deepseek/deepseek-v4-pro",
    messages=[{"role": "user", "content": "Write a haiku about the sea."}],
)
print(reply.choices[0].message.content)
TypeScript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.nicrron.ai/v1",
  apiKey: process.env.NICRRON_API_KEY,
});

const reply = await client.chat.completions.create({
  model: "deepseek/deepseek-v4-pro",
  messages: [{ role: "user", content: "Write a haiku about the sea." }],
});
console.log(reply.choices[0].message.content);

3. Pick a DeepSeek model

Model idContextInput / 1MOutput / 1M
deepseek/deepseek-v4-pro1M$1.32$3.96
deepseek/deepseek-flash1M$0.30$1.20

List prices in US dollars from the live catalog; requests paid from credit add a 5% platform fee. More on the DeepSeek models page.

4. Stream the answer

Streaming works the same as with OpenAI: pass stream=True and read the chunks.

Python
stream = client.chat.completions.create(
    model="deepseek/deepseek-v4-pro",
    messages=[{"role": "user", "content": "Explain DNS in three sentences."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

5. Add a fallback

Nicrron takes a models list as well as model. If DeepSeek V4 Pro can't answer, the same request goes to the next model in the list, and reply.model says which one answered. The OpenAI SDK sends extra fields through extra_body.

Python
reply = client.chat.completions.create(
    model="deepseek/deepseek-v4-pro",
    messages=[{"role": "user", "content": "Hello!"}],
    # Tried in order if DeepSeek V4 Pro can't answer: an outage or a rate limit.
    extra_body={"models": ["openai/gpt-6.2-sol"]},
)
print(reply.model)  # the model that actually answered

More in Fall back to another model.

Questions

Can I use DeepSeek with the OpenAI SDK?
Yes. Point the OpenAI SDK at https://api.nicrron.ai/v1 with a Nicrron API key, and set the model to a DeepSeek id such as "deepseek/deepseek-v4-pro". The request and the answer have the OpenAI chat completions shape, so the rest of your code stays the same.
Which DeepSeek models can I call this way?
2 right now: DeepSeek V4 Pro, DeepSeek Flash. The ids and prices are on nicrron.ai/models.
Do streaming and function calling work with DeepSeek?
Streaming works with stream: true, as server-sent events of chat.completion.chunk. Tools use the OpenAI tools format; Nicrron passes them to models that support function calling.
How much does DeepSeek cost through Nicrron?
The provider's list price per token, shown for each model on its page. Requests paid from Nicrron credit add a 5% platform fee. API keys spend paid credit: add credit in the dashboard, with no subscription.