# Get models pricing (Admin) div strong 🔨 In Development — This section is still being developed and may change. **GET** `/v1/pricing/models` - Retrieve detailed AI model pricing information with admin-specific financial data including markup percentages, actual costs, and profit margins. Administrative endpoint that provides comprehensive pricing information for all AI models, including internal cost structure and profit margins. This endpoint is restricted to administrators only. ## Authentication This endpoint requires admin-level API keys. - **Header**: `api-key: YOUR_ADMIN_API_KEY` - Get your admin API key from [Freddy Hub → Admin → API Keys](https://freddy-hub.aitronos.com/admin/api-keys) ## Response Returns a `ModelsPricingResponse` object containing detailed pricing for all models. **`models`** array Array of model pricing objects, each containing: **`modelId`** string - Model identifier (e.g., `gpt-4`, `claude-3-opus`) **`modelName`** string - Human-readable model name **`provider`** string - Model provider (`OpenAI`, `Anthropic`, `Aitronos`) **`inputCostPer1k`** number - Cost per 1,000 input tokens in USD **`outputCostPer1k`** number - Cost per 1,000 output tokens in USD **`currency`** string - Pricing currency (always `USD`) **`ourMarkup`** number - Aitronos markup percentage (admin only) **`costToUs`** number - Actual cost from provider (admin only) **`profitMargin`** number - Profit per 1k tokens (admin only) **`currency`** string Base currency for all pricing (`USD`) **`conversionRate`** number Conversion rate from USD to CHF (base currency) **`lastUpdated`** string ISO 8601 timestamp of last pricing update Request ```bash curl https://api.freddy.aitronos.com/v1/pricing/models \ -H "api-key: $FREDDY_ADMIN_API_KEY" ``` ```python import requests response = requests.get( "https://api.freddy.aitronos.com/v1/pricing/models", headers={"api-key": api_key} ) pricing = response.json() print(f"Found pricing for {len(pricing['models'])} models") for model in pricing['models']: print(f"{model['modelName']}: Input ${model['inputCostPer1k']}/1k, Output ${model['outputCostPer1k']}/1k") print(f" Markup: {model['ourMarkup']}%, Profit: ${model['profitMargin']}/1k") ``` ```javascript const response = await fetch('https://api.freddy.aitronos.com/v1/pricing/models', { headers: { 'api-key': process.env.FREDDY_ADMIN_API_KEY } }); const pricing = await response.json(); console.log(`Found pricing for ${pricing.models.length} models`); pricing.models.forEach(model => { console.log(`${model.modelName}: Input $${model.inputCostPer1k}/1k, Output $${model.outputCostPer1k}/1k`); console.log(` Markup: ${model.ourMarkup}%, Profit: $${model.profitMargin}/1k`); }); ``` ## Response 200 OK ```json { "models": [ { "modelId": "gpt-4", "modelName": "GPT-4", "provider": "OpenAI", "inputCostPer1k": 0.03, "outputCostPer1k": 0.06, "currency": "USD", "ourMarkup": 15, "costToUs": 0.03, "profitMargin": 0.0045 }, { "modelId": "gpt-3.5-turbo", "modelName": "GPT-3.5 Turbo", "provider": "OpenAI", "inputCostPer1k": 0.0015, "outputCostPer1k": 0.002, "currency": "USD", "ourMarkup": 20, "costToUs": 0.0015, "profitMargin": 0.0003 }, { "modelId": "claude-3-opus", "modelName": "Claude 3 Opus", "provider": "Anthropic", "inputCostPer1k": 0.015, "outputCostPer1k": 0.075, "currency": "USD", "ourMarkup": 10, "costToUs": 0.015, "profitMargin": 0.0015 } ], "currency": "USD", "conversionRate": 0.9, "lastUpdated": "2025-10-16T10:30:00Z" } ``` Errors **401 Unauthorized** Invalid or missing admin API key. ```json { "error": { "message": "Admin authentication required", "code": "unauthorized" } } ``` **403 Forbidden** Valid API key but insufficient permissions. ```json { "error": { "message": "Admin access required", "code": "forbidden" } } ``` **500 Internal Server Error** Server error retrieving pricing data. ```json { "error": { "message": "Failed to retrieve models pricing: [error details]", "code": "internal_error" } } ``` ## Understanding Admin Fields ### Markup Percentage (`ourMarkup`) The percentage markup applied to the provider's base cost. For example, a 15% markup on $0.03 means customers pay $0.0345. ### Cost To Us (`costToUs`) The actual cost charged by the AI provider (OpenAI, Anthropic, etc.) per 1,000 tokens. This is what Aitronos pays. ### Profit Margin (`profitMargin`) The profit Aitronos makes per 1,000 tokens after applying the markup: ``` profitMargin = (inputCostPer1k - costToUs) ``` ## Use Cases ### Financial Reporting ```python import requests response = requests.get( "https://api.freddy.aitronos.com/v1/pricing/models", headers={"api-key": admin_key} ) pricing = response.json() total_markup = sum(m['ourMarkup'] for m in pricing['models']) / len(pricing['models']) print(f"Average markup across all models: {total_markup}%") # Find most profitable model most_profitable = max(pricing['models'], key=lambda m: m['profitMargin']) print(f"Most profitable: {most_profitable['modelName']} (${most_profitable['profitMargin']}/1k)") ``` ### Pricing Analysis ```python # Compare pricing across providers by_provider = {} for model in pricing['models']: provider = model['provider'] if provider not in by_provider: by_provider[provider] = [] by_provider[provider].append(model) for provider, models in by_provider.items(): avg_input_cost = sum(m['inputCostPer1k'] for m in models) / len(models) avg_output_cost = sum(m['outputCostPer1k'] for m in models) / len(models) print(f"{provider}: Avg ${avg_input_cost:.4f}/1k input, ${avg_output_cost:.4f}/1k output") ``` ### Cost Monitoring ```python # Monitor cost changes over time import json from datetime import datetime response = requests.get( "https://api.freddy.aitronos.com/v1/pricing/models", headers={"api-key": admin_key} ) pricing = response.json() # Save snapshot for historical tracking snapshot = { "timestamp": datetime.now().isoformat(), "pricing": pricing } with open(f"pricing_snapshot_{datetime.now().date()}.json", "w") as f: json.dump(snapshot, f, indent=2) ``` ## Related Endpoints - **[Get overall pricing configuration](/docs/api-reference/admin/pricing-configuration)** - Currency, tiers, discount rules - **[Get neurons pricing](/docs/api-reference/admin/pricing-neurons)** - Neuron purchase pricing tiers ## Notes - Pricing data is cached and updated periodically - `lastUpdated` timestamp indicates when pricing was last refreshed from providers - Conversion rate applies when displaying prices in CHF - This endpoint is for internal administration only - do not expose to end users - Model availability may vary by organization tier *Admin API endpoints require administrator-level authentication and should not be exposed to regular users.*