Back to Eliza

Eliza Chat Example

packages/examples/chat/README.md

2.0.11.8 KB
Original Source

Eliza Chat Example

Interactive CLI chat with an AI agent using ElizaOS. Supports multiple LLM providers.

Supported Providers

The chat will automatically use the first provider with a valid API key:

ProviderAPI Key VariableGet Your Key
OpenAIOPENAI_API_KEYplatform.openai.com
Anthropic (Claude)ANTHROPIC_API_KEYconsole.anthropic.com
xAI (Grok)XAI_API_KEYconsole.x.ai
Google GenAI (Gemini)GOOGLE_GENERATIVE_AI_API_KEYaistudio.google.com
GroqGROQ_API_KEYconsole.groq.com

Quick Start

  1. Install dependencies

    bash
    bun install
    
  2. Configure your API key

    bash
    cp .env.example .env
    # Edit .env and add at least one API key
    
  3. Run the chat

    bash
    bun run start
    

Usage

šŸš€ Starting Eliza Chat...

āœ… Using OpenAI for language model

šŸ’¬ Chat with Eliza (type 'exit' to quit)

You: Hello!
Eliza: Hello! How can I help you today?

You: exit
šŸ‘‹ Goodbye!

Provider Priority

If multiple API keys are set, the chat will use them in this order:

  1. OpenAI
  2. Anthropic (Claude)
  3. xAI (Grok)
  4. Google GenAI (Gemini)
  5. Groq

Model Customization

You can override the default models for each provider. See .env.example for all options.

Examples

bash
# Use GPT-4 Turbo instead of default
OPENAI_LARGE_MODEL=gpt-5

# Use Claude Opus
ANTHROPIC_LARGE_MODEL=claude-opus-4-7

# Use GPT-OSS 120B on Groq
GROQ_LARGE_MODEL=openai/gpt-oss-120b

Development

Run with hot reload:

bash
bun run dev

License

MIT