> ## 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 User Logs

> Get recent API request logs for the authenticated user

Retrieve recent API request logs for the authenticated user. This endpoint provides detailed information about your API usage history, including model usage, costs, timestamps, and request status.

## Response

Returns an array of log entries containing information about recent API requests made with your API key.

## Log Entry Fields

* **key** - The API key used for the request
* **model** - The model that was used
* **route** - The API endpoint that was called
* **credits** - The cost in credits for this request
* **timestamp** - Unix timestamp when the request was made
* **status** - Request status (success, cancelled, error)
* **ip** - IP address from which the request was made
* **input\_tokens** - Number of input tokens (for text models)
* **output\_tokens** - Number of output tokens (for text models)

## Example Response

```json theme={null}
[
  {
    "key": "ek-abc123def456ghi789jkl012mno345pqr678stu901vwx234yz567",
    "model": "gpt-4o",
    "route": "chat.completions",
    "credits": 0.001475,
    "timestamp": 1747802046,
    "status": "success",
    "input_tokens": 23,
    "output_tokens": 9,
    "ip": "14.161.20.81"
  },
  {
    "key": "ek-abc123def456ghi789jkl012mno345pqr678stu901vwx234yz567",
    "model": "dall-e-3",
    "route": "images.generations",
    "credits": 0.2,
    "timestamp": 1747245603,
    "status": "success",
    "ip": "2001:ee0:d781:2280:e9d8:c4d6:c683:e48"
  },
  {
    "key": "ek-abc123def456ghi789jkl012mno345pqr678stu901vwx234yz567",
    "model": "claude-3-5-sonnet-20241022",
    "route": "chat.completions",
    "credits": 0.000609,
    "timestamp": 1747802047,
    "status": "success",
    "input_tokens": 23,
    "output_tokens": 36,
    "ip": "14.161.20.81"
  }
]
```

## Use Cases

* **Usage Tracking** - Monitor your API usage patterns and costs
* **Debugging** - Identify failed requests and troubleshoot issues
* **Analytics** - Analyze which models you use most frequently
* **Billing** - Track credit consumption over time
* **Security** - Monitor IP addresses accessing your API key


## OpenAPI

````yaml GET /user/logs
openapi: 3.0.1
info:
  title: Electron Hub API
  description: >-
    Unified API platform integrating 200+ AI models for chat, image generation,
    speech-to-text, 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/logs:
    get:
      tags:
        - User
      summary: Get User Logs
      description: Get recent API request logs for the authenticated user
      operationId: getUserLogs
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UserLogEntry'
components:
  schemas:
    UserLogEntry:
      type: object
      required:
        - key
        - model
        - route
        - credits
        - timestamp
        - status
        - ip
      properties:
        key:
          type: string
          description: API key used for the request
          example: ek-abc123def456ghi789jkl012mno345pqr678stu901vwx234yz567
        model:
          type: string
          description: Model used for the request
          example: gpt-4o
        route:
          type: string
          description: API endpoint used
          example: chat.completions
        credits:
          type: number
          description: Credits consumed by the request
          example: 0.0052320000000000005
        timestamp:
          type: integer
          description: Unix timestamp of the request
          example: 1747381627
        status:
          type: string
          enum:
            - success
            - cancelled
            - error
          description: Status of the request
          example: success
        ip:
          type: string
          description: IP address of the request
          example: 2001:ee0:d780:9820:9115:b97:7e06:bb5b
        input_tokens:
          type: integer
          description: Number of input tokens (for text models)
          example: 44
        output_tokens:
          type: integer
          description: Number of output tokens (for text models)
          example: 340
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your API key (starts with 'ek-')

````