A proposal for using DNS SRV records to enable automatic discovery, failover, and policy-based routing of Large Language Model (LLM) API endpoints in enterprise environments.
This specification defines a standard approach for advertising LLM service endpoints via DNS SRV records, enabling:
- Automatic discovery of available LLM providers
- Capability-based routing to appropriate models
- Load balancing and failover across multiple providers
- Policy enforcement through DNS-based service advertisement
- Zero-configuration clients that discover endpoints automatically
Current LLM integrations require hardcoded endpoints, API keys in environment variables, and manual failover logic. As organizations adopt multiple LLM providers (OpenAI, provider1, self-hosted models), managing endpoint configuration becomes complex.
DNS SRV records provide a standard, hierarchical, cacheable mechanism for service discovery that has proven effective for protocols like SIP, XMPP, and LDAP.
Draft proposal with working reference implementations — seeking feedback and implementation experience.
See SPECIFICATION.md for the complete technical specification.
# Find chat completion endpoints
dig SRV _llm-chat._tcp.example.com
# Find embedding endpoints
dig SRV _llm-embedding._tcp.example.com
# Find vision-capable endpoints
dig SRV _llm-vision._tcp.example.com_llm-chat._tcp.example.com. 300 IN SRV 10 60 443 provider1-proxy.example.com.
_llm-chat._tcp.example.com. 300 IN SRV 10 40 443 openai-proxy.example.com.
_llm-chat._tcp.example.com. 300 IN SRV 20 100 443 local-llama.example.com.
Interpretation:
- Priority 10: Try provider1 (60% weight) or OpenAI (40% weight) first
- Priority 20: Fall back to local Llama instance if cloud providers unavail
Organizations can configure primary and backup LLM providers:
_llm-chat._tcp.corp.example.com. IN SRV 10 100 443 primary-llm.corp.example.com.
_llm-chat._tcp.corp.example.com. IN SRV 20 100 443 backup-llm.corp.example.com.
Applications automatically fail over if the primary service is down.
Route requests to models optimized for specific tasks:
; Fast, cheap models for simple tasks
_llm-chat._tcp.quick.corp.com. IN SRV 10 100 443 haiku-endpoint.corp.com.
; High-capability models for complex reasoning
_llm-chat._tcp.smart.corp.com. IN SRV 10 100 443 opus-endpoint.corp.com.
; Vision models
_llm-vision._tcp.corp.com. IN SRV 10 100 443 gpt4-vision.corp.com.
; Sensitive data - on-premises only
_llm-chat._tcp.pii.corp.com. IN SRV 10 100 8443 local-llm.internal.corp.com.
; General use - cloud providers allowed
_llm-chat._tcp.general.corp.com. IN SRV 10 50 443 provider1.external.corp.com.
_llm-chat._tcp.general.corp.com. IN SRV 10 50 443 openai.external.corp.com.
; Try cheaper provider first, expensive as backup
_llm-chat._tcp.cost-optimized.corp.com. IN SRV 10 100 443 cheap-provider.corp.com.
_llm-chat._tcp.cost-optimized.corp.com. IN SRV 20 100 443 premium-provider.corp.com.
; Development - local/mock endpoints
_llm-chat._tcp.dev.corp.com. IN SRV 10 100 8080 localhost.
; Production - real providers
_llm-chat._tcp.prod.corp.com. IN SRV 10 100 443 production-llm.corp.com.
- DNS as policy enforcement - Network admins control which LLM services are available
- No application changes needed - Policy updates via DNS without code deployment
- Audit trail - DNS query logs show which services are being discovered
- Single configuration point - DNS zone file instead of scattered config files
- Dynamic updates - Add/remove providers without touching application configs
- Standard tooling - Use existing DNS infrastructure and monitoring
- Internal DNS - Advertise internal-only endpoints not exposed publicly
- Split-horizon DNS - Different endpoints for internal vs external networks
- TTL-based caching - Control how quickly clients pick up endpoint changes
A simple bash based cli client is provided in the llm-discovery file, with details in CLI Tool Doc
The examples/ directory contains configuration examples for:
- BIND - Traditional DNS server
- PowerDNS - Modern authoritative DNS server
- dnsmasq - Lightweight DNS forwarder for development
- Client implementations - Python, Go, and Rust examples
See examples/README.md for details. Automation and health check based observability can be included in the config generation as well.
Clients need to:
- Query SRV records for desired capability
- Sort by priority (ascending) then randomly select by weight
- Attempt connection to selected endpoint
- Retry with next priority level on failure
- Cache results per DNS TTL
Additional service metadata can be advertised via TXT records, including pricing information, rate limits, service capacity etc:
_llm-chat._tcp.corp.com. IN TXT "provider=provider1" "model=claude-opus-5" "max_tokens=200000"
- DNSSEC recommended for production environments
- Private DNS zones for internal-only services
- Authentication still required - DNS discovery doesn't replace API key management
- Model version discovery - Sub-services for specific model versions
- Regional routing - Geographic-based endpoint selection
- Rate limit advertisement - TXT records indicating capacity
This is an open proposal. Feedback, implementations, and improvements welcome!
This project is dual-licensed under MIT OR Apache-2.0, at your option: see LICENSE-MIT and LICENSE-APACHE.
- RFC 2782 - DNS SRV Record specification
- SPECIFICATION.md - Detailed technical specification
- examples/ - Working configuration examples