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

# Get Model Breakdown

> Retrieve a per-model cost and usage breakdown for the authenticated user, including request counts, token usage, total cost, and provider information for every model used.

Retrieve a per-model cost and usage breakdown for the authenticated user. This endpoint provides detailed consumption statistics for every model you've used, including request counts, token usage, and total cost.

## Response

Returns an object containing:

* **total\_consumption** — Your total API spend across all models
* **models** — A map of model IDs to their usage statistics
* **last\_updated** — ISO timestamp of the last usage update

## Model Fields

Each model entry in the `models` object contains:

* **requests** — Total number of requests made to this model
* **input\_tokens** — Total input tokens consumed
* **output\_tokens** — Total output tokens generated
* **total\_cost** — Total cost in credits for this model
* **owned\_by** — The provider/owner of the model (e.g. `openai`, `anthropic`, `google`, `deepseek`)

## Example Response

```json theme={null}
{
  "total_consumption": 12.847,
  "models": {
    "gpt-4o": {
      "requests": 342,
      "input_tokens": 128450,
      "output_tokens": 67230,
      "total_cost": 4.215,
      "owned_by": "openai"
    },
    "claude-sonnet-4-20250514": {
      "requests": 156,
      "input_tokens": 89200,
      "output_tokens": 45100,
      "total_cost": 3.628,
      "owned_by": "anthropic"
    },
    "gemini-2.5-pro-preview-05-06": {
      "requests": 89,
      "input_tokens": 52300,
      "output_tokens": 31200,
      "total_cost": 2.104,
      "owned_by": "google"
    },
    "dall-e-3": {
      "requests": 15,
      "input_tokens": 0,
      "output_tokens": 0,
      "total_cost": 1.500,
      "owned_by": "openai"
    },
    "deepseek-chat": {
      "requests": 210,
      "input_tokens": 95400,
      "output_tokens": 48700,
      "total_cost": 1.400,
      "owned_by": "deepseek"
    }
  },
  "last_updated": "2026-03-02T15:30:00Z"
}
```

## Code Examples

<CodeGroup>
  ```python Python theme={null}
  from httpx import Client

  api_key = "ek-your-api-key"
  headers = {
      "Authorization": f"Bearer {api_key}"
  }

  client = Client()
  response = client.get("https://api.electronhub.ai/v1/user/models", headers=headers)
  data = response.json()

  print(f"Total spend: ${data['total_consumption']:.2f}")
  for model, stats in sorted(data['models'].items(), key=lambda x: x[1]['total_cost'], reverse=True):
      print(f"  {model}: ${stats['total_cost']:.3f} ({stats['requests']} requests)")
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.electronhub.ai/v1/user/models', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  const data = await response.json();

  console.log(`Total spend: $${data.total_consumption.toFixed(2)}`);
  for (const [model, stats] of Object.entries(data.models)
    .sort((a, b) => b[1].total_cost - a[1].total_cost)) {
    console.log(`  ${model}: $${stats.total_cost.toFixed(3)} (${stats.requests} requests)`);
  }
  ```

  ```bash cURL theme={null}
  curl -X GET "https://api.electronhub.ai/v1/user/models" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```
</CodeGroup>

## Use Cases

* **Cost Analysis** — Identify which models consume the most credits
* **Usage Optimization** — Find underused or overused models to optimize spending
* **Provider Breakdown** — See spending distribution across providers (OpenAI, Anthropic, Google, etc.)
* **Budget Planning** — Track per-model costs to forecast weekly credit consumption
* **Model Comparison** — Compare token efficiency across different models


## OpenAPI

````yaml GET /user/models
openapi: 3.0.1
info:
  title: Electron Hub API
  description: >-
    Unified API platform integrating 200+ AI models for chat, image generation,
    embeddings, and more.
  version: 1.0.0
  contact:
    name: Electron Hub Support
    email: support@electronhub.ai
    url: https://discord.com/invite/electronhub
  license:
    name: MIT
servers:
  - url: https://api.electronhub.ai/v1
    description: Production API v1
security:
  - bearerAuth: []
paths:
  /user/models:
    get:
      tags:
        - User
      summary: Get Model Breakdown
      description: >-
        Retrieve a per-model cost and usage breakdown for the authenticated
        user, including request counts, token usage, total cost, and provider
        information for every model used.
      operationId: getUserModelBreakdown
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelBreakdownResponse'
components:
  schemas:
    ModelBreakdownResponse:
      type: object
      required:
        - total_consumption
        - models
      properties:
        total_consumption:
          type: number
          description: Total API spend across all models (in credits/USD)
          example: 12.847
        models:
          type: object
          description: Map of model IDs to their usage statistics
          additionalProperties:
            $ref: '#/components/schemas/ModelUsageStats'
          example:
            gpt-4o:
              requests: 342
              input_tokens: 128450
              output_tokens: 67230
              total_cost: 4.215
              owned_by: openai
            claude-sonnet-4-20250514:
              requests: 156
              input_tokens: 89200
              output_tokens: 45100
              total_cost: 3.628
              owned_by: anthropic
        last_updated:
          type: string
          format: date-time
          description: ISO timestamp of the last usage update
          nullable: true
          example: '2026-03-02T15:30:00Z'
    ModelUsageStats:
      type: object
      properties:
        requests:
          type: integer
          description: Total number of requests made to this model
          example: 342
        input_tokens:
          type: integer
          description: Total input tokens consumed
          example: 128450
        output_tokens:
          type: integer
          description: Total output tokens generated
          example: 67230
        total_cost:
          type: number
          description: Total cost in credits for this model
          example: 4.215
        owned_by:
          type: string
          description: Provider/owner of the model
          example: openai
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your API key (starts with 'ek-')

````