Replace llm pricing rules

Writes the pricing-rule batch — the single write endpoint used by both the user and the Zeus sync job.

PUT /v1/o11y/llm_pricing_rules

Addresshttps://api.hanzo.ai/v1/o11y/llm_pricing_rules
MethodPUT
OperationCreateOrUpdateLLMPricingRules
AuthAuthorization: Bearer $HANZO_API_KEY

Writes the pricing-rule batch — the single write endpoint used by both the user and the Zeus sync job. Per-rule match is by id, then sourceId, then insert; an override row is fully preserved when the request omits isOverride, only its synced_at stamped.

Callers need the admin role; the runtime's own gate enforces it.

Request

16 fields, body application/json (required).

FieldInTypeRequiredDescription
rulesbodyo11y.O11yLLMUpdatablePricingRule[]—Rules are the rules to create or update, matched per rule.
rules[].enabledbodyboolean—Enabled turns the rule on.
rules[].idbodystring—ID matches an existing rule by its id.
rules[].isOverridebodyboolean—IsOverride pins the rule so the sync job skips it.
rules[].modelNamebodystring—Model is the model the rule prices.
rules[].modelPatternbodystring[]—ModelPattern are the model-name globs the rule matches.
rules[].pricingbodyo11y.O11yLLMRulePricing—
rules[].pricing.cachebodyo11y.O11yLLMPricingCacheCosts—
rules[].pricing.cache.modebodystring—Mode is how cached tokens are counted — subtract (inside input_tokens, OpenAI-style), additive (reported separately, Anthropic-style) or unknown.
rules[].pricing.cache.readbodynumber (double)—Read is the cost per unit of cache-read tokens.
rules[].pricing.cache.writebodynumber (double)—Write is the cost per unit of cache-write tokens.
rules[].pricing.inputbodynumber (double)—Input is the cost per unit of input tokens.
rules[].pricing.outputbodynumber (double)—Output is the cost per unit of output tokens.
rules[].providerbodystring—Provider is the model's provider.
rules[].sourceIdbodystring—SourceID matches an existing rule by its upstream source id.
rules[].unitbodystring—Unit is the pricing unit, e.g. per_million_tokens.

Response

StatusBodyMeaning
202Approvalheld for approval
204—no content
defaultproblem-detailsrefused

202 body — 3 fields.

FieldInTypeAlwaysDescription
clausebodystring—
reasonbodystring—
statusbodystring—

Failure carries the platform error shape — see Errors.

Examples

hanzo o11y llm_pricing_rules replace
import { Configuration, O11yApi } from 'hanzoai';

const api = new O11yApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.createOrUpdateLLMPricingRules({ rules: [{"enabled":false,"id":"<id>","isOverride":false,"modelName":"<modelName>"}] });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import O11yApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = O11yApi(client).create_or_update_llm_pricing_rules(rules=[{"enabled":false,"id":"<id>","isOverride":false,"modelName":"<modelName>"}])
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.O11yAPI.CreateOrUpdateLLMPricingRules(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, o11y_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = o11y_api::create_or_update_llm_pricing_rules(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.O11yApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new O11yApi(client).createOrUpdateLLMPricingRules();
curl -X PUT https://api.hanzo.ai/v1/o11y/llm_pricing_rules \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "rules": [
         {
           "enabled": false,
           "id": "<id>",
           "isOverride": false,
           "modelName": "<modelName>"
         }
       ]
     }'

Tool o11y, op CreateOrUpdateLLMPricingRules — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "o11y",
         "arguments": {
           "op": "CreateOrUpdateLLMPricingRules",
           "input": {
             "rules": [
               {
                 "enabled": false,
                 "id": "<id>",
                 "isOverride": false,
                 "modelName": "<modelName>"
               }
             ]
           }
         }
       }
     }'

O11y API · All Hanzo APIs · Interactive reference

Was this page useful?