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

# Credit Multipliers

> Understanding how API credit multipliers work with dynamic pricing

export const title_0 = undefined

export const cards_0 = undefined

The CoinStats API uses a flexible credit system that can dynamically adjust costs based on the complexity and scale of your requests.

## How Credits Work

Every API endpoint has a base credit cost, but some endpoints use **multipliers** to scale costs based on the parameters you provide. This ensures fair pricing - simple requests cost less, while complex requests that require more resources cost proportionally more.

<CardGroup cols={2}>
  <Card title="Fixed Credits" icon="tag">
    Simple endpoints with constant resource usage have fixed credit costs
  </Card>

  <Card title="Dynamic Credits" icon="chart-line">
    Advanced endpoints scale costs based on request complexity using multipliers
  </Card>
</CardGroup>

## Understanding Multipliers

Multipliers allow endpoints to calculate credits based on:

<AccordionGroup>
  <Accordion title="Query Parameters">
    Parameters in the URL query string (e.g., `?networks=ethereum,polygon`)
  </Accordion>

  <Accordion title="Request Body">
    Data sent in POST/PATCH request bodies, including nested objects
  </Accordion>
</AccordionGroup>

## How Multiplier Calculation Works

The total credit cost is calculated by applying multipliers to each parameter individually:

<Frame>
  Total Credits = Sum of (Base Credits × Multiplier for each parameter)
</Frame>

**Important:** Multipliers can be applied multiple times within the same request. Example:

```json theme={null}
"body":{
  "wallets": [
    {"address":"0x123...", "connectionId": "ethereum"},
    {"address":"0x456...", "connectionId": "all"}
    ]
}
```

In this scenario, if the base credit is 4, the total credits will be calculated as follows:

* **Wallet 1**: `connectionId: "ethereum"` → 4 × 1 = **4 credits**
* **Wallet 2**: `connectionId: "all"` → 4 × 10 = **40 credits**
* **Total**: 4 + 40 = **44 credits**

Each wallet is processed independently with its own multiplier based on the `connectionId` value.

Here's a visual breakdown of how the system processes requests with multipliers:

```mermaid theme={null}
flowchart TD
    A["API Request<br/>Base Credits: 4"] --> B{Has Multipliers?}
    
    B -->|No| C[Fixed Credits<br/>Base Cost Only]
    B -->|Yes| D[Analyze Each Wallet]
    
    D --> E["Wallet 1<br/>connectionId: 'ethereum'<br/>Multiplier: 1x"]
    D --> F["Wallet 2<br/>connectionId: 'all'<br/>Multiplier: 10x"]
    
    E --> G["Calculate Cost<br/>4 × 1 = 4 credits"]
    F --> H["Calculate Cost<br/>4 × 10 = 40 credits"]
    
    G --> I["Total Credits<br/>4 + 40 = 44"]
    H --> I
    
    C --> J[Final Cost]
    I --> J
    
    J --> K{Credits Available?}
    K -->|Yes| L["✅ Request Processed"]
    K -->|No| M["❌ 429 Error<br/>Credits limit reached"]
```

### Multiplier Values

Different parameters have different multiplier effects:
The exact base cost depends on the endpoint. Replace `base` in these examples with the credit count shown in the endpoint docs.

<Tabs>
  <Tab title="Query">
    When you provide multiple values (comma-separated or as arrays):

    ```bash theme={null}
    # Single network = base credits
    ?networks=ethereum

    # Multiple networks = base credits × count
    ?networks=ethereum,polygon,binance_smart  # 3× multiplier
    ```
  </Tab>

  <Tab title="'all' value">
    Using `"all"` applies a predefined multiplier:

    ```bash theme={null}
    # Using 'all' applies default multiplier (usually 10×)
    ?connectionIds=all  # 10× multiplier
    ```

    <Warning>
      **Mixed 'all' and specific values**: Combining `"all"` with other values (e.g., `connectionIds=all,ethereum,polygon`) adds extra complexity and costs. The system counts all items AND adds additional credits for the 'all' portion.
    </Warning>
  </Tab>

  <Tab title="Nested Body">
    Request body arrays also scale costs:

    ```json theme={null}
    {
      "wallets": [
        {"address": "0x123...", "connectionId": "ethereum"},
        {"address": "0x456...", "connectionId": "polygon"}
      ]
    }
    // 2× multiplier for 2 wallets = base × 2 credits
    ```

    **With mixed multipliers:**

    ```json theme={null}
    {
      "wallets": [
        {"address": "0x123...", "connectionId": "ethereum"},
        {"address": "0x456...", "connectionId": "all"}
      ]
    }
    // Wallet 1: base × 1 credits, Wallet 2: base × 10 credits
    // Total: base × 11 credits
    ```

    **Many 'connectionId' fields**

    ```json theme={null}
    {
      "wallets": [
        {"address": "0x123...", "connectionId": "ethereum,polygon"}
        {"address": "0x456...", "connectionId": "all"}
      ]
    }
    // Wallet 1: base × 2 credits, Wallet 2: base × 10 credits
    // Total: base × 12 credits
    ```

    <Info>
      **Cost Difference:** Using specific networks (`ethereum,polygon`) costs **80% less** than using `"all"` (2× base vs 10× base). Always specify only the networks you actually need!
    </Info>

    <Info>
      If you need all of networks/connections better use `all` instead of 10+ connectionId/network. (10× base vs 10× base+)
    </Info>
  </Tab>
</Tabs>

## Cost Optimization Tips

<CardGroup cols={1}>
  <Card title="🎯 Avoid 'all' Values When Possible" icon="bullseye">
    The `"all"` value applies a **10× multiplier**. Be specific instead:

    ```bash theme={null}
    # ❌ Expensive (10× multiplier)
    ?connectionId=all

    # ✅ Much cheaper (1× multiplier each)
    ?connectionId=ethereum  # or specify only what you need
    ```

    **Savings:** Using specific values instead of `"all"` can reduce costs by 90%
  </Card>

  <Card title="🔄 Understand Array Multipliers" icon="layer-group">
    Each item in arrays gets its own multiplier. Plan your requests accordingly:

    ```json theme={null}
    // Example: base cost is the credit count shown on the endpoint
    {
      "wallets": [
        {"address": "0x123...", "connectionId": "ethereum"},  // base × 1 credits
        {"address": "0x456...", "connectionId": "all"}        // base × 10 credits
      ]
    }
    // Total: base × 11 credits (not base × 2 credits!)
    ```

    **Key insight:** Mixed multipliers within the same array can create unexpected costs.
  </Card>

  <Card title="⚡ Separate High-Cost Items" icon="bolt">
    Consider splitting requests when mixing standard and high-multiplier values:

    ```json theme={null}
    # ❌ Mixed request (base × 11 credits total)
    POST /endpoint
    {
      "wallets": [
        {"connectionId": "ethereum", "address": "0x123..."},  // base × 1 credits
        {"connectionId": "all", "address": "0x123..."}        // base × 10 credits
      ]
    }

    # ✅ Separate requests (base × 2 credits total if you don't actually need "all")
    POST /endpoint {"wallets": [{"connectionId": "ethereum", "address": "0x123..."}]}  // base × 1 credits
    POST /endpoint {"wallets": [{"connectionId": "polygon", "address": "0x123..."}]}   // base × 1 credits
    ```
  </Card>

  <Card title="📊 Monitor Usage Patterns" icon="chart-bar">
    Track your credit usage in the [CoinStats API Dashboard](https://openapi.coinstats.app) to:

    * Identify unexpectedly expensive requests
    * Find patterns where `"all"` multipliers are driving costs
    * Optimize requests with high multiplier combinations
  </Card>
</CardGroup>

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="Why do multipliers exist?">
    Multipliers ensure fair pricing based on actual resource consumption. Requesting data for 1 wallet requires fewer resources than requesting data for 100 wallets, so the pricing reflects this difference.
  </Accordion>

  <Accordion title="Can I avoid multipliers?">
    Yes! Use endpoints with fixed pricing when possible, or make multiple smaller requests instead of one large request with many parameters.
  </Accordion>

  <Accordion title="Are multipliers applied to all parameters?">
    No, only specific parameters on certain endpoints use multipliers. Check each endpoint's documentation for details about which parameters are multiplied.
  </Accordion>

  <Accordion title="What happens if I exceed my credit limit?">
    Your requests will be rejected with a `429 Too Many Requests` error. You can upgrade your plan or wait for your credits to reset based on your plan's terms.
  </Accordion>
</AccordionGroup>

<Note>
  **Pro Tip**: Start with smaller requests to understand costs, then optimize based on your actual usage patterns. The API dashboard provides detailed insights to help you optimize your credit usage.
</Note>

<Warning>
  **Important**: Always test with small parameter sets first to understand the credit impact before making large batch requests. Multipliers can significantly increase costs for large parameter sets.
</Warning>

## {title_0 || "Support"}

{cards_0 ? (
<CardGroup cols={2}>
<Card title="Support Documentation" icon="question" href="https://help.coinstats.app/en/articles/12002063">
  Check our comprehensive help center
</Card>

<Card title="Telegram Support" icon="telegram" href="https://t.me/+JPUMD1QAMTNmNGQy">
  Join our API support channel for real-time help
</Card>

 <Card title="Email Support" icon="telegram" href="mailto:api.support@coinstats.app">
  You can reach us directly at api.support@coinstats.app
</Card>
</CardGroup>
) : (
  <ul>
      <li><strong>Documentation</strong>: This site contains comprehensive API documentation</li>
      <li><strong>Telegram Chat</strong>: For quick help and to connect with other developers, join our <a href="https://t.me/+JPUMD1QAMTNmNGQy">API Support Telegram group</a></li>
      <li><strong>Email Support</strong>: You can reach us directly at <a href="mailto:api.support@coinstats.app"><strong><u>api.support@coinstats.app</u></strong></a> for personalized assistance.</li>
  </ul>
)}
