CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.
Python agent-frameworkagent-harnessagent-runtimeagentic-aiai-agentsai-frameworkanthropicharnessharness-engineeringharness-frameworklanggraphlanggraph-alternativellmmcpopenaipi-agentpi-agent-corepythonpython-agent
---
id: cubepi-providers
title: cubepi.providers
sidebar_position: 2
hide_table_of_contents: false
---
# `cubepi.providers`
### AssistantMessage
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L123)
### Content
_attribute_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L106)
### ImageContent
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L95)
### Message
_attribute_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L147)
### MessageStream
_class_
```python
MessageStream(self)
```
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L177)
### Model
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L78)
### ModelCost
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L64)
### OnPayloadCallback
_attribute_
Optional callback for inspecting/replacing provider payloads before sending.
Return a dict to replace the payload, or None to keep unchanged.
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L227)
### OnResponseCallback
_attribute_
Optional callback invoked after an HTTP response is received.
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L231)
### Provider
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L274)
### ProviderResponse
_class_
```python
ProviderResponse(self, status: int, headers: dict[str, str] = dict())
```
HTTP response metadata exposed to on_response callbacks.
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L219)
### StreamEvent
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L156)
### StreamOptions
_class_
Options bag for Provider.stream(), transparent to the agent loop.
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L235)
### TextContent
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L90)
### ThinkingBudgets
_class_
Token budgets for each thinking level.
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L21)
### ThinkingContent
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L101)
### ThinkingLevel
_attribute_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L18)
### ToolCall
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L109)
### ToolDefinition
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L150)
### ToolResultMessage
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L136)
### Usage
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L71)
### UserMessage
_class_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L116)
### adjust_max_tokens_for_thinking
_function_
```python
adjust_max_tokens_for_thinking(base_max_tokens: int, model_max_tokens: int, reasoning_level: ThinkingLevel, custom_budgets: ThinkingBudgets | None = None) -> tuple[int, int]
```
Adjust max_tokens to reserve space for a thinking budget.
Given a base max_tokens (the desired output capacity), increases it to
accommodate the thinking budget while respecting the model's hard cap.
If the model cap is too small to fit both, the thinking budget is reduced
to leave at least ``min_output_tokens`` (1024) for output.
**Returns**
- A ``(max_tokens, thinking_budget)`` tuple.
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L30)
### FauxProvider
_class_
```python
FauxProvider(self, *, tokens_per_second: float | None = None, token_size_min: int = 3, token_size_max: int = 5)
```
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/faux.py#L151)
### faux_assistant_message
_function_
```python
faux_assistant_message(content: str | FauxContentBlock | list[FauxContentBlock], *, stop_reason: str = 'stop', error_message: str | None = None) -> AssistantMessage
```
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/faux.py#L59)
### faux_text
_function_
```python
faux_text(text: str) -> TextContent
```
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/faux.py#L42)
### faux_thinking
_function_
```python
faux_thinking(thinking: str) -> ThinkingContent
```
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/faux.py#L46)
### faux_tool_call
_function_
```python
faux_tool_call(name: str, arguments: dict[str, Any], *, id: str | None = None) -> ToolCall
```
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/faux.py#L50)
### THINKING_LEVELS
_attribute_
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/models.py#L12)
### clamp_thinking_level
_function_
```python
clamp_thinking_level(model: Model, level: ThinkingLevel) -> ThinkingLevel
```
Clamp *level* to the nearest supported level for *model*.
If *level* is already supported, return it unchanged. Otherwise search
upward first (higher intensity), then downward, through the ordered level
list to find the closest available level.
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/models.py#L54)
### get_supported_thinking_levels
_function_
```python
get_supported_thinking_levels(model: Model) -> list[ThinkingLevel]
```
Return the thinking levels supported by *model*.
* Non-reasoning models only support ``["off"]``.
* For reasoning models, levels are filtered through the model's
``thinking_level_map``. A level mapped to ``None`` is unsupported.
``"xhigh"`` is only included when it has an explicit (non-None) mapping.
All other levels are included by default when the map omits them.
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/models.py#L22)
### models_are_equal
_function_
```python
models_are_equal(a: Model | None, b: Model | None) -> bool
```
Return ``True`` if *a* and *b* refer to the same model.
Comparison is by ``id`` and ``provider``. Returns ``False`` when either
argument is ``None``.
[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/models.py#L87)
<!-- GENERATED by build-api-reference.py — DO NOT EDIT -->