Skip to main content

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.

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

metric_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.
units
float
required
How many units of metric_type the planned operation would consume (e.g. number of tokens, number of memories).
item_count
int
Optional count of discrete items the operation would touch. Some metrics price differently for batched vs. single-item operations.
endpoint
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.
mode
string
Processing mode for the planned operation (for example "fast" or "long-range" for ingestion). Some metrics price differently per mode.

Returns

CreditEstimate with the quoted cost.
credits_estimate
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.

Example

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