Back to Eliza

@elizaos/plugin-elizacloud

plugins/plugin-elizacloud/README.md

2.0.19.4 KB
Original Source

@elizaos/plugin-elizacloud

Eliza Cloud plugin for elizaOS agents. The TypeScript package is backed by @elizaos/cloud-sdk, so runtime Cloud API calls, auth helpers, route wrappers, TTS, STT, image generation, containers, and gateway relay code use the same SDK surface as other Eliza Cloud clients.

Installation

bash
npm install @elizaos/plugin-elizacloud
# or
bun add @elizaos/plugin-elizacloud

Register the plugin with your agent runtime:

typescript
import { elizaOSCloudPlugin } from "@elizaos/plugin-elizacloud";

const agent = new Agent({
  plugins: [elizaOSCloudPlugin],
});

SDK Contract

The TypeScript package has a hard dependency on @elizaos/cloud-sdk. Development checkouts resolve it with workspace:*; published packages are expected to consume the npm-published SDK version.

Runtime code must not build direct Eliza Cloud HTTP calls by hand. Use the SDK helpers in typescript/utils/sdk-client.ts:

HelperUse
createCloudApiClient(runtime)API-base requests such as /responses, /embeddings, /models, auth validation, containers, and relay JSON endpoints
createCloudApiClient(runtime, true)Embedding requests that may use ELIZAOS_CLOUD_EMBEDDING_URL / ELIZAOS_CLOUD_EMBEDDING_API_KEY
createElizaCloudClient(runtime)High-level SDK helpers and generated client.routes.* wrappers
typescript/utils/cloud-api.tsBackwards-compatible re-export of SDK classes and types

ELIZAOS_CLOUD_BASE_URL remains the API base URL and defaults to https://www.elizacloud.ai/api/v1. createElizaCloudClient derives the site root from that API URL when generated SDK route wrappers need /api/v1/... paths.

typescript/providers/openai.ts is the one intentional transport adapter that passes the configured base URL to the Vercel AI SDK's OpenAI-compatible client. It is not a hand-rolled Cloud API fetch path.

Runtime Coverage

Plugin capabilitySDK path
Text generation (TEXT_NANO, TEXT_SMALL, TEXT_MEDIUM, TEXT_LARGE, TEXT_MEGA, response handler, planner)CloudApiClient.requestRaw("POST", "/responses", ...)
Structured object generationCloudApiClient.requestRaw("POST", "/responses", ...)
Research generationCloudApiClient.requestRaw("POST", "/responses", ...)
Text embeddingsCloudApiClient.requestRaw("POST", "/embeddings", ...)
Image generationElizaCloudClient.generateImage(...)
Image descriptiongenerated SDK route client.routes.postApiV1ChatCompletionsRaw(...)
Text-to-speechgenerated SDK route client.routes.postApiV1VoiceTts(...)
Audio transcriptiongenerated SDK route client.routes.postApiV1VoiceSttRaw(...)
Model registry and credit statusCloudApiClient
Device auth and API-key validationCloudApiClient
Cloud containersCloudApiClient supplied by CloudAuthService
Managed gateway relayCloudApiClient
Credits, app credits, and hosted checkoutElizaCloudClient.createCreditsCheckout(...), getAppCreditsBalance(...), createAppCreditsCheckout(...)
Agent/app charge requestsElizaCloudClient.createAppCharge(...), createAppChargeCheckout(...)
x402 payment requests and settlementElizaCloudClient.createX402PaymentRequest(...), getX402Supported(...), settleX402PaymentRequest(...)
Affiliate links and creator payoutscreateAffiliateCode(...), linkAffiliateCode(...), getAppEarnings(...), withdrawAppEarnings(...), createRedemption(...)

The only remaining runtime-adjacent fetch() usage is in the plugin test block for downloading a public audio fixture. It is not an Eliza Cloud API call.

Payments And Monetization

The plugin exposes one local route family for Cloud money flows: /api/cloud/billing/*. It forwards to the authenticated Cloud API using the same Cloud key as the rest of the plugin, so app UIs and agents do not need to handle Cloud credentials directly.

Supported local aliases:

Local routeCloud route
/api/cloud/billing/credits/*/api/v1/credits/*
/api/cloud/billing/app-credits/*/api/v1/app-credits/*
/api/cloud/billing/x402/*/api/v1/x402/*
/api/cloud/billing/apps/{appId}/charges/*/api/v1/apps/{appId}/charges/*
/api/cloud/billing/apps/{appId}/earnings/*/api/v1/apps/{appId}/earnings/*
/api/cloud/billing/apps/{appId}/monetization/api/v1/apps/{appId}/monetization
/api/cloud/billing/affiliates/*/api/v1/affiliates/*
/api/cloud/billing/redemptions/*/api/v1/redemptions/*

Agent-initiated charges should use app charge requests for Stripe/OxaPay credit checkout or x402 payment requests for direct crypto settlement. Both request types accept callback channel metadata, so successful or failed payment events can be written back into the room where the charge was initiated.

Configuration

Get an API key from https://www.elizacloud.ai/dashboard/api-keys.

SettingDescriptionDefault
ELIZAOS_CLOUD_API_KEYAPI key used for authenticated Cloud requestsRequired
ELIZAOS_CLOUD_BASE_URLEliza Cloud API base URLhttps://www.elizacloud.ai/api/v1
ELIZAOS_CLOUD_ENABLEDEnables container provisioning, device auth, bridge, and backup servicesfalse
ELIZAOS_CLOUD_NANO_MODELNano/cheapest model overrideNANO_MODEL or openai/gpt-oss-120b:nitro
ELIZAOS_CLOUD_SMALL_MODELSmall/fast model overrideSMALL_MODEL or openai/gpt-oss-120b:nitro
ELIZAOS_CLOUD_MEDIUM_MODELMedium planning model overrideMEDIUM_MODEL or small model
ELIZAOS_CLOUD_LARGE_MODELLarge model overrideLARGE_MODEL or openai/gpt-oss-120b:nitro
ELIZAOS_CLOUD_MEGA_MODELMega model overrideMEGA_MODEL or large model
ELIZAOS_CLOUD_RESPONSE_HANDLER_MODELResponse handler model overridenano model
ELIZAOS_CLOUD_ACTION_PLANNER_MODELAction planner model overridemedium model
ELIZAOS_CLOUD_RESEARCH_MODELResearch model overridelarge model
ELIZAOS_CLOUD_EMBEDDING_MODELEmbedding modeltext-embedding-3-small
ELIZAOS_CLOUD_EMBEDDING_URLOptional custom embedding API base URLunset
ELIZAOS_CLOUD_EMBEDDING_API_KEYOptional custom embedding API keyELIZAOS_CLOUD_API_KEY
ELIZAOS_CLOUD_EMBEDDING_DIMENSIONSEmbedding vector size1536
ELIZAOS_CLOUD_IMAGE_DESCRIPTION_MODELVision model used for image descriptionsgpt-5.4-mini
ELIZAOS_CLOUD_IMAGE_DESCRIPTION_MAX_TOKENSMax image-description response tokens8192
ELIZAOS_CLOUD_IMAGE_GENERATION_MODELImage generation model overrideservice default
ELIZAOS_CLOUD_TTS_MODELText-to-speech modelgpt-5-mini-tts
ELIZAOS_CLOUD_TTS_VOICEText-to-speech voicenova
ELIZAOS_CLOUD_TTS_INSTRUCTIONSOptional TTS style instructionsunset
ELIZAOS_CLOUD_TRANSCRIPTION_MODELAudio transcription modelservice default
ELIZAOS_CLOUD_EXPERIMENTAL_TELEMETRYEnables experimental telemetry metadatafalse

Browser builds must not receive secrets directly. Use ELIZAOS_CLOUD_BROWSER_BASE_URL and ELIZAOS_CLOUD_BROWSER_EMBEDDING_URL for browser-only proxy endpoints.

Usage Examples

typescript
import { ModelType } from "@elizaos/core";

const text = await runtime.useModel(ModelType.TEXT_LARGE, {
  prompt: "Summarize the current agent state.",
});

// Structured output: route through TEXT_* with `responseSchema` (native tool calling).
const structured = await runtime.useModel(ModelType.TEXT_LARGE, {
  prompt: "Return a JSON user profile with name and role.",
  responseSchema: {
    type: "object",
    properties: { name: { type: "string" }, role: { type: "string" } },
    required: ["name", "role"],
  },
});

const embedding = await runtime.useModel(ModelType.TEXT_EMBEDDING, {
  text: "Hello, world!",
});

const speech = await runtime.useModel(ModelType.TEXT_TO_SPEECH, {
  text: "Cloud text to speech is active.",
});

Adding Cloud Calls

  1. Prefer an existing high-level SDK method when one exists.
  2. Otherwise use a generated createElizaCloudClient(runtime).routes.* wrapper.
  3. Use createCloudApiClient(runtime) for raw API-base endpoints that do not yet have a generated wrapper.
  4. Keep all Eliza Cloud API auth/header/base-URL behavior inside the SDK helper layer.
  5. Do not add direct fetch() calls for Eliza Cloud API routes in runtime code.

When the Cloud API adds or changes public routes, update the SDK first:

bash
cd ../../packages/cloud-sdk
bun run generate:routes
bun run check:routes
bun run test:e2e

Then update this plugin to consume the new SDK route or helper.

Development

From the TypeScript package:

bash
cd typescript
bun run typecheck
bun run test
bun run build
npm pack --dry-run

From the SDK package:

bash
cd ../../packages/cloud-sdk
bun run check:routes
bun run test:e2e

bun run test:e2e in the SDK runs public real API checks by default and skips credentialed or destructive cases unless the required credentials and opt-in environment flags are present.

Publishing

The TypeScript package is published to npm as @elizaos/plugin-elizacloud. Publishing must include a compatible @elizaos/cloud-sdk release because the plugin depends on it directly.

The repository also contains legacy Python and Rust package directories. The Eliza runtime integration and npm package are the TypeScript implementation documented above.

License

MIT