-
Notifications
You must be signed in to change notification settings - Fork 415
Expand file tree
/
Copy pathcustom-pricing.yaml
More file actions
42 lines (39 loc) · 1.64 KB
/
Copy pathcustom-pricing.yaml
File metadata and controls
42 lines (39 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Demonstrates the `cost` override that declares a model's token pricing
# explicitly, in USD per one million tokens. It takes precedence over the
# models.dev catalogue and — more importantly — prices models the catalogue
# does not know at all: custom OpenAI-compatible providers, local models, and
# private deployments otherwise bill $0 despite consuming tokens.
#
# A declared cost feeds per-turn cost computation, session cost tracking, the
# /model picker, and the after_llm_call hook's `cost` field. Prices must not
# be negative; an all-zero table means "priced, free" (distinct from unpriced).
providers:
# A self-hosted OpenAI-compatible gateway with negotiated pricing.
# models.dev knows nothing about the models it serves.
internal-llm:
api_type: openai_chatcompletions
base_url: https://llm.internal.example.com/v1
token_key: INTERNAL_LLM_API_KEY
models:
# Custom endpoint: without `cost` every call would be recorded at $0.
internal-gpt:
provider: internal-llm
model: gpt-4o
cost:
input: 1.25 # USD per 1M input tokens
output: 5.00 # USD per 1M output tokens
cache_read: 0.125 # USD per 1M cached input tokens
cache_write: 1.5625 # USD per 1M cache-write tokens
# Catalogued model with a discounted enterprise contract: the override
# replaces the models.dev list price so recorded spend matches the invoice.
discounted-sonnet:
provider: anthropic
model: claude-sonnet-4-5
cost:
input: 2.4
output: 12.0
agents:
root:
model: internal-gpt
description: Assistant on a custom endpoint with accurate cost tracking
instruction: You are a helpful assistant.