360 Secure SkillHub
360 安全技能中心

Agnic AI Gateway

封装 Agnic AI Gateway 的命令行调用,提供模型列表查询、单轮对话和图像生成三类命令。使用前需通过令牌或登录完成鉴权,费用按 token 从余额扣除,支持 JSON 输出以及免费与付费模型选择。

agnicpay-prog
agnicpay-prog
热度 42.55
最近更新 2026-05-11 17:41:04
分类:自动化依赖:代码执行 / 第三方 API / 内部调用大模型应用场景:图像生成 / 概念解释 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add ai-gateway
Metadata
name
ai-gateway
description
Access 340+ AI models via the Agnic AI Gateway -- chat, image generation, model listing. Use when the user wants to chat with AI, generate images, ask GPT, use Claude, list models, delegate to another LLM, or get a second opinion. Covers "ask GPT", "use Claude", "generate an image", "list AI models", "call a model".
user-invocable
true
disable-model-invocation
false
context
fork
allowed-tools
["Bash(npx agnic@latest status*)","Bash(npx agnic@latest ai *)"]

AI Gateway

Access 340+ AI models (OpenAI, Anthropic, Google, Meta, Mistral, DeepSeek, and more) through the Agnic AI Gateway. Costs are deducted from your USDC balance per token. Free models available for development.

Authentication

Run npx agnic@latest status --json to verify. If not authenticated:

  • Headless (CI/server/agent): Set AGNIC_TOKEN env var or pass --token <token>
  • Interactive (has browser): Run npx agnic@latest auth login

See the authenticate-wallet skill for details.

Commands

List models

npx agnic@latest ai models [--provider <name>] [--search <term>] [--json]

Chat with a model

npx agnic@latest ai chat --model <provider/model-name> --prompt "<text>" [--system "<text>"] [--json]

Generate an image

npx agnic@latest ai image --prompt "<text>" [--aspect-ratio 16:9] [--output file.png] [--json]

Models use provider/model-name format (e.g., openai/gpt-4o, meta-llama/llama-3.3-70b). See reference/models-and-options.md for full model list, all options, and input validation rules.

Examples

# List OpenAI models
npx agnic@latest ai models --provider openai --json

# Chat with GPT-4o
npx agnic@latest ai chat --model openai/gpt-4o --prompt 'Explain quantum computing in one sentence'

# Use a free model
npx agnic@latest ai chat --model meta-llama/llama-3.3-70b --prompt 'What is 2+2?' --json

# Generate an image
npx agnic@latest ai image --prompt 'A sunset over mountains' --output sunset.png

# Generate widescreen image
npx agnic@latest ai image --prompt 'Cyberpunk cityscape' --aspect-ratio 16:9 --output city.png

Prerequisites

  • Must be authenticated (npx agnic@latest status to check)
  • Wallet must have USDC balance (free models available for testing)

Error Handling

Common errors:

  • "Not authenticated" -- Run npx agnic@latest auth login or set AGNIC_TOKEN
  • "Insufficient balance" -- Fund wallet at app.agnic.ai
  • "Model not found" -- Check available models with npx agnic@latest ai models
  • "No image returned" -- Try a different model or rephrase the prompt
  • "Rate limit exceeded" -- Wait a moment and retry