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

# credits.estimate

> Get a dry-run credit cost quote for a planned operation, without spending any credits.

```python theme={null}
await sdk.credits.estimate(
    metric_type,
    units,
    item_count=None,
    endpoint=None,
    mode=None,
)
```

Returns the credit cost that would be charged for a hypothetical operation, based on the current pricing for your client. The call is a pure quote (it never debits the wallet) so it's safe to invoke before a large ingestion batch, a long retrieval, or whenever you want to surface an "estimated cost" preview to your users.

### Parameters

<ParamField path="metric_type" type="string" required>
  The metered metric you want to price. Examples include `"llm_input_tokens"`, `"llm_output_tokens"`, `"memories_ingested"`, and `"retrievals"`. Match the metric you'd expect to see in the ledger.
</ParamField>

<ParamField path="units" type="float" required>
  How many units of `metric_type` the planned operation would consume (e.g. number of tokens, number of memories).
</ParamField>

<ParamField path="item_count" type="int">
  Optional count of discrete items the operation would touch. Some metrics price differently for batched vs. single-item operations.
</ParamField>

<ParamField path="endpoint" type="string">
  Operation identifier the quote is scoped to. Lets the server apply the right rate when a metric has different pricing across operations. Leave unset to use the default rate for the metric.
</ParamField>

<ParamField path="mode" type="string">
  Processing mode for the planned operation (for example `"fast"` or `"long-range"` for ingestion: the ingestion axis of [Retrieval Modes](/concepts/retrieval-modes)). Some metrics price differently per mode.
</ParamField>

### Returns

`CreditEstimate` with the quoted cost.

<ResponseField name="credits_estimate" type="float">
  The credit amount that would be debited if the operation ran with the supplied parameters at the current rate. No credits are spent by this call.
</ResponseField>

### Example

```python theme={null}
from maximem_synap import MaximemSynapSDK

sdk = MaximemSynapSDK(api_key="synap_your_key_here")
await sdk.initialize()

# Quote the cost of ingesting ~1,000 LLM input tokens
quote = await sdk.credits.estimate(
    metric_type="llm_input_tokens",
    units=1000,
    mode="long-range",
)

print(f"Would cost {quote.credits_estimate} credits")

# Compare against the current balance before proceeding
balance = await sdk.credits.get_balance()
if quote.credits_estimate > balance.balance_credits:
    print("Not enough credits. Top up or redeem a code first.")
```

### Raises

* `SynapAuthError`: when the API key is missing or invalid.
* `SynapValidationError`: when `metric_type` is not recognized or `units` is negative.

### See also

* [credits.get\_balance](/sdk-reference/credits/get-balance)
* [credits.get\_ledger](/sdk-reference/credits/get-ledger)
* [credits.redeem](/sdk-reference/credits/redeem)
