Skip to main content

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.

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.
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.
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)

Parameters

ParameterTypeDescription
namestr?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.
{
  "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"
    }
  ]
}
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.

Configuration

Environment Variables

The models client respects the following environment variables:
VariableDefaultDescription
NETRA_OTLP_ENDPOINTRequired. The OTLP endpoint used to derive the models API base URL.
NETRA_API_KEYAPI key for authenticating requests.

Complete Example

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

Last modified on May 21, 2026