> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neosantara.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# LiteLLM

> Orchestrate 100+ AI models, proxy load balancing, and fallback routing with LiteLLM.

Neosantara is officially supported as a native model provider in [LiteLLM](https://www.litellm.ai/?utm_source=neosantara-docs\&utm_medium=referral). You can reference models using the `neosantara/<model>` prefix for intelligent routing, automatic multi-model failover, and centralized cost tracking.

## Installation

```bash theme={"theme":{"light":"catppuccin-latte","dark":"ayu-dark"}}
pip install -U litellm
```

## Authentication

Set your Neosantara API key in your environment:

```bash theme={"theme":{"light":"catppuccin-latte","dark":"ayu-dark"}}
export NEOSANTARA_API_KEY="nsk_..."
```

## Native Usage Example

```python Python icon="python" theme={"theme":{"light":"catppuccin-latte","dark":"ayu-dark"}}
import litellm
import os

response = litellm.completion(
    model="neosantara/gemini-3.8-flash",
    messages=[
        {"role": "user", "content": "Explain how an AI proxy works in one sentence."}
    ]
)

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

```python Python (Streaming) icon="python" theme={"theme":{"light":"catppuccin-latte","dark":"ayu-dark"}}
import litellm

response = litellm.completion(
    model="neosantara/deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "Write 3 database optimization tips."}],
    stream=True
)

for chunk in response:
    content = chunk.choices[0].delta.content or ""
    print(content, end="", flush=True)
print()
```

## Responses API Execution

Neosantara supports the OpenResponses endpoint (`/v1/responses`) for persistent execution and stateful job tracking. Call the `litellm.responses` function directly:

```python theme={"theme":{"light":"catppuccin-latte","dark":"ayu-dark"}}
import litellm
import os

response = litellm.responses(
    model="neosantara/gemini-3.8-flash",
    input="Summarize the core benefits of a regional AI gateway in 2 bullet points."
)

print(response.output[0].content[0].text)
print(f"Response ID: {response.id}")
```

## LiteLLM Proxy Configuration (`config.yaml`)

If running a centralized LiteLLM Proxy Server:

```yaml config.yaml theme={"theme":{"light":"catppuccin-latte","dark":"ayu-dark"}}
model_list:
  - model_name: my-fast-model
    litellm_params:
      model: neosantara/gemini-3.8-flash
      api_key: os.environ/NEOSANTARA_API_KEY

  - model_name: my-reasoning-model
    litellm_params:
      model: neosantara/deepseek-v4.1-flash
      api_key: os.environ/NEOSANTARA_API_KEY
```

## LiteLLM Integration Advantages

| Capability | Standard Integration | Native Neosantara Provider |
| :- | :- | :- |
| **Model Syntax** | `openai/<model>` | `neosantara/<model>` |
| **Routing & Fallback** | Manual endpoint configuration | Dynamic multi-model failover |
| **Cost & Token Tracking** | Static token estimations | Aligned with official Neosantara IDR rates |
| **Proxy & Gateway Support** | Custom adapter mapping required | Registered directly in LiteLLM proxy server |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.