Skip to content

Get‑ShpCostEstimate

Raimund edited this page Aug 6, 2026 · 3 revisions

SYNOPSIS

Estimates the input cost of a prompt before sending it.

SYNTAX

Get-ShpCostEstimate [-Text] <String> [[-Model] <String>] 
 [<CommonParameters>]

DESCRIPTION

Combines the approximate token count from ConvertTo-ShpTokenCount with the module price table to estimate what the input side of a call will cost, in USD and Copilot premium-request credits, before the call is made. Only the input (prompt) side is estimated; the completion size is unknown until the model replies, so the real cost reported by Invoke-Shp will be higher. The price-table key is resolved case-insensitively; when the model has no entry the token count is still returned with null cost, Priced is false, and PriceTableKey names the key that was looked up and missed - so an unpriced model is never mistaken for a free one.

EXAMPLES

EXAMPLE 1

Get-ShpCostEstimate -Text 'Explain quantum tunnelling.' -Model claude-opus-4.8

Estimates the input tokens and USD/credit cost for the prompt.

PARAMETERS

-Model

The model id whose input rate is used. Defaults to the session default model (Select-ShpModel) or the built-in fallback when none is set.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Text

The prompt text to estimate. Mandatory.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Management.Automation.PSCustomObject

An object with Model, EstimatedInputTokens, EstimatedInputCostUSD,

EstimatedInputCredits, Tier ('Default' or 'LongContext'; null when

the model has no price-table entry), Priced and PriceTableKey.

NOTES

RELATED LINKS

ConvertTo-ShpTokenCount

Clone this wiki locally