CloudLLM
CloudLLM is a batteries-included Rust toolkit for building intelligent agents with LLM integration, multi-protocol tool support, and multi-agent orchestration. It provides:
- Agents with Tools: Create agents that connect to LLMs and execute actions through a flexible, multi-protocol tool system (local, remote MCP, Memory, custom protocols) with runtime hot-swapping,
- Multi-Agent Orchestration: An
orchestrationengine supporting Parallel, RoundRobin, Moderated, Hierarchical, Debate, and Ralph collaboration patterns, - ThoughtChain: Persistent, SHA-256 hash-chained agent memory with back-references for graph-based context resolution and tamper-evident integrity verification,
- Context Strategies: Pluggable strategies for handling context window exhaustion — Trim, SelfCompression (LLM writes its own save file), and NoveltyAware (entropy-based trigger),
- Image Generation: Unified image generation across OpenAI (DALL-E), Grok, and Google Gemini with the
simplified
register_image_generation_tool()helper, - Server Deployment: Easy standalone MCP server creation via
MCPServerBuilderwith HTTP, authentication, and IP filtering, - Flexible Tool Creation: From simple Rust closures to advanced custom protocol implementations,
- Event System: Real-time observability via
EventHandlercallbacks for LLM round-trips, tool calls, task completions, and orchestration lifecycle, - Stateful Sessions: A
LLMSessionfor managing conversation history with context trimming and token accounting, - Provider Flexibility: Unified
ClientWrappertrait for OpenAI, Claude, Gemini, Grok, and custom OpenAI-compatible endpoints.
The entire public API is documented with compilable examples—run cargo doc --open to browse the
crate-level manual.
Table of Contents
- Installation
- Quick Start
- Multi-Agent Orchestration
- Provider Wrappers
- LLMSession: Stateful Conversations
- Agents: Building Intelligent Workers with Tools
- ThoughtChain: Persistent Agent Memory
- Context Strategies: Managing Context Window Exhaustion
- Agent::fork() — Lightweight Copies for Parallel Execution
- Runtime Tool Hot-Swapping
- Event System: Real-Time Agent & Orchestration Observability
- Tool Registry: Multi-Protocol Tool Access
- Deploying Tool Servers with MCPServerBuilder
- Creating Tools: Simple to Advanced
- Image Generation
- Examples
- Support & Contributing
Installation
Add CloudLLM to your project:
[]
= "0.10.2"
The crate targets tokio 1.x and Rust 1.70+.
Quick Start
CloudLLM has two core abstractions for talking to LLMs:
| Abstraction | What it is | When to use it |
|---|---|---|
| LLMSession | Stateful conversation wrapper around any ClientWrapper. Maintains rolling history with automatic context trimming and token accounting. |
Simple chat bots, Q&A, any 1-on-1 conversation with an LLM. |
| Agent | Wraps LLMSession with an identity (name, expertise, personality), optional tools, persistent ThoughtChain memory, and pluggable context strategies. Can execute actions, not just converse. | Tool-using assistants, orchestrated multi-agent teams, autonomous workflows. |
Think of it this way: LLMSession is the foundation; Agent builds on top of it.
1. LLMSession — stateful conversation (OpenAI)
use Arc;
use ;
use ;
async
2. Agent — identity + tools (Claude)
An Agent wraps a client just like LLMSession, but adds a name, expertise, personality, and (optionally) tools. Here the agent uses Anthropic Claude and can answer questions using its personality and expertise context:
use Arc;
use Agent;
use ;
async
3. Streaming tokens in real time (Grok)
Any ClientWrapper supports streaming. Here we use xAI Grok:
use ;
use ;
use StreamExt;
use Arc;
async
Multi-Agent Orchestration
The orchestration module
coordinates conversations between multiple LLM agents. Each agent can have its own provider,
expertise, personality, and tool access. Choose from six collaboration patterns depending on your
use case.
Orchestration Modes
| Mode | Description | Best For |
|---|---|---|
| Parallel | All agents respond simultaneously; results are aggregated | Fast fan-out queries, getting diverse perspectives |
| RoundRobin | Agents take sequential turns, each building on previous responses | Iterative refinement, structured review |
| Moderated | Agents propose ideas, a moderator synthesizes the final answer | Consensus building, curated outputs |
| Hierarchical | Lead agent coordinates; specialists handle specific aspects | Complex tasks with delegation |
| Debate | Agents discuss and challenge until convergence is reached | Critical analysis, stress-testing ideas |
| Ralph | Autonomous iterative loop working through a PRD task list | Multi-step builds, code generation, structured project work |
Basic Example: RoundRobin
use Arc;
use ;
use ;
async
Ralph: Autonomous PRD-Driven Loop
Ralph (named after Ralph Wiggum) is an autonomous iterative orchestration mode where agents
work through a structured PRD (Product Requirements Document) task list. Each iteration presents
agents with the current task checklist. Agents signal completion by including
[TASK_COMPLETE:task_id] markers in their responses. The loop ends when all tasks are done or
max_iterations is reached.
Key features:
- PRD-driven: Structured
RalphTaskitems with id, title, and description - Completion detection: Agents include
[TASK_COMPLETE:task_id]markers - Progress tracking:
convergence_scorereports task completion fraction (0.0 to 1.0) - History trimming: Conversation history is automatically trimmed to fit within
max_tokens, keeping the most recent messages - Live progress: Event handler shows real-time iteration progress, LLM round-trips, tool calls, and task completions (see Event System)
use Arc;
use ;
use ;
use Agent;
async
Starter HTML + Read-Modify-Write Pattern: Both breakout examples seed a working starter
HTML skeleton to disk and Memory (current_game_html key) before orchestration begins. Agents
follow a read-modify-write loop: READ the current HTML from Memory, MODIFY it to implement
their assigned feature, then WRITE the updated HTML back via a custom write_game_file tool
(which persists to both disk and Memory). This ensures every agent builds on the latest
cumulative output and there is always a playable game on disk.
See examples/breakout_game_ralph.rs for a full working example that orchestrates 4 agents
through 18 PRD tasks to produce a complete Atari Breakout game with multi-hit bricks, powerups,
chiptune music, particle effects, and mobile controls. Also see
examples/breakout_game_agent_teams.rs for the same game built with decentralized
AnthropicAgentTeams coordination.
For a deep dive into all collaboration modes, read
ORCHESTRATION_TUTORIAL.md.
Provider wrappers
CloudLLM ships wrappers for popular OpenAI-compatible services:
| Provider | Module | Notable constructors |
|---|---|---|
| OpenAI | cloudllm::clients::openai |
OpenAIClient::new_with_model_enum, OpenAIClient::new_with_base_url |
| Anthropic Claude | cloudllm::clients::claude |
ClaudeClient::new_with_model_enum |
| Google Gemini | cloudllm::clients::gemini |
GeminiClient::new_with_model_enum |
| xAI Grok | cloudllm::clients::grok |
GrokClient::new_with_model_enum |
Providers share the ClientWrapper
contract, so you can swap them without changing downstream code.
use ClientWrapper;
use ;
use ;
async
Every wrapper exposes token accounting via ClientWrapper::get_last_usage.
LLMSession: Stateful Conversations (The Foundation)
LLMSession is the core building block—it maintains conversation history with automatic context trimming and token accounting. Use it for simple stateful conversations with any LLM provider:
use Arc;
use ;
use ;
async
Agents: Building Intelligent Workers with Tools
Agents extend LLMSession by adding identity, expertise, and optional tools. They're the primary way to build sophisticated LLM interactions where you need the agent to take actions beyond conversation.
The example below creates a single agent with four tools attached: the built-in Calculator,
a shared Memory store, image generation via OpenAI, and a custom Fibonacci tool — all on one
CustomToolProtocol:
use Arc;
use Agent;
use ;
use ;
use ;
use ;
use register_image_generation_tool;
use ;
async
Key patterns shown above:
| Pattern | Used For |
|---|---|
register_image_generation_tool() |
One-line built-in tool registration |
protocol.register_tool(metadata, closure) |
Sync custom tool (Fibonacci) |
protocol.register_async_tool(metadata, closure) |
Async tool wrapping a built-in (Calculator) |
MemoryProtocol::new(memory) |
Protocol wrapper for built-in Memory |
ToolRegistry::empty() + add_protocol() |
Multi-protocol registry |
agent.with_tools(registry) |
Attach tools to an agent |
ThoughtChain: Persistent Agent Memory
ThoughtChain is an
append-only, SHA-256 hash-chained, disk-persisted log of agent thoughts. Each thought can carry
back-references to ancestor thoughts, forming a DAG that enables graph-based context resolution.
ThoughtChain (.jsonl on disk)
├─ Thought #0 Finding hash=abc1... refs=[]
├─ Thought #1 Decision hash=def2... refs=[] prev_hash=abc1...
├─ Thought #2 Finding hash=789a... refs=[] prev_hash=def2...
└─ Thought #3 Compression hash=bcd3... refs=[0, 2] prev_hash=789a...
↑
resolve_context(3) walks refs → returns [#0, #2, #3]
use Agent;
use ;
use OpenAIClient;
use Arc;
use PathBuf;
use RwLock;
async
ThoughtChain files are newline-delimited JSON (.jsonl), one thought per line.
Use ThoughtChain::verify_integrity() to detect tampering, and
ThoughtChain::resolve_context(index) to reconstruct the minimal context
graph for any thought.
Resume a previously running agent from its chain:
use Agent;
use ThoughtChain;
use OpenAIClient;
use Arc;
use PathBuf;
use RwLock;
#
Context Strategies: Managing Context Window Exhaustion
The ContextStrategy
trait lets you plug in different policies for what happens when an agent's conversation history
approaches its token budget.
| Strategy | Trigger | Action |
|---|---|---|
| TrimStrategy (default) | Token ratio > 0.85 | No-op — LLMSession's built-in trimming handles it |
| SelfCompressionStrategy | Token ratio > 0.80 | LLM writes a structured save file; persisted to ThoughtChain |
| NoveltyAwareStrategy | High pressure always; moderate pressure + low novelty | Delegates to inner strategy (typically SelfCompression) |
use Agent;
use ;
use OpenAIClient;
use Arc;
let agent = new
.context_collapse_strategy;
The strategy can also be swapped at runtime via agent.set_context_collapse_strategy(...).
Agent::fork() — Lightweight Copies for Parallel Execution
Agent is intentionally not Clone (its LLMSession contains a bumpalo arena). Instead, use
fork() to create a lightweight copy that shares the same tool registry and thought chain (via
Arc) but has a fresh, empty session:
use Agent;
use OpenAIClient;
use Arc;
let agent = new.with_expertise;
// Fork for parallel execution
let forked = agent.fork;
assert_eq!;
assert_eq!;
// forked has an empty session but shares tools and thought chain
Orchestration modes (Parallel, Hierarchical) use fork() internally when they need
temporary per-task agents.
Runtime Tool Hot-Swapping
The tool registry is wrapped in Arc<RwLock<ToolRegistry>>, allowing protocols to be added
or removed while an agent is running:
use Agent;
use CustomToolProtocol;
use OpenAIClient;
use Arc;
# async ;
For sharing a mutable registry across agents, use with_shared_tools():
use Agent;
use ToolRegistry;
use OpenAIClient;
use Arc;
use RwLock;
let shared = new;
let client = new;
let agent_a = new
.with_shared_tools;
let agent_b = new
.with_shared_tools;
// Adding a protocol via agent_a is visible to agent_b
Event System: Real-Time Agent & Orchestration Observability
The event module provides
a callback-based observability layer for agents and orchestrations. Implement the
EventHandler trait
to receive real-time notifications about LLM round-trips, tool calls, task completions, and more.
This replaces guessing what's happening during long-running orchestrations — you'll see exactly when each agent starts thinking, which tools it calls, and when the LLM responds.
EventHandler Trait
use ;
use async_trait;
;
Both methods have default no-op implementations, so you only need to override the events you care about. For example, to only observe orchestration-level progress:
# use ;
# use async_trait;
;
AgentEvent Variants
Events emitted by an Agent
during its lifecycle. Every variant carries agent_id and agent_name for identification.
| Variant | Fields | When Emitted |
|---|---|---|
SendStarted |
message_preview |
At the start of send() or generate_with_tokens() |
SendCompleted |
tokens_used, tool_calls_made, response_length |
When send() or generate_with_tokens() finishes successfully |
LLMCallStarted |
iteration |
Before each LLM round-trip (first call + each tool-loop follow-up) |
LLMCallCompleted |
iteration, tokens_used, response_length |
After each LLM round-trip completes |
ToolCallDetected |
tool_name, parameters, iteration |
When a tool call is parsed from the LLM response |
ToolExecutionCompleted |
tool_name, parameters, success, error, result, iteration |
After a tool finishes executing |
ToolMaxIterationsReached |
(none extra) | When the tool loop hits its iteration cap |
ThoughtCommitted |
thought_type |
After a thought is appended to the ThoughtChain |
ProtocolAdded |
protocol_name |
When a new tool protocol is added to the agent |
ProtocolRemoved |
protocol_name |
When a tool protocol is removed |
SystemPromptSet |
(none extra) | When the agent's system prompt is set or replaced |
MessageReceived |
(none extra) | When a message is injected into the agent's session |
Forked |
(none extra) | When fork() creates a lightweight copy (fresh session) |
ForkedWithContext |
(none extra) | When fork_with_context() copies the agent with history |
The LLMCallStarted/LLMCallCompleted pair is especially useful for understanding latency —
during orchestration you'll see exactly when each agent is waiting on the LLM and when the
response arrives.
OrchestrationEvent Variants
Events emitted by an
Orchestration
during a run(). Each variant carries orchestration_id for identification.
| Variant | Fields | When Emitted |
|---|---|---|
RunStarted |
orchestration_name, mode, agent_count |
At the start of run() |
RunCompleted |
orchestration_name, rounds, total_tokens, is_complete |
When run() finishes |
RoundStarted |
round |
At the start of each round/iteration |
RoundCompleted |
round |
At the end of each round/iteration |
AgentSelected |
agent_id, agent_name, reason |
When an agent is chosen to respond (Moderated, Hierarchical modes) |
AgentResponded |
agent_id, agent_name, tokens_used, response_length |
After an agent responds successfully |
AgentFailed |
agent_id, agent_name, error |
When an agent encounters an error |
ConvergenceChecked |
round, score, threshold, converged |
After similarity check in Debate mode |
RalphIterationStarted |
iteration, max_iterations, tasks_completed, tasks_total |
At the start of each RALPH iteration |
RalphTaskCompleted |
agent_id, agent_name, task_ids, tasks_completed_total, tasks_total |
When a RALPH task is completed by an agent |
Registering an Event Handler
Wrap your handler in Arc and register it via the builder pattern:
On an Agent:
use Arc;
use Agent;
use EventHandler;
use OpenAIClient;
#
You can also set or replace the handler at runtime:
# use Arc;
# use Agent;
# use EventHandler;
# use OpenAIClient;
#
On an Orchestration:
use Arc;
use ;
use EventHandler;
#
When you register an event handler on an Orchestration, it is automatically propagated to
every agent added via add_agent(). This means agents emit their own AgentEvents through the
same handler, giving you a unified stream of both agent-level and orchestration-level events.
Full Example: Real-Time Progress Display
This example (adapted from examples/breakout_game_ralph.rs) shows a handler that tracks
elapsed time and pretty-prints events as they happen:
use async_trait;
use ;
use Instant;
use Arc;
// Register on an orchestration (auto-propagates to all agents):
// let handler = Arc::new(ProgressHandler::new());
// let orchestration = Orchestration::new("id", "Name")
// .with_event_handler(handler);
Sample output during a RALPH run:
======================================================================
Breakout Game RALPH Orchestration — mode=Ralph, agents=4
======================================================================
RALPH Iteration 1/5 — 0/10 tasks complete
[00:00] >> Game Architect thinking... (Build a complete Atari Breakout game...)
[00:00] Game Architect sending to LLM (round 1)...
[00:22] Game Architect LLM round 1 complete (8923 chars, 3241 tokens)
[00:22] Game Architect calling tool 'write_game_file' (iter 1), params={"filename":"breakout_game.html",...}
[00:22] Game Architect tool 'write_game_file' succeeded
[00:22] Game Architect sending to LLM (round 2)...
[00:35] Game Architect LLM round 2 complete (412 chars, 158 tokens)
[00:35] << Game Architect responded (412 chars, 3399 tokens, 1 tool calls)
[00:35] *** Game Architect completed tasks: [html_structure, game_loop] — progress: 2/10
[00:35] >> Game Programmer thinking... (Build a complete Atari Breakout game...)
...
Tool Registry: Multi-Protocol Tool Access
Agents access tools through the ToolRegistry, which supports multiple simultaneous protocols. Use local tools, remote MCP servers, persistent Memory, or custom implementations—all transparently:
Adding Tools to a Registry
use Arc;
use ToolRegistry;
use ;
async
Key Benefits:
- Local + Remote: Mix tools from different sources in a single agent
- Transparent Routing: Registry automatically routes calls to the correct protocol
- Dynamic Management: Add/remove protocols at runtime
- Backward Compatible: Existing single-protocol code still works
Registry Modes
Multi-Protocol (New agents):
let mut registry = empty;
registry.add_protocol.await?;
Single-Protocol (Existing code):
let protocol = new;
let registry = new;
Deploying Tool Servers with MCPServerBuilder
Create standalone MCP servers exposing tools over HTTP. Perfect for microservices, integration testing, or sharing tools across your infrastructure:
use Arc;
use MCPServerBuilder;
use CustomToolProtocol;
use ;
async
Available on the mcp-server feature. Other agents connect via McpClientProtocol::new("http://localhost:8080").
Creating Tools: Simple to Advanced
CloudLLM provides a powerful, protocol-agnostic tool system that works seamlessly with agents and orchestrations. Tools enable agents to take actions beyond conversation—calculate values, query databases, call APIs, or maintain state across sessions.
Simple Tool Creation: Rust Closures
Register Rust functions or closures as tools. Perfect for quick prototyping:
use Arc;
use CustomToolProtocol;
use ;
async
Advanced Tool Creation: Custom Protocol Implementation
For complex tools or external system integration, implement the ToolProtocol trait:
use async_trait;
use ;
use Error;
;
Using Tools with Agents
Agents use tools through a registry. Connect any tool source to an agent:
use Arc;
use Agent;
use ;
use CustomToolProtocol;
use ;
async
Protocol Implementations
1. CustomToolProtocol (Local Rust Functions)
Register local Rust closures or async functions as tools. Covered above under "Simple Tool Creation".
2. McpClientProtocol (Remote MCP Servers)
Connect to remote MCP servers:
use Arc;
use McpClientProtocol;
async
3. MemoryProtocol (Persistent Agent State)
For maintaining state across sessions within a single process:
use Arc;
use Memory;
use MemoryProtocol;
use ToolRegistry;
async
Built-in Tools
CloudLLM includes several production-ready tools that agents can use directly:
Calculator Tool
A fast, reliable scientific calculator for mathematical operations and statistical analysis. Perfect for agents that need to perform computations.
Features:
- Comprehensive arithmetic operations (
+,-,*,/,^,%) - Trigonometric functions (sin, cos, tan, csc, sec, cot, asin, acos, atan)
- Hyperbolic functions (sinh, cosh, tanh, csch, sech, coth)
- Logarithmic and exponential functions (ln, log, log2, exp)
- Statistical operations (mean, median, mode, std, stdpop, var, varpop, sum, count, min, max)
- Mathematical constants (pi, e)
Usage Example:
use Calculator;
async
More Examples:
sqrt(16)-> 4.0log(100)-> 2.0 (base 10)std([1, 2, 3, 4, 5])-> 1.581 (sample standard deviation)floor(3.7)-> 3.0
For comprehensive documentation, see Calculator API docs.
Memory Tool
A persistent, TTL-aware key-value store for maintaining agent state across sessions. Perfect for single agents to track progress or multi-agent orchestrations to coordinate decisions.
Features:
- Key-value storage with optional TTL (time-to-live) expiration
- Automatic background expiration of stale entries (1-second cleanup)
- Metadata tracking (creation timestamp, expiration time)
- Succinct protocol for LLM communication (token-efficient)
- Thread-safe shared access across agents
- Designed specifically for agent communication (not a general database)
Basic Usage Example:
use Memory;
async
Using with Agents via Tool Protocol:
use Arc;
use Memory;
use MemoryProtocol;
use ToolRegistry;
use Agent;
use ;
async
Memory Protocol Commands (for agents):
The Memory tool uses a token-efficient protocol designed for LLM communication:
| Command | Syntax | Example | Use Case |
|---|---|---|---|
| Put | P <key> <value> [ttl_seconds] |
P task_status InProgress 3600 |
Store state with 1-hour expiration |
| Get | G <key> [META] |
G task_status META |
Retrieve value + metadata |
| List | L [META] |
L META |
List all keys with metadata |
| Delete | D <key> |
D task_status |
Remove specific memory |
| Clear | C |
C |
Wipe all memories |
| Spec | SPEC |
SPEC |
Get protocol specification |
Multi-Agent Memory Sharing:
use Arc;
use Memory;
use MemoryProtocol;
use ToolRegistry;
use ;
use RwLock;
async
For comprehensive documentation and patterns, see Memory API docs.
HTTP Client Tool
A secure REST API client for calling external services with domain allowlist/blocklist protection. Perfect for agents that need to make HTTP requests to external APIs.
Features:
- All HTTP methods (GET, POST, PUT, DELETE, PATCH, HEAD)
- Domain security with allowlist/blocklist (blocklist takes precedence)
- Basic authentication and bearer token support
- Custom headers and query parameters with automatic URL encoding
- JSON response parsing
- Configurable request timeout and response size limits
- Thread-safe with connection pooling
- Builder pattern for chainable configuration
Usage Example:
use HttpClient;
use Duration;
async
Security Best Practices:
- Domain Allowlist:
client.allow_domain("api.trusted-service.com") - Deny Malicious Domains:
client.deny_domain("malicious.attacker.com") - Timeout Protection:
client.with_timeout(Duration::from_secs(30)) - Size Limits:
client.with_max_response_size(10 * 1024 * 1024)(10MB) - Authentication:
client.with_basic_auth("user", "pass")orclient.with_header("Authorization", "Bearer token")
For comprehensive documentation, see HttpClient API docs and examples/http_client_example.rs.
Bash Tool
Secure command execution on Linux and macOS with timeout and security controls. See BashTool API docs.
File System Tool
Safe file and directory operations with path traversal protection and optional extension filtering. Perfect for agents that need to read, write, and manage files within designated directories.
Key Features:
- Read, write, append, and delete files
- Directory creation, listing, and recursive deletion
- File metadata retrieval (size, modification time, is_directory)
- File search with pattern matching
- Path traversal prevention (
../../../etc/passwdis blocked) - Optional file extension filtering for security
- Root path restriction for sandboxing
Basic Usage:
use FileSystemTool;
use PathBuf;
// Create tool with root path restriction
let fs = new
.with_root_path
.with_allowed_extensions;
// Write a file
fs.write_file.await?;
// Read a file
let content = fs.read_file.await?;
// List directory contents
let entries = fs.read_directory.await?;
for entry in entries
// Get metadata
let metadata = fs.get_file_metadata.await?;
println!;
For comprehensive documentation, see the FileSystemTool API docs and examples/filesystem_example.rs.
Creating Custom Protocol Adapters
Implement the ToolProtocol trait to support new protocols:
use async_trait;
use ;
use Error;
/// Example: Custom protocol adapter for a hypothetical service
Best Practices for Tools
- Clear Names & Descriptions: Make tool purposes obvious to LLMs
- Comprehensive Parameters: Document all required and optional parameters
- Error Handling: Return meaningful error messages in ToolResult
- Atomicity: Each tool should do one thing well
- Documentation: Include examples in tool descriptions
- Testing: Test tool execution in isolation before integration
For more examples, see the examples/ directory and run cargo doc --open for complete API documentation.
Image Generation
CloudLLM provides unified image generation across OpenAI, Grok, and Google Gemini. The new register_image_generation_tool() helper dramatically simplifies adding image generation capabilities to agents.
Quick Start: Image Generation Tool
Register an image generation tool with a single line:
use Arc;
use Agent;
use ;
use register_image_generation_tool;
use ;
use CustomToolProtocol;
use ToolRegistry;
async
Supported Providers
| Provider | Model | Supported Ratios |
|---|---|---|
| OpenAI (DALL-E 3) | gpt-image-1.5 |
1:1, 16:9, 4:3, 3:2, 9:16, 3:4, 2:3 |
| Grok Imagine | grok-2-image-1212 |
1:1, 16:9, 4:3, 3:2, 9:16, 3:4, 2:3, and more |
| Google Gemini | gemini-2.5-flash-image |
1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 |
Using Different Providers
use ;
// OpenAI (realistic, high-quality)
let client = new_image_generation_client?;
// Grok (fast, creative)
let client = new_image_generation_client?;
// Gemini (flexible aspect ratios)
let client = new_image_generation_client?;
Parsing from Strings with FromStr
For dynamic provider selection from strings, use the FromStr trait:
use ;
use FromStr;
async
Supported provider strings (case-insensitive):
"openai"-> OpenAI (DALL-E 3)"grok"-> Grok Imagine"gemini"-> Google Gemini
For comprehensive documentation, see the image_generation module docs.
Examples
Clone the repository and run the provided examples:
Each example corresponds to a module in the documentation so you can cross-reference the code with explanations.
Support & contributing
Issues and pull requests are welcome via GitHub.
Please open focused pull requests against main and include tests or doc updates where relevant.
CloudLLM is released under the MIT License.
Happy orchestration!