# Observability for Novita AI with Opik

> Start here to integrate Opik into your Novita AI-based genai application for end-to-end LLM observability, unit testing, and optimization.

[Novita AI](https://novita.ai/) is an AI cloud platform that helps developers easily deploy AI models through a simple API, backed by affordable and reliable GPU cloud infrastructure. It provides access to a wide range of models including DeepSeek, Qwen, Llama, and other popular LLMs.

This guide explains how to integrate Opik with Novita AI via LiteLLM. By using the LiteLLM integration provided by Opik, you can easily track and evaluate your Novita AI API calls within your Opik projects as Opik will automatically log the input prompt, model used, token usage, and response generated.

## Getting Started

### Configuring Opik

To get started, you need to configure Opik to send traces to your Comet project. You can do this by setting the `OPIK_PROJECT_NAME` environment variable:

```bash
export OPIK_PROJECT_NAME="your-project-name"
export OPIK_WORKSPACE="your-workspace-name"
```

You can also call the `opik.configure` method:

```python
import opik

opik.configure(
    project_name="your-project-name",
    workspace="your-workspace-name",
)
```

### Configuring LiteLLM

Install the required packages:

```bash
pip install opik litellm
```

Create a LiteLLM configuration file (e.g., `litellm_config.yaml`):

```yaml
model_list:
  - model_name: deepseek-r1-turbo
    litellm_params:
      model: novita/deepseek/deepseek-r1-turbo
      api_key: os.environ/NOVITA_API_KEY
  - model_name: qwen-32b-fp8
    litellm_params:
      model: novita/qwen/qwen3-32b-fp8
      api_key: os.environ/NOVITA_API_KEY
  - model_name: llama-70b-instruct
    litellm_params:
      model: novita/meta-llama/llama-3.1-70b-instruct
      api_key: os.environ/NOVITA_API_KEY

litellm_settings:
  callbacks: ["opik"]
```

### Authentication

Set your Novita AI API key as an environment variable:

```bash
export NOVITA_API_KEY="your-novita-api-key"
```

You can obtain a Novita AI API key from the [Novita AI dashboard](https://novita.ai/settings).

## Usage

### Using LiteLLM Proxy Server

Start the LiteLLM proxy server:

```bash
litellm --config litellm_config.yaml
```

Use the proxy server to make requests:

```python
import openai

client = openai.OpenAI(
    api_key="anything",  # can be anything
    base_url="http://0.0.0.0:4000"
)

response = client.chat.completions.create(
    model="deepseek-r1-turbo",
    messages=[
        {"role": "user", "content": "What are the advantages of using cloud-based AI platforms?"}
    ]
)

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

### Direct Integration

You can also use LiteLLM directly in your Python code:

```python
import os
from litellm import completion