Part two of three. Part one covered Genie Code and Genie Agents — the two places you don't pick a model at all. This one is about what happens when you have to.
Three ways to host a model on Databricks
Genie Code and Genie Agents both sit on top of a model you don't choose. This post is about the layer underneath — where you pick the model yourself and own everything attached to it: the endpoint, the scaling, the permissions, and the bill.
That distinction trips people up, because "agent" gets used two ways. A Genie Agent is the no-code, curated question-and-answer surface from part one — you don't pick its model. A custom agent is one you build yourself, log to Unity Catalog, and serve on your own endpoint — and there you absolutely do pick the model. Option 3 below is exactly that: a real agent I built for my golf league. So this isn't leaving agents behind. It's opening the hood on the ones you build.
Three options in this post, plus a fourth in part three:
| Where the model lives | Bills as | |
|---|---|---|
| 1. Pay-per-token | Databricks | DBUs per million tokens |
| 2. Provisioned throughput | Databricks | DBUs per hour |
| 3. Your own model in Unity Catalog | Your catalog | DBUs per hour |
| 4. Your own provider key (part three) | Your provider | Your provider invoices you |
One thing to get straight before we start: Foundation Model APIs is one product with two ways to pay. Pay-per-token and provisioned throughput are the same API and the same models. You're choosing how you pay for capacity, not a different service.
Example 1 — Foundation Model APIs, pay-per-token
Scenario: score every round in the golf lakehouse for "was this a notably good round for this player," in one SQL statement.
SELECT
full_name, match_date, gross_score, player_handicap,
conditions_play, wind_play_max_mph,
ai_query(
'databricks-claude-opus-4-8',
'Golf round. Player handicap ' || CAST(player_handicap AS STRING) ||
', gross score ' || CAST(gross_score AS STRING) ||
' on a nine, conditions: ' || COALESCE(conditions_play,'unknown') ||
', max wind ' || CAST(ROUND(COALESCE(wind_play_max_mph,0)) AS STRING) || ' mph. ' ||
'Reply with exactly one word: EXCELLENT, GOOD, AVERAGE, or POOR.',
failOnError => false
) AS round_grade
FROM golf_league.gold.round_with_weather
WHERE season_year = 2025 AND gross_score IS NOT NULL
LIMIT 5
Real output:
| full_name | gross_score | handicap | conditions | wind mph | round_grade |
|---|---|---|---|---|---|
| Sam Fairway | 48 | 12 | partly cloudy | 8.9 | AVERAGE |
| Robin Bogey | 52 | 9 | light drizzle | 5.3 | POOR |
| Casey Mulligan | 48 | 7 | light rain | 13.9 | AVERAGE |
Note the model is weighing handicap against score — 48 off a 12 is average, 52 off a 9 is poor. That's the whole pitch for this option in one query: no endpoint, no batching code, no key, and the data never left the lakehouse.
One catch: failOnError => false changes what comes back. Results arrive as {"result":"AVERAGE","errorMessage":null}, so you unpack .result. It's the flag you want in production, and it quietly changes your output shape.
Why this option earns its place: you point a top-tier model at a Unity Catalog table from SQL, and Databricks handles the parallel work for you:
"Submit your full dataset in a single query. AI Functions automatically handle parallelization, retries, and scaling. Manually splitting data into small batches can reduce throughput."
Do this against a provider directly and you're writing the batching, the retries, the checkpointing, and the backoff yourself.
Set failOnError => false in any real job so one bad row doesn't cost you the whole run, and responseFormat if you want structured output back.
One thing to check first: not every model does batch. Databricks hosts foundation models three ways, and they're not the same list. The foundation model overview lays it out as three columns per region:
- Pay-per-token — "ideal for experimentation and quick exploration." Every hosted model shows up here.
- AI Functions (batch inference) — the
ai_querypath in this example. Per the docs, "a subset of Databricks-hosted models are optimized for AI Functions." A subset, by design — not the whole list. - Provisioned throughput — "recommended for production use cases requiring performance guarantees." Its own list again.
So "the model is available" and "I can run it over a table with ai_query" are different questions. On my workspace today, Opus 4.8, Sonnet 4.6, Haiku, Llama, and Gemma all do batch — while the two newest Claudes, Opus 5 and Sonnet 5, serve interactively but return PERMISSION_DENIED for batch:
databricks-claude-opus-4-8 → returns a grade
databricks-claude-sonnet-5 → PERMISSION_DENIED (not in the batch column yet)
The batch column is region-specific and it moves, so check your own region against that table before you design a batch job around a brand-new model. A one-row ai_query answers it in seconds, and swapping to a batch-eligible model is a one-word change.
One requirement: this needs serverless. It's "not available on Pro or Classic SQL warehouses."
When to reach for it: exploration, spiky traffic, batch enrichment over UC tables, no pre-existing provider contract. It covers HIPAA; for broader compliance standards, see option 2.
Example 2 — Foundation Model APIs, provisioned throughput
Scenario: the same scoring job, but it now runs nightly against every historical round and can't compete for shared capacity.
databricks api get \
/api/2.0/serving-endpoints/get-model-optimization-info/<model>/<version> \
--profile <your-profile>
Two sizing regimes exist, and the same model can expose either one depending on the version. Here are both, from two versions of one embedding model on my workspace:
// system.ai.bge_large_en_v1_5, version 1 — model-units regime
{ "optimizable": true, "model_unit_chunk_size": 50,
"task": "llm/v1/embeddings", "reserved_pt_eligible": false, "is_cross_geo": false }
// system.ai.bge_large_en_v1_5, version 2 — throughput-band regime
{ "optimizable": true, "throughput_chunk_size": 25000, "dbus": 10,
"model_type": "bert", "task": "llm/v1/embeddings", "throughput_band_info": {} }
Read the response, then size in multiples of the chunk it hands you:
| Field returned | Regime | What you set |
|---|---|---|
model_unit_chunk_size | Model units | provisioned_model_units in multiples of that value (50 here) |
throughput_chunk_size | Tokens/second bands | min_provisioned_throughput / max_provisioned_throughput in multiples (25,000 here) |
Check optimizable before you plan, too — not everything qualifies. A deployed agent returns "optimizable": false, because provisioned throughput is for base models, not agent endpoints. One call beats finding out during a deployment window.
And model units aren't linear. The docs' example puts Llama 4 Maverick at 50 units for roughly 3250 tokens/sec on a medium workload, because generating output costs more than reading input. Size against your real input/output ratio, not a unit count.
Be careful how you describe what you're buying. This is reserved capacity, not guaranteed latency. The docs put it plainly — "there is a trade-off between latency and throughput" — you pick a latency budget and get as much throughput as fits inside it.
A note on compliance. Pay-per-token covers HIPAA. If you need any of the broader standards — PCI-DSS, FedRAMP, IRAP, CCCS, or UK Cyber Essentials Plus — provisioned throughput is the recommended option, since it supports the full range Model Serving offers.
When to reach for it: production, predictable load, dedicated capacity, fine-tuned models, or compliance requirements beyond HIPAA.
Example 3 — Your own model, registered in Unity Catalog
Scenario: the golf caddie agent — already built, already registered.
One sentence in the docs explains all the permissions: "registered models are a type of function." That's why the grants look the way they do — CREATE MODEL, CREATE MODEL VERSION, EXECUTE, APPLY TAG, MANAGE.
Deploy-time check: the endpoint creator needs USE CATALOG + USE SCHEMA + EXECUTE on the model, validated at create/update.
Two things that surprise people:
- Lineage doesn't happen by itself. You get it by calling
mlflow.log_input()against your Unity Catalog tables during training. Skip that and the Lineage tab has nothing to show you. Most people assume it comes free. - Scale-to-zero isn't for production. The docs say so directly: "scale to zero is not recommended for production endpoints, as capacity is not guaranteed when scaled to zero." Great for dev. Plan differently for prod.
The one thing only this option gives you: route optimization, which drops overhead latency under 20 milliseconds. It works for custom models and feature serving only — not Foundation Model APIs, not outside providers. If slow tail latency is your problem, this is the fix. The catch is OAuth only, no personal access tokens.
The model is a dial you can turn
Because a custom agent is a registered model in Unity Catalog, the model behind it is a versioned edit, not a rebuild. You can swap the underlying LLM, deploy a new version, and compare — the endpoint name and every client stay the same. That makes model choice something you iterate on rather than commit to up front.
It's worth iterating, too, because the differences are larger than you'd guess. Tuning the golf caddie agent, a smaller model under-reasoned and made fewer follow-up queries so answers came back thin; a top-tier model was thorough but slow and wordy for the format; a mid-tier model landed the balance of cost, speed, and depth. Your workload will rank them differently — the point is that on this option, ranking them is a knob you own.
When to reach for it: the model is your IP, you need versions/aliases/lineage as a compliance artifact, or you need sub-20ms overhead.
Where we land — the whole ladder
Read this as a decision tree, not a staircase. You don't build at rung 0 and then rebuild your way up — you start your thinking at the bottom, weigh the requirement against each rung, and build once at the right one. Most of the time that's lower than instinct says; sometimes the requirement lands you at rung 3 or 4 on day one, and that's correct.
The move is to evaluate before you build: who consumes this, does it need an API, does it need per-person data controls, do you have to name the model, are there compliance rules in play? Answer those and the rung picks itself. And if you're not sure how to answer them, that's a fair thing to hand to Genie Code — ask it to walk the requirements with you and sketch the options before you commit to one.
| Rung | Reach for it when |
|---|---|
| 0. Genie Code | You're the one using it. You want a personal coding and data assistant you can teach with skills and instructions, and you don't care which model is behind it. |
| ↑ move up when | Someone else needs to use it, you need an API, or you need per-person row filters |
| 0.5 Genie Agents | A curated, governed question-and-answer surface over up to 30 tables, for a business audience. Still not picking a model. |
| ↑ move up when | You have to name the model, bring your own, or write real logic around it |
| 1. Pay-per-token | Trying things out, bursty traffic, batch work over your tables. HIPAA available. |
| 2. Provisioned throughput | Production, steady load, reserved capacity. Recommended when you need compliance beyond HIPAA. |
| 3. Your own model in Unity Catalog | The model is yours; you need versions and lineage for an auditor; you need sub-20ms overhead. |
| 4. Bring your own key (part three) | You already bought tokens from a provider, or you run several providers and want one place to govern them. |
The two sentences to leave with:
Every rung up trades convenience for control, and the model is what changes hands. Step 0 and Genie Agents let Databricks pick it so you can move. Options 1 through 4 hand it to you, along with the endpoint, the scaling, the permissions, and the bill.
Once you're at the top, three separate questions decide your design: where the model lives decides who invoices you, the catalog object decides who governs it, and the endpoint permissions decide who can call it. Most of the confusion here comes from assuming one answer covers all three.
And the mistake I'd steer you away from: jumping to option 3 or 4 because it feels more serious. Most work inside a workspace is a step-0 job, and most business questions are a Genie Agents job. You should be able to name the requirement that put you on a given rung. If you can't, you probably picked a higher one than you needed.
A naming precision worth getting right
People say "Unity Catalog routes my models." I said it myself when I started this. The accurate version:
- Unity Catalog governs the model as a catalog object — and on the new path, the model-service object genuinely carries routing config (destinations, splitting, fallbacks). So "UC routes models" is closer to true than it used to be.
- The request path is enforced by endpoint ACLs + AI Gateway rate limits, not UC grants.
Say: the model-service objects live in UC and describe routing; the request path is enforced by Gateway and endpoint ACLs.
Part three takes the fourth option on its own: registering your own provider key as a governed object in Unity Catalog, so your analysts can query Claude or GPT without ever seeing the key — and so your spend across every provider lands in one place.


