create_function
Register a pricing function in your workspace. execution_type is how it prices: rule based, ML model, LLM prompt, external API (your own endpoint) or composite. name is its unique lowercase id, such as acme/surge. Set is_public to list it for other workspaces. A new function starts as a draft unless status is active: make it active with update_function to have it routed to. A rule_based function prices by the rule you send (base, then steps such as margin, tiers, floor and price ending). Needs a Last Price credential with function publish scope. Needs a claimed workspace: a sandbox key from self-registration is refused (403) until a person claims the workspace.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Unique lowercase id: letters, digits, hyphens, underscores and slashes. | |
| rule | No | For a rule based function: the rule it prices by. Its input schema is made from the rule, and a rule based function needs one before it can be active. On update null removes it. | |
| tags | No | The tag list. On update it replaces the whole list. | |
| status | No | draft (the default) or active, to have it routed to at once. A self-registered sandbox saves drafts only. | |
| is_public | No | List it for other workspaces to use. Defaults to false. | |
| auth_config | No | How to authenticate to the endpoint, such as { type: "bearer", token: "..." }. Stored encrypted and never returned: a read says only whether one is saved. On update an object replaces it and null removes it. Treat the secret as sensitive: it passes through this conversation. | |
| description | No | What the function does. | |
| display_name | Yes | The name people and agents see. | |
| endpoint_url | No | For a function that calls your own service: the https endpoint that returns the price. | |
| input_schema | No | JSON Schema of what a price request supplies to the function. | |
| cost_per_unit | No | What one call to the function costs, in USD. | |
| output_schema | No | JSON Schema of what the function returns. | |
| execution_type | Yes | How the function computes a price. | |
| cost_multiplier | No | Multiplies the cost of each call, for a more expensive model tier. 1 is the default; stored to 4 decimal places. | |
| inference_config | No | For a function that runs on a model. On update an object replaces it and null removes it, so the function uses the rule-based formula. | |
| quote_valid_seconds | No | How long a price this function computes stays valid, in seconds (30 to 86400). Prices carry it as valid_until where quote expiry is switched on for the workspace. Omit for the default of 15 minutes; on update null returns to the default. |