Deepseek is an Open-Source LLM model that rivals o1 from OpenAI. You can learn more about DeepSeek on [Github](https://github.com/deepseek-ai/DeepSeek-R1) or
on [deepseek.com](https://www.deepseek.com/).

In this guide, we will showcase how to track DeepSeek calls using Opik. As DeepSeek is open-source, there are many way to run and call the model. We will focus on how to integrate Opik with the following hosting options:

1. DeepSeek API
2. Fireworks AI API
3. Together AI API

## Getting started

### Configuring your hosting provider

Before you can start tracking DeepSeek calls, you need to get the API key from your hosting provider.

::::tabs
:::tab{title="DeepSeek API"}
In order to use the DeepSeek API, you will need to have an API key. You can register for an account on [DeepSeek.com](https://chat.deepseek.com/sign_up).
Once you have signed up, you can register for an API key.
:::

:::tab{title="Fireworks AI API"}
You can log into Fireworks AI on [fireworks.ai](https://fireworks.ai/). You can then access your API key on the [API keys](https://fireworks.ai/account/api-keys) page.
:::

:::tab{title="Together AI API"}
You can log into Together AI on [together.ai](https://together.ai/). You can then access your API key on the [API keys](https://api.together.ai/settings/api-keys) page.
:::
::::

### Configuring Opik

```bash
pip install --upgrade --quiet opik

opik configure
```

:::callout{intent="tip"}
Opik is fully open-source and can be run locally or through the Opik Cloud platform. You can learn more about hosting
Opik on your own infrastructure in the [self-hosting guide](/guides/overview-self-host-overview).
:::

## Tracking DeepSeek calls

The easiest way to call DeepSeek with Opik is to use the OpenAI Python SDK and the `track_openai` decorator. This approach is compatible with the DeepSeek API, Fireworks AI API and Together AI API:

::::tabs
:::tab{title="DeepSeek API"}
```python
from opik.integrations.openai import track_openai
from openai import OpenAI

# Create the OpenAI client that points to DeepSeek API
client = OpenAI(api_key="<DeepSeek API Key>", base_url="https://api.deepseek.com")

# Wrap your OpenAI client to track all calls to Opik
client = track_openai(client)

# Call the API
response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[
        {"role": "system", "content": "You are a helpful assistant"},
        {"role": "user", "content": "Hello"},
    ],
    stream=False
)

print(response.choices[0].message.content)
```
:::

:::tab{title="Fireworks AI API"}
```python
from opik.integrations.openai import track_openai
from openai import OpenAI

# Create the OpenAI client that points to DeepSeek API
client = OpenAI(api_key="<Fireworks AI API Key>", base_url="https://api.fireworks.ai/inference/v1")

# Wrap your OpenAI client to track all calls to Opik
client = track_openai(client)

# Call the API
response = client.chat.completions.create(
    model="accounts/fireworks/models/deepseek-v3",
    messages=[
        {"role": "system", "content": "You are a helpful assistant"},
        {"role": "user", "content": "Hello"},
    ],
    stream=False
)

print(response.choices[0].message.content)
```
:::

:::tab{title="Together AI API"}
```python
from opik.integrations.openai import track_openai
from openai import OpenAI

# Create the OpenAI client that points to Together AI API
client = OpenAI(api_key="<Together AI API Key>", base_url="https://api.together.xyz/v1")

# Wrap your OpenAI client to track all calls to Opik
client = track_openai(client)

# Call the API
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-R1",
    messages=[
        {"role": "system", "content": "You are a helpful assistant"},
        {"role": "user", "content": "Hello"},
    ],
    stream=False
)

print(response.choices[0].message.content)
```
:::
::::

## Related pages

- [Observability for Anthropic with Opik](./python-anthropic.md)
- [Observability for AWS Bedrock with Opik](./python-bedrock.md)
- [Observability for BytePlus with Opik](./python-byteplus.md)
- [Observability for Cohere with Opik](./python-cohere.md)
- [Observability for Fireworks AI with Opik](./python-fireworks-ai.md)
- [Observability for Google Gemini (Python) with Opik](./python-gemini.md)
- [Observability for Groq with Opik](./python-groq.md)
- [Observability for TypeSafe AI (Python) with Opik](./python-typesafe.md)
- [Observability for MiniMax with Opik](./python-minimax.md)
- [Observability for Mistral AI (Python) with Opik](./python-mistral.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
