Model API
Model API
Section titled “Model API”Public exports
Section titled “Public exports”agiwo.llm exports:
LLMConfigModelStreamChunkModelSpecModelProvidercreate_model(...)create_model_from_dict(...)OpenAIModelOpenAIResponsesModelAnthropicModelBedrockAnthropicModelDeepseekModelNvidiaModel
The shared base class for all providers.
class Model(ABC): config: LLMConfig
async def arun_stream( self, messages: list[dict], tools: list[dict] | None = None, ) -> AsyncIterator[StreamChunk]: ...
async def close(self) -> None: ...StreamChunk
Section titled “StreamChunk”Each provider yields normalized streaming deltas:
| Field | Purpose |
|---|---|
content | Text delta |
reasoning_content | Reasoning delta when supported |
tool_calls | Tool call delta |
usage | Token usage |
finish_reason | Provider finish reason |
Typical construction
Section titled “Typical construction”from agiwo.llm import OpenAIModel
model = OpenAIModel(name="gpt-5.4")from agiwo.llm import create_model_from_dict
model = create_model_from_dict( provider="openai-compatible", model_name="custom-model", params={ "base_url": "https://api.example.com/v1", "api_key_env_name": "MY_API_KEY", },)Supported provider strings
Section titled “Supported provider strings”openaiopenai-responseopenai-compatibledeepseekanthropicanthropic-compatiblenvidiabedrock-anthropic