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

# Models

> Python API reference for Netra models. Fetch model details and pricing information for AI models tracked by your project.

The Netra SDK exposes a `models` client that lets you:

* **Fetch model pricing** - Retrieve pricing details for all AI models in your project
* **Filter by model name** - Look up pricing for a specific model by name

This page shows how to use `Netra.models` to query model pricing information programmatically.

## Getting Started

The `models` client is available on the main `Netra` entry point after initialization.

```python theme={null}
from netra import Netra

Netra.init(app_name="sample-app")

# Access the models client
Netra.models.get_model_pricing(...)
```

***

## get\_model\_pricing

Fetch model details and pricing for all models associated with your project, or filter by a specific model name.

<CodeGroup>
  ```python Usage theme={null}
  from netra import Netra

  Netra.init(app_name="sample-app")

  # Fetch pricing for all models in the project
  all_models = Netra.models.get_model_pricing()
  print(all_models)

  # Fetch pricing for a specific model
  model = Netra.models.get_model_pricing(name="gpt-5.4-pro")
  print(model)
  ```

  ```python Signature theme={null}
  get_model_pricing(
      name: Optional[str] = None,
  ) -> List[Any] | Any
  ```
</CodeGroup>

### Parameters

| Parameter | Type   | Description                                                                              |
| --------- | ------ | ---------------------------------------------------------------------------------------- |
| `name`    | `str?` | Optional model name to filter results. When omitted, returns all models for the project. |

### Response

Returns a list of model objects from the API. Each object contains the model's details and pricing information. Returns an empty list if the request fails or no models are found.

<Accordion title="Response" icon="code">
  ```json theme={null}
  {
    "id": "string",
    "createdAt": "ISO-8601 timestamp",
    "updatedAt": "ISO-8601 timestamp",
    "deletedAt": "ISO-8601 timestamp | null",
    "projectId": "string | null",
    "name": "string",
    "matchPattern": "string",
    "prices": [
      {
        "price": "number",
        "maxUnits": "number | null",
        "minUnits": "number",
        "unitValue": "number",
        "usageType": "input | output | cache"
      }
    ]
  }
  ```
</Accordion>

<Tip>
  The `name` parameter performs a filter on the server side. Use it to avoid fetching the full model catalog when you only need pricing for a specific model.
</Tip>

***

## Configuration

### Environment Variables

The models client respects the following environment variables:

| Variable              | Default | Description                                                             |
| --------------------- | ------- | ----------------------------------------------------------------------- |
| `NETRA_OTLP_ENDPOINT` | —       | **Required.** The OTLP endpoint used to derive the models API base URL. |
| `NETRA_API_KEY`       | —       | API key for authenticating requests.                                    |

***

## Complete Example

```python theme={null}
from netra import Netra

# Initialize the SDK
Netra.init(
    app_name="pricing-demo",
    headers="x-api-key=your-api-key",
)

# 1. Fetch all model pricing
all_models = Netra.models.get_model_pricing()
print(f"Total models available: {len(all_models)}\n")

print(all_models)

# 2. Look up pricing for a specific model
target_model = "gpt-4o-mini"
results = Netra.models.get_model_pricing(name=target_model)

if results:
    print(results)
else:
    print(f"\nNo pricing found for {target_model}")
```

## Next Steps

* [Evaluation](/sdk-reference/evaluation/python) - Run test suites and evaluate AI outputs
* [Dashboard Query](/sdk-reference/dashboard-query/python) - Query dashboard metrics
* [Usage Utilities](/usage/usage-utilities) - Query traces and spans
