Use Moyi API with elizaOS

elizaOS picks its model provider through plugins. To run an agent on Moyi API, point the OpenAI plugin (for GPT models) or the Anthropic plugin (for Claude) at Moyi API and use your Moyi API key. One key and one balance cover both.

Checked on 2026-11-06 against the current npm releases: @elizaos/cli 1.7.2, @elizaos/plugin-openai 1.6.0 and @elizaos/plugin-anthropic 1.5.12.

New accounts start with a $0 balance — top up before your first request. Top up from $5. If a request returns 402 (400 on the OpenAI format) with "wallet balance is insufficient", your balance is empty — your base URL and key are fine. Top up and retry.

1. Before you start

  1. Create an API key in the Moyi API console.
  2. Have an elizaOS project. If you don't have one yet:
bash
bun i -g @elizaos/cli
elizaos create my-agent
cd my-agent

Environment variables go in the project's .env file (or elizaos env edit-local).

2. GPT models: @elizaos/plugin-openai

bash
elizaos plugins add @elizaos/plugin-openai

.env:

bash
OPENAI_API_KEY=sk-xxxxxx
OPENAI_BASE_URL=https://api.moyi-api.com/v1
OPENAI_SMALL_MODEL=gpt-6-luna
OPENAI_LARGE_MODEL=gpt-6.1-sol
  • Keep /v1 at the end of OPENAI_BASE_URL.
  • Use GPT model IDs here. plugin-openai 1.6.0 sends text requests to the OpenAI Responses API (/v1/responses), and on Moyi API that endpoint serves GPT models only. For Claude, use the Anthropic plugin in section 3.

3. Claude models: @elizaos/plugin-anthropic

bash
elizaos plugins add @elizaos/plugin-anthropic

.env:

bash
ANTHROPIC_API_KEY=sk-xxxxxx
ANTHROPIC_BASE_URL=https://api.moyi-api.com/v1
ANTHROPIC_SMALL_MODEL=claude-haiku-5-5
ANTHROPIC_LARGE_MODEL=claude-sonnet-5-5
  • ANTHROPIC_BASE_URL isn't listed in the plugin's README, but the plugin reads it (default https://api.anthropic.com/v1). Keep /v1 at the end; requests go to Moyi API's /v1/messages.
  • List the Anthropic plugin first in your character's plugins, so text generation goes to Claude:
json
{
  "plugins": ["@elizaos/plugin-anthropic", "@elizaos/plugin-openai"]
}

4. Embeddings

elizaOS needs an embedding model for its memory. Moyi API doesn't offer embedding models, so send embeddings somewhere else. The simplest option is a local Ollama model through plugin-openai's separate embedding settings:

bash
ollama pull nomic-embed-text

.env:

bash
OPENAI_EMBEDDING_URL=http://localhost:11434/v1
OPENAI_EMBEDDING_API_KEY=ollama
OPENAI_EMBEDDING_MODEL=nomic-embed-text
OPENAI_EMBEDDING_DIMENSIONS=768

Text still goes to Moyi API. Start the agent with elizaos start and open http://localhost:3000. If you skip this step, elizaOS fails with "No model found for type EMBEDDING", or the embedding requests sent to Moyi API fail.

5. Which model for which job

Job Model ID Official price (input / output per 1M tokens)
Main agent replies, tool use claude-sonnet-5-5 $2 / $10
Hardest reasoning and long tasks claude-opus-5-5 $4 / $20
Main model on GPT gpt-6.1-sol $2 / $10
Cheap small model (classification, "should I respond") claude-haiku-5-5 or gpt-6-luna $0.1 / $0.5

These are the vendors' official list prices. Moyi API's current prices are on the pricing page and the model list.

6. Common errors

What you see Cause Fix
401, API key incomplete Key copied with missing characters Copy the full sk- key again
402 (400 on the OpenAI format), wallet balance is insufficient Balance is $0 Top up, from $5
400 when a Claude model is set in OPENAI_LARGE_MODEL plugin-openai uses /v1/responses, which serves GPT models only Use plugin-anthropic for Claude (section 3)
Redirect (301), an HTML page or 405 instead of a model reply Base URL missing /v1 https://api.moyi-api.com/v1 for both plugins
No model found for type EMBEDDING No embedding provider Section 4
Ready? Three steps to startLog in to the console · top up · create an API key