Dan Levy's Avatar DanLevy.net

It's Time for LLM Connection Strings

Clean your env JUNK_DRAWER and simplify model config

Don’t you miss when every database required a miscellaneous grab-bag of environment variables?

| A tower of delicate config, DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME… Shit, or was it DB_USERNAME or DB_USER? F*ck, is it DB_PASS, not DB_PASSWORD? When do I need those PG_* prefixes! And, how do I set the timeout?! Ah!

Then someone had the brilliant idea to just use a URL¹:

Terminal window
postgres://user:pass@host:5432/dbname

One string. Everything you need. Universally parseable. Portable. Dare I say, beautiful even.

What if we just… stole borrowed the DB URL idea?

Introducing LLM Connection Strings

Terminal window
llm://api.openai.com/gpt-5.2?temp=0.7&max_tokens=1500
llm://api.z.ai/glm-4.7?top_p=0.9&cache=true


The Parts of an LLM Connection String

the parts of a LLM connection string

Need auth? Great, add it!

Terminal window
llm://app-name:password@api.openai.com/gpt-5.2?temp=0.7&max_tokens=1500

Also, be careful. Credentials in URLs can be a security risk if logged or exposed. Though the good news is they are likely to be scrubbed automatically in many hosted logging services. Verify & use with caution, etc.

Resiliency? Sure, why the hell not!

Specify round-robin host CSV for failover! Many DB libraries support this today!

Terminal window
llms://primary.gpt,backup.gpt/gpt-6?temp=0.9

That s in llms:// isn’t a typo, it’s a pluralization joke hint there’s multiple hosts.

One string with everything from your auth to your endpoint.

Alternative Formats

I’m not married to llm://.

I could imagine some use cases better met with a more provider-centric protocol format, for example, a local LLM router could spin up a local ollama:// service:

Terminal window
ollama://localhost:11434/llama3
vercel://anthropic/sonnet-4.5?temp=0.8&web_search={"maxUses":3}
bedrock://us-west-2.aws/anthropic/sonnet-4.5?temp=0.8&cacheControl=ephemeral

Regardless of the exact scheme, the core idea is the same: one string to rule them all.

The database world figured this out in a few decades.
Good thing that’s only half a vibe year.

a messy env var drawer

Edit on GitHubGitHub