Model Definitions

Estimated reading: 9 minutes

The Model Definitions page allows you to configure how Large Language Models (LLMs) are identified, how their token usage is determined, and how usage costs are calculated in Control Plane.

Different models may use different naming conventions, tokenization methods, and pricing structures. Model Definitions provide a centralized way to configure these differences so that Control Plane can associate incoming model usage records with the appropriate settings.

Without a matching model definition, Control Plane may not apply the intended tokenization settings or pricing rules to incoming usage records.

Why Model Definitions Are Needed

Model Definitions help Control Plane process model usage consistently by allowing administrators to:

a. Identify models: Match incoming model names to the appropriate definitions using regular expressions.
b. Determine token usage: Use provider-reported token counts or estimate token counts using a configured tokenizer when usage information is unavailable.
c. Calculate usage costs: Configure prices for input, output, and other supported usage types.
d. Apply conditional pricing: Define pricing tiers for usage that meets specified conditions.
e. Manage configurations centrally: Maintain model matching, tokenization, and pricing settings in one place.

How Model Definitions Work

When Control Plane receives model usage records, it uses the configured model definitions to determine how the records should be processed.

1. Receive usage data: Control Plane ingests generation records containing model information and, when available, token usage details.

2. Match the model: The incoming model name is evaluated against the configured Match Pattern.

3. Determine token usage: Provider-reported token counts are used when available. Otherwise, Control Plane can estimate token counts using the configured tokenizer, if enabled.

4. Evaluate pricing rules: Control Plane evaluates the conditions of configured custom pricing tiers.

5. Calculate costs: The applicable prices are used with the corresponding usage quantities to calculate costs.

Roles and Permissions

Only users with the Admin or Owner role can manage model definitions.

Definition Type Available Actions Required Role
Default Clone Admin or Owner
Custom Edit, Delete Admin or Owner
Note: Default model definitions are read-only. Admins and Owners can clone a default definition to create a custom definition and modify its settings.

Managing Model Definitions

The Model Definitions table displays configured model definitions and their associated settings.

Column Reference

Column Description
Model Name Displays the name assigned to the model definition.
Maintainer Displays the organization or provider responsible for the model.
Match Pattern Displays the regular expression used to match incoming model names.
Prices Displays the configured prices for supported usage types.
Tokenizer Displays the tokenizer configured for the definition.
Tokenizer Config Displays the additional configuration associated with the selected tokenizer.
Last Used Displays the date and time when the model definition was last used.
Actions Provides the available actions for the model definition.

To customize the displayed columns, use the Column Visibility menu above the table. Select Restore Defaults to restore the default column layout.

Available Actions

The actions available depend on the type of model definition.

a. Clone: Creates an independent copy of an existing definition.
b. Edit: Opens a custom definition for modification.
c. Delete: Removes a custom definition.
d. Test Model Match: Tests whether a model name matches a definition and allows you to inspect the resulting pricing configuration.

Default definitions cannot be edited or deleted.

Adding a Model Definition

Create a model definition when an existing definition does not provide the required model matching, tokenization, or pricing configuration.

1. Select Add Model Definition.
2. Enter the Model Name.
3. Enter the Match Pattern using PostgreSQL-compatible regular expression syntax.
4. Configure the Prices section:
i. Select Prefill Usage Types from Template and choose a template, such as OpenAI or Anthropic, to populate the pricing fields.
ii. Alternatively, select Add Price to define a custom usage type and its price.

5. Optionally, configure one or more Custom Pricing Tiers:
 i. Enter a Tier Name and set its priority.
ii. Add conditions that determine when the tier applies.
iii. Configure prices for the supported usage types within the tier.
iv. Review the calculated values in Price Preview.

6. Select the appropriate Tokenizer, such as OpenAI, Claude, or None.
7. Optionally, configure Tokenizer Config as a valid JSON object.
8. Select Submit to create the model definition.

Note: Token estimation can be useful when generation records do not include token counts. For example, it can help estimate token usage for streamed OpenAI completions when the required usage information is unavailable.

Configuring Match Patterns

The Match Pattern is a regular expression evaluated against the model attribute of ingested generation records. It determines whether an incoming model name matches a model definition.

Use patterns that identify the intended model names without unintentionally matching other models.

Examples

Exact match, case-insensitive (?i)^(modelname)$
Matches modelname, ModelName, and other casing variations of the exact name.

Match with an optional version suffix (?i)^(chat-bison)(@[a-zA-Z0-9]+)?$
Matches chat-bison and names such as chat-bison@v1.

Best practice: Use specific patterns and avoid unintended overlaps between model definitions.

Configuring Prices and Custom Pricing Tiers

Default Base Prices

The Input and Output usage types are included by default with the following initial prices:

Usage Type Initial Price per Token
Input 0.000001
Output 0.000002
Note: These values are provided as initial configuration settings and do not represent guaranteed provider pricing. Update the pricing values to match the applicable rates defined by the selected model provider and deployment.

Custom Pricing Tiers

Custom Pricing Tiers allow you to configure different prices for usage that meets specified conditions, such as cached input tokens or other supported usage categories.

Each tier includes a name, priority, conditions, and pricing configuration. All conditions within a tier must be satisfied for the tier to qualify. When multiple tiers qualify, their priorities determine which tier is selected according to the platform’s pricing rules.

Supported Condition Operators

Operator Description
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
= Equal to
!= Not equal to

Adding a Custom Pricing Tier

  1. Select Add Custom Tier and enter a Tier Name.
  2. Set the tier's priority.
  3. Select Add Condition and configure the following fields:
Field Description
Usage Detail Pattern (Regex) A regular expression used to match a usage detail key, such as ^input, .*cache.*, or output_tokens.
Operator The comparison operator used to evaluate the condition.
Value The value used for comparison.
Case Sensitive Specifies whether pattern matching distinguishes between uppercase and lowercase characters. Disabled by default.
  1. Under Prices, configure the usage types and their corresponding prices for the tier.
  2. Review Price Preview, which displays prices per unit, per 1,000 units, and per 1,000,000 units.
  3. Adjust the tier priorities as needed.
  4. Save the model definition.

Configuring Tokenizer Settings

The Tokenizer specifies the method Control Plane uses to estimate input and output token counts when provider-reported usage information is unavailable.

Supported Tokenizers

Tokenizer Description
Claude Uses Claude-compatible tokenization to estimate token counts.
OpenAI Uses OpenAI-compatible tokenization to estimate token counts.
None Disables token count estimation. Provider-reported usage information can still be captured when available.
Note: Token estimation is used only when usage information is not returned by the model provider. When provider-reported usage data is available, Control Plane uses the reported values instead of estimating token counts.

Tokenizer Config (JSON)

Tokenizer Config provides additional settings for the selected tokenizer. The value must be a valid JSON object. Enter an empty object ({}) to use the default configuration when no additional settings are required.

Example:

{
  “tokenizerModel”: “babbage-002”
}
The supported configuration properties depend on the selected tokenizer.

Testing and Verification

Use Test Model Match to verify that a model name matches the intended definition and inspect the resulting pricing configuration.

Testing a Model Match

1. Open the model definition’s Actions menu and select Test Model Match.
2. Enter the model name you want to test.
3. Optionally, configure Usage Details:
    i. Select a predefined OpenAI or Anthropic template.
    ii. Add manual rows for custom usage categories, such as cache_read_input_tokens.
4. Select Test Match.
5. Review the results.

Understanding Test Results

Result Description
Match Found Indicates whether a matching model definition was found.
Matched Model Displays the matched model name and the pattern used for the match.
Matched Pricing Tier Displays the selected pricing tier, its priority, and the associated pricing breakdown, when applicable.
Note: Review the test results to verify that the expected model definition and pricing tier are selected. Use the results to identify incorrect matching patterns, priority settings, or pricing configurations before relying on the definition for production usage tracking.

Editing, Cloning, and Deleting Model Definitions

Cloning a Definition

Cloning creates an independent copy of an existing definition. This is useful when creating a custom definition from a default configuration or creating a variation of an existing custom definition.

1. Open the definition’s Actions menu.
2. Select Clone.
3. Review and modify the copied settings as required.
4. Save the new definition.

Editing a Definition

Admins and Owners can modify custom definitions, including their Match Patterns, prices, custom pricing tiers, and tokenizer settings.

1. Open the custom definition’s Actions menu.
2. Select Edit.
3. Update the required settings.
4. Save the changes.

Deleting a Definition

Deleting a custom definition permanently removes it.

1. Open the custom definition’s Actions menu.
2. Select Delete.
3. Review the definition and confirm the deletion when prompted.

Before deleting a definition, check whether incoming usage records depend on its Match Pattern, as removing it may affect model matching and the application of pricing or tokenization settings.

Note: Default definitions cannot be edited or deleted.

Best Practices

a. Use specific Match Patterns: Avoid overlapping patterns that could cause unintended model matches.

b. Validate configurations: Test representative model names and usage details using Test Model Match.

c. Verify pricing values: Ensure prices reflect the provider’s applicable rates, currency, and billing units.

d. Configure pricing tiers carefully: Define clear conditions and priorities so the intended pricing rules are applied.

e. Clone default definitions: Use existing definitions as a starting point for custom configurations.

f. Validate tokenizer settings: Select the appropriate tokenizer and provide valid JSON when additional configuration is required.

Review before deleting: Check the potential impact on incoming usage records before removing a custom definition.

Share this Doc

Model Definitions

Or copy link

CONTENTS
Robility Chatbot
Robility Assistant
Online