# Configure LiteLLM for Opik
from litellm.integrations.opik.opik import OpikLogger
import litellm

litellm.callbacks = ["opik"]

os.environ["NOVITA_API_KEY"] = "your-novita-api-key"

response = completion(
    model="novita/deepseek/deepseek-r1-turbo",
    messages=[
        {"role": "user", "content": "How can cloud AI platforms improve development efficiency?"}
    ]
)

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

## Supported Models

Novita AI provides access to a comprehensive catalog of models from leading providers. Some of the popular models available include:

* **DeepSeek Models**: `deepseek-r1-turbo`, `deepseek-v3-turbo`, `deepseek-v3-0324`
* **Qwen Models**: `qwen3-235b-a22b-fp8`, `qwen3-30b-a3b-fp8`, `qwen3-32b-fp8`
* **Llama Models**: `llama-4-maverick-17b-128e-instruct-fp8`, `llama-3.3-70b-instruct`, `llama-3.1-70b-instruct`
* **Mistral Models**: `mistral-nemo`
* **Google Models**: `gemma-3-27b-it`

For the complete list of available models, visit the [Novita AI model catalog](https://novita.ai/models/llm).

## Advanced Features

### Tool Calling

Novita AI supports function calling with compatible models:

```python
from litellm import completion

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_current_weather",
            "description": "Get the current weather in a given location",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {
                        "type": "string",
                        "description": "The city and state, e.g. San Francisco, CA",
                    },
                    "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
                },
                "required": ["location"],
            },
        },
    }
]

response = completion(
    model="novita/deepseek/deepseek-r1-turbo",
    messages=[{"role": "user", "content": "What's the weather like in Boston today?"}],
    tools=tools,
)
```

### JSON Mode

For structured outputs, you can enable JSON mode:

```python
response = completion(
    model="novita/deepseek/deepseek-r1-turbo",
    messages=[
        {"role": "user", "content": "List 5 popular cookie recipes."}
    ],
    response_format={"type": "json_object"}
)
```

## Feedback Scores and Evaluation

Once your Novita AI calls are logged with Opik, you can evaluate your LLM application using Opik's evaluation framework:

```python
from opik.evaluation import evaluate
from opik.evaluation.metrics import Hallucination