LlmDrafter class

LLM-backed drafter for any OpenAI-compatible /chat/completions API (OpenRouter, OpenAI, Groq, Together, a local Ollama/LM Studio server, etc.).

Configure the endpoint and credentials via constructor arguments or environment variables:

  • baseUrlSTRINGLOCALE_BASE_URL (falls back to OpenRouter)
  • apiKeySTRINGLOCALE_API_KEY then OPENROUTER_API_KEY

Note: Dart HTTP is async; the compiler awaits these, so this exposes async variants. The Drafter interface stays sync for the offline path; the async LLM calls are used by the async compiler entry points.

Implementers

Constructors

LlmDrafter({String model = defaultModel, String? apiKey, String? baseUrl, Map<String, String>? headers, Client? client})

Properties

apiKey String?
final
baseUrl String?
Endpoint URL. When null, resolved from STRINGLOCALE_BASE_URL / OPENROUTER_BASE_URL, defaulting to defaultBaseUrl.
final
hashCode int
The hash code for this object.
no setterinherited
model String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → void
draftEnum(String value, String locale, String language, String? context) Future<String>
draftTemplate(String baseText, String locale, String language, String axisDesc, Set<String> placeholders) Future<String>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited