OpenapiO11y
Writes the pricing-rule batch — the single write endpoint used by both the user…
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
| Address | https://api.hanzo.ai/v1/o11y/llm_pricing_rules |
| Method | PUT |
| Operation | CreateOrUpdateLLMPricingRules |
| Auth | Authorization: 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).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
rules | body | o11y.O11yLLMUpdatablePricingRule[] | — | Rules are the rules to create or update, matched per rule. |
rules[].enabled | body | boolean | — | Enabled turns the rule on. |
rules[].id | body | string | — | ID matches an existing rule by its id. |
rules[].isOverride | body | boolean | — | IsOverride pins the rule so the sync job skips it. |
rules[].modelName | body | string | — | Model is the model the rule prices. |
rules[].modelPattern | body | string[] | — | ModelPattern are the model-name globs the rule matches. |
rules[].pricing | body | o11y.O11yLLMRulePricing | — | |
rules[].pricing.cache | body | o11y.O11yLLMPricingCacheCosts | — | |
rules[].pricing.cache.mode | body | string | — | Mode is how cached tokens are counted — subtract (inside input_tokens, OpenAI-style), additive (reported separately, Anthropic-style) or unknown. |
rules[].pricing.cache.read | body | number | — | Read is the cost per unit of cache-read tokens. |
rules[].pricing.cache.write | body | number | — | Write is the cost per unit of cache-write tokens. |
rules[].pricing.input | body | number | — | Input is the cost per unit of input tokens. |
rules[].pricing.output | body | number | — | Output is the cost per unit of output tokens. |
rules[].provider | body | string | — | Provider is the model's provider. |
rules[].sourceId | body | string | — | SourceID matches an existing rule by its upstream source id. |
rules[].unit | body | string | — | Unit is the pricing unit, e.g. |
Response
| Status | Body | Meaning |
|---|---|---|
204 | — | no content |
Failure carries the platform error shape — see Errors.
Examples
hanzo o11y llm_pricing_rules replaceimport { 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 := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.O11yAPI.CreateOrUpdateLLMPricingRules(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::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.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + 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>"
}
]
}
}
}
}'How is this guide?