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

# LiteLLM

> Learn how to use LiteLLM with ScitiX Model Inference to route OpenAI-style requests through a unified LLM API interface.

[LiteLLM](https://github.com/BerriAI/litellm) is a Python SDK and proxy server that calls 100+ LLM APIs through one OpenAI-style interface. Its OpenAI-compatible provider (`openai/<model>` with a custom `api_base`) points it at the ScitiX Model Inference API.

Default model here is `glm-5.2`; see the [Models](https://console.scitix.ai/model-inference/models) page for the full list and pricing.

## Configure

Create an API key on the ScitiX [API Keys](https://console.scitix.ai/model-inference/api_keys) page and export it. Keep keys out of source code:

```bash theme={null}
export SCITIX_API_KEY="<Your API Key>"
```

### SDK

Prefix the model with `openai/` and set `api_base`:

```python theme={null}
import os
from litellm import completion

response = completion(
    model="openai/glm-5.2",
    api_base="https://api.scitix.ai/model-api/v1",
    api_key=os.environ["SCITIX_API_KEY"],
    messages=[{"role": "user", "content": "In one short sentence, which model are you?"}],
)
print(response.choices[0].message.content)
```

### Proxy

Use the same routing in `config.yaml` for the LiteLLM proxy server:

```yaml theme={null}
model_list:
  - model_name: glm-5.2
    litellm_params:
      model: openai/glm-5.2
      api_base: https://api.scitix.ai/model-api/v1
      api_key: os.environ/SCITIX_API_KEY
```

| Field      | Description                                                                                                              |
| ---------- | ------------------------------------------------------------------------------------------------------------------------ |
| `model`    | `openai/<id>` — the `openai/` prefix selects the OpenAI-compatible route; use the ScitiX model ID, e.g. `openai/glm-5.2` |
| `api_base` | ScitiX OpenAI-compatible endpoint: `https://api.scitix.ai/model-api/v1`. LiteLLM appends `/chat/completions`.            |
| `api_key`  | Your ScitiX API key. SDK: pass `api_key=`; proxy: use `os.environ/SCITIX_API_KEY`                                        |

The `openai/` prefix is required for a custom OpenAI-compatible endpoint. Without it LiteLLM tries to infer the provider from the bare model ID and won't route to `api_base`.

Choose a model with native tool calling if you use LiteLLM's function-calling features.

## Verify

Run the SDK snippet above with `SCITIX_API_KEY` exported. A normal reply confirms the connection — verified on **litellm 1.96.0**:

```text theme={null}
$ python scitix_litellm.py
I am GLM, a large language model developed by Z.ai.
```

For the proxy, run:

```bash theme={null}
litellm --config config.yaml
```

Then call `http://localhost:4000/v1/chat/completions` with `model: glm-5.2`.

LiteLLM's bundled model database does not list ScitiX model IDs, so it may warn about unknown context size or price. Pass `max_tokens` explicitly, or register the model with `litellm.register_model({...})`. This does not affect chat responses.
