Skip to content
47% off: the complete course for $79 (reg. $149)Order now →
AI Builder
Module 6Full course10 min read

Model Portability and Avoiding Lock-In

Keep the freedom to switch models: thin adapters, provider-neutral prompts and schemas, portable evals, and a migration checklist for model upgrades.

Every model you use today will be replaced. Providers retire models on published schedules, better and cheaper ones ship every few months, prices change, and occasionally a customer's procurement team or a regional data rule decides which provider you may use. None of that is a problem if switching a feature to a different model is a config change plus an eval run. It's a serious problem if model-specific calls, prompts, and response parsing are scattered through forty files.

This lesson is about keeping that freedom without giving up the provider features that make your product good. You'll map where lock-in actually hides, build a thin adapter at the feature boundary, write prompts and schemas that travel, make your evals the portable core of your AI stack, and work through a migration checklist you can reuse for every model upgrade.

Where lock-in actually hides

"Lock-in" sounds like one thing, but it's several layers of coupling with very different switching costs:

LayerExample of couplingCost to switch
API shapemessages.create calls and response parsing in every feature fileMechanical, but touches everything if not isolated
PromptsA prompt tuned over months against one model's quirksRe-tuning and re-evaluating each feature
Provider featuresPrompt caching, citations, server-side tools, effort settingsRe-implementing or accepting a different design
SchemasA JSON Schema that uses keywords only one provider's strict mode acceptsRewriting schemas, revalidating outputs
Stored dataEmbeddings, conversation histories with provider-specific blocksRe-embedding a corpus, migrating stored formats
Trained artifactsA fine-tuned model that exists only on one platformRetraining from scratch, if you kept the data
OperationsRate limits, keys, data-processing agreements, invoicesProcurement and paperwork, often the slowest part

The goal isn't zero lock-in. Prompt caching, citations, and structured outputs are worth using even though they're implemented differently by each provider. The goal is to know your switching cost per feature and keep it low where that's cheap. Isolating the API shape costs almost nothing. Avoiding a provider feature that cuts your input costs dramatically, just to stay portable, would be a bad trade.