zuplo 7.12.2 → 7.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/ai-gateway/cookbooks/dynamic-model-routing.mdx +3 -2
- package/docs/ai-gateway/custom-pricing.mdx +96 -0
- package/docs/ai-gateway/custom-providers.mdx +3 -1
- package/docs/ai-gateway/managing-providers.mdx +4 -0
- package/docs/ai-gateway/usage-limits.mdx +3 -0
- package/docs/ai-gateway/vertex-ai.mdx +2 -1
- package/package.json +5 -5
|
@@ -17,8 +17,9 @@ Two public primitives from `@zuplo/runtime` do the work:
|
|
|
17
17
|
|
|
18
18
|
- `AIGatewayModels.load(context)` returns the cached provider catalog, including
|
|
19
19
|
each model's capability, status, and token rate card (`tokenRateCard`): the
|
|
20
|
-
prices the gateway charges, which are the list prices with
|
|
21
|
-
prices applied. Credentials are never
|
|
20
|
+
prices the gateway charges, which are the list prices with that provider's
|
|
21
|
+
[custom prices](../custom-pricing.mdx) applied. Credentials are never
|
|
22
|
+
returned.
|
|
22
23
|
- `AIGatewayModelRouting.set(context, routing)` validates the routing, resolves
|
|
23
24
|
provider credentials internally, and stores the selection the AI Gateway
|
|
24
25
|
handler uses. `AIGatewayModelRouting.get(context)` reads the current
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AI Gateway Custom Pricing
|
|
3
|
+
sidebar_label: Custom Pricing
|
|
4
|
+
description:
|
|
5
|
+
Set your own per-token prices on a built-in AI Gateway provider so cost
|
|
6
|
+
budgets, budget alerts, and spend analytics reflect the rates you actually
|
|
7
|
+
pay.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
The AI Gateway prices every request from Zuplo's model catalog, which lists each
|
|
11
|
+
vendor's published per-token prices. If you've negotiated different rates with a
|
|
12
|
+
vendor—a committed-use discount, an enterprise contract, or credits—set those
|
|
13
|
+
prices on the provider so the gateway uses what you actually pay.
|
|
14
|
+
|
|
15
|
+
A price you set applies everywhere the gateway computes cost:
|
|
16
|
+
|
|
17
|
+
- Cost [budgets](./usage-limits.mdx) and [budget alerts](./budget-alerts.mdx)
|
|
18
|
+
- Spend in the gateway, pool, and app analytics
|
|
19
|
+
- The `tokenRateCard` that
|
|
20
|
+
[custom policies](./cookbooks/dynamic-model-routing.mdx) read from
|
|
21
|
+
`AIGatewayModels.load`
|
|
22
|
+
|
|
23
|
+
Prices apply to new requests within about a minute of saving. Setting a price
|
|
24
|
+
doesn't redeploy your gateway.
|
|
25
|
+
|
|
26
|
+
## What you can price
|
|
27
|
+
|
|
28
|
+
You can set a price for any rate the catalog lists for a model on a built-in
|
|
29
|
+
provider:
|
|
30
|
+
|
|
31
|
+
| Rate | What it prices |
|
|
32
|
+
| -------------------------- | ------------------------------------------------------------- |
|
|
33
|
+
| **Input** | Prompt tokens |
|
|
34
|
+
| **Output** | Generated tokens |
|
|
35
|
+
| **Cache read** | Input tokens served from the provider's prompt cache |
|
|
36
|
+
| **Cache write (5 minute)** | Input tokens written to a cache entry that lasts five minutes |
|
|
37
|
+
| **Cache write (1 hour)** | Input tokens written to a cache entry that lasts one hour |
|
|
38
|
+
|
|
39
|
+
Models that charge more above a prompt-size threshold also have long-context
|
|
40
|
+
rates. Those keep Zuplo's list prices.
|
|
41
|
+
|
|
42
|
+
A rate the catalog doesn't list for a model, such as a 1-hour cache write on a
|
|
43
|
+
model without one, can't be priced.
|
|
44
|
+
|
|
45
|
+
## How prices apply
|
|
46
|
+
|
|
47
|
+
Prices belong to a provider, not to your whole project. Two providers for the
|
|
48
|
+
same vendor can carry different prices: for example, `anthropic` and
|
|
49
|
+
`anthropic-2` with API keys under two different contracts. The gateway prices
|
|
50
|
+
each request at the rates of the provider named in its model reference, so
|
|
51
|
+
`anthropic-2/claude-sonnet-5` uses the prices on `anthropic-2`.
|
|
52
|
+
|
|
53
|
+
For each rate, the gateway uses your price when you've set one and Zuplo's list
|
|
54
|
+
price otherwise. A rate you leave unset follows the list price, including future
|
|
55
|
+
changes to it. Set only the rates your contract changes.
|
|
56
|
+
|
|
57
|
+
Deleting a provider deletes its prices. A provider you create later with the
|
|
58
|
+
same name starts at list prices.
|
|
59
|
+
|
|
60
|
+
[Custom providers](./custom-providers.mdx) don't use the catalog. You enter
|
|
61
|
+
their per-token costs on each model when you add it, so there's no list price to
|
|
62
|
+
override.
|
|
63
|
+
|
|
64
|
+
:::note{title="OpenRouter"}
|
|
65
|
+
|
|
66
|
+
[OpenRouter](./openrouter.mdx) reports the cost of each request itself, and the
|
|
67
|
+
gateway records that figure instead of computing one from prices. A price you
|
|
68
|
+
set on an OpenRouter provider applies only to a request whose response carries
|
|
69
|
+
no cost.
|
|
70
|
+
|
|
71
|
+
:::
|
|
72
|
+
|
|
73
|
+
## Set prices in the portal
|
|
74
|
+
|
|
75
|
+
Setting prices requires the same **Edit** permission as
|
|
76
|
+
[managing providers](./managing-providers.mdx).
|
|
77
|
+
|
|
78
|
+
<Stepper>
|
|
79
|
+
|
|
80
|
+
1. Open
|
|
81
|
+
[**Settings → AI Providers**](https://portal.zuplo.com/+/account/project/ai/settings/data-models)
|
|
82
|
+
in your AI Gateway project in the Zuplo Portal.
|
|
83
|
+
|
|
84
|
+
1. Click **Edit** next to a built-in provider.
|
|
85
|
+
|
|
86
|
+
1. In **Available Models**, find the model and enter your price in a price cell.
|
|
87
|
+
Prices are per 1M tokens. An empty cell shows Zuplo's list price as its
|
|
88
|
+
placeholder; leave it empty to use the list price.
|
|
89
|
+
|
|
90
|
+
A model with at least one price of your own shows a **Custom price** badge.
|
|
91
|
+
To return every rate on that model to list prices, click **Reset**. The
|
|
92
|
+
change takes effect when you save.
|
|
93
|
+
|
|
94
|
+
1. Click **Save**.
|
|
95
|
+
|
|
96
|
+
</Stepper>
|
|
@@ -96,7 +96,9 @@ To add a custom AI provider to your Zuplo AI Gateway, follow these steps:
|
|
|
96
96
|
|
|
97
97
|
1. Finally, add the available models that are hosted with your custom provider,
|
|
98
98
|
along with their type. Optionally, you can add a dollar cost for input and
|
|
99
|
-
output tokens if you wish to track this via the AI Gateway.
|
|
99
|
+
output tokens if you wish to track this via the AI Gateway. A custom
|
|
100
|
+
provider's models have no other prices. To change the prices of a built-in
|
|
101
|
+
provider's models, see [Custom Pricing](./custom-pricing.mdx).
|
|
100
102
|
|
|
101
103
|
1. Click **Create**.
|
|
102
104
|
|
|
@@ -98,6 +98,10 @@ every `providerName/model` reference, so renaming it would orphan each stored
|
|
|
98
98
|
reference to this provider. After making your changes, click **Save** to apply
|
|
99
99
|
them.
|
|
100
100
|
|
|
101
|
+
On a built-in provider, you can also set your own per-token prices for its
|
|
102
|
+
models, so cost budgets and analytics use the rates you negotiated with the
|
|
103
|
+
vendor. See [Custom Pricing](./custom-pricing.mdx).
|
|
104
|
+
|
|
101
105
|
:::caution
|
|
102
106
|
|
|
103
107
|
Be careful removing models from a provider that's in use as it may break
|
|
@@ -108,6 +108,9 @@ action:
|
|
|
108
108
|
| **Limit** | An absolute amount in the meter's own unit |
|
|
109
109
|
| **Action** | **Block** rejects the request; **Warn** notifies without blocking |
|
|
110
110
|
|
|
111
|
+
The **Cost** meter prices each request at the provider's rates: Zuplo's list
|
|
112
|
+
prices, or your own where you've set [custom prices](./custom-pricing.mdx).
|
|
113
|
+
|
|
111
114
|
Add as many rows as you need to cap several meters and periods at once. A Warn
|
|
112
115
|
row and a Block row on the same meter and period give you warn-then-block—warn
|
|
113
116
|
at $80, block at $100. The warn amount has to be the lower of the two.
|
|
@@ -299,7 +299,8 @@ change is live once the deployment completes.
|
|
|
299
299
|
The per-token prices shown in the model picker are recorded rates, not a live
|
|
300
300
|
read of Google's price list, and some Gemini models are on promotional rates
|
|
301
301
|
that Google marks as temporary. Treat the gateway's cost figures as an estimate
|
|
302
|
-
and your Google Cloud bill as the record.
|
|
302
|
+
and your Google Cloud bill as the record. If you pay different rates, set them
|
|
303
|
+
as [custom prices](./custom-pricing.mdx).
|
|
303
304
|
|
|
304
305
|
:::
|
|
305
306
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zuplo",
|
|
3
|
-
"version": "7.12.
|
|
3
|
+
"version": "7.12.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The official Zuplo CLI for local development and platform management",
|
|
6
6
|
"homepage": "https://zuplo.com/docs/cli/overview",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"zuplo": "zuplo.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@zuplo/cli": "7.12.
|
|
36
|
-
"@zuplo/core": "7.12.
|
|
37
|
-
"@zuplo/runtime": "7.12.
|
|
38
|
-
"@zuplo/test": "7.12.
|
|
35
|
+
"@zuplo/cli": "7.12.4",
|
|
36
|
+
"@zuplo/core": "7.12.4",
|
|
37
|
+
"@zuplo/runtime": "7.12.4",
|
|
38
|
+
"@zuplo/test": "7.12.4"
|
|
39
39
|
}
|
|
40
40
|
}
|