HttpLLMProvider class
OpenAI-compatible HTTP provider.
Works with any API that follows the /v1/chat/completions spec:
OpenAI, Azure OpenAI, Ollama (with --api openai), LM Studio,
Together AI, Groq, etc.
Example
final provider = HttpLLMProvider(
apiKey: Platform.environment['OPENAI_API_KEY']!,
model: 'gpt-4o',
);
- Inheritance
-
- Object
- LLMProvider
- HttpLLMProvider
Constructors
- HttpLLMProvider({required String apiKey, String model = 'gpt-4o-mini', String baseUrl = 'https://api.openai.com/v1', String? organizationId, Client? client, ConsciousnessLogger? logger})
Properties
- apiKey → String
-
API authentication key.
final
- baseUrl → String
-
Base URL of the OpenAI-compatible endpoint.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- model → String
-
Model identifier passed in the request body.
final
- name → String
-
Human-readable name of this provider/model.
no setteroverride
- organizationId → String?
-
Optional organization header (OpenAI only).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supportsStreaming → bool
-
Whether this provider supports streaming.
no setterinherited
Methods
-
complete(
LLMRequest request) → Future< LLMResponse> -
Sends
requestto the LLM and returns its response.override -
dispose(
) → void - Disposes the underlying HTTP client.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
stream(
LLMRequest request) → Stream< String> -
Stream of tokens (only valid when supportsStreaming is true).
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited