Interfaces API Reference
LLM_Interface (ABC)
Constructor
Abstract Methods
| Method | Signature | Description |
|---|---|---|
chat | async def chat(*, trace_id, stream=False, messages, timeout=None, **kwargs) | Non-streaming call |
chat_stream | async def chat_stream(*, trace_id, stream=True, messages, timeout=None, **kwargs) -> AsyncGenerator | Streaming call |
Properties
| Property | Type | Description |
|---|---|---|
model_name | str | Model identifier |
base_url | str | None | API endpoint |
context_window | int | Context window size in tokens |
api_key_pool | APIKeyPool | Key rotation pool |
OpenAICompatible
Constructor
Class Methods
| Method | Returns | Description |
|---|---|---|
load_from_json_file(path) | Dict[str, Dict[str, OpenAICompatible]] | Load all models from provider.json |
Instance Methods
| Method | Returns | Description |
|---|---|---|
get_rate_limit_status() | Dict[str, Any] | Current rate limiter state |
reset_rate_limit() | None | Reset the token bucket |
Example
OpenAIResponsesCompatible
OpenAICompatible.
Differences from OpenAICompatible
| Aspect | OpenAICompatible | OpenAIResponsesCompatible |
|---|---|---|
| System prompt | messages[0].role="system" | instructions field |
| Streaming format | Chat Completion chunks | Responses stream events |
| Reasoning support | N/A | reasoning={...} kwargs |
| Wire protocol | Chat Completions API | Responses API |
Example
APIKeyPool
Constructor
Example
TokenBucket
Constructor
| Parameter | Description |
|---|---|
capacity | Maximum tokens in the bucket |
refill_rate | Tokens added per second |
OpenAICompatible. Exposed for custom implementations.