In the realm of AI tools, accessing powerful resources like Codex and Hermes often comes with costs or restrictions. However, this guide walks through a practical, long-term free method to utilize these tools, perfect for those running overseas websites who need reliable AI capabilities without breaking the bank.
Leveraging Codex++ and Agnes API
First, introduce Codex++, an open-source tool that allows you to replace the underlying model of Codex. Paired with Agnes API, a free offering from a top 10 global AI lab, you can access robust AI capabilities at no cost.
Agnes provides three flagship multimodal models for free:
- Text & Agent:
Agnes-2.0-Flash - Image Generation:
Agnes-Image-2.1-Flash - Video Generation:
Agnes-Video-V2.0
These models cover text, image, and video generation, making them suitable for a wide range of tasks for overseas websites, such as content creation, product image generation, and more.
Step-by-Step Setup for Codex++ with Agnes
Get Codex++ from GitHub
Navigate to the Codex++ repository on GitHub and set it up. This tool acts as a bridge to connect Codex with alternative models.Configure the Supplier in Codex++
- Go to the Codex++ management console.
- In "Supplier Configuration", click "Add".
- Fill in the details:
- Name: Agnes
- Access Method: Pure API
- Base URL:https://apihub.agnes-ai.com/v1
- API Key: Generate an API key from the Agnes platform. - Select "Chat" for the upstream protocol and fetch models from the upstream.
- Save and restart Codex.
Test the Configuration
Open Codex, selectagnes-2.0-flashas the model, and send a test message to verify it works.
Building Custom Skills with Playwright CLI
To extend functionality, create custom skills using Playwright CLI. Here's how to set up a skill for generating images with Agnes-Image-2.1-Flash:
- Create a Project Folder: Make a new folder and open it in the terminal.
- Install Dependencies:
npm install -g @playwright/cli@latest
playwright-cli install --skills
- Configure the Skill Folder: Rename the folder storing skills from
.claudeto.codexwithin your project directory. - Develop an Image Generation Skill: Use the Skill Creator in Codex to define a skill that calls the Agnes-Image-2.1-Flash API.
import requests
import json
import urllib.request
import urllib.error
# Configuration
API_KEY = "YOUR_AGNES_API_KEY" # Replace with your actual API key
BASE_URL = "https://apihub.agnes-ai.com/v1"
ENDPOINT = "/images/generations"
MODEL = "agnes-image-2.1-flash"
def generate_image(prompt, size="1024x1024", image_url=None, save_path=None):
payload = {
"model": MODEL,
"prompt": prompt,
"size": size,
}
if image_url:
payload["extra_body"] = {
"image_urls": [image_url],
"response_format": "url"
}
data = json.dumps(payload).encode('utf-8')
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {API_KEY}"
}
response = requests.post(f"{BASE_URL}{ENDPOINT}", headers=headers, data=data)
response_data = response.json()
if save_path and "data" in response_data:
image_url = response_data["data"][0]["url"]
urllib.request.urlretrieve(image_url, save_path)
return response_data
- Test the Skill:
python .codex/skills/agnes-imagegen/script/generate.py --prompt "A futuristic cityscape"
Deploying Hermes Agent with Agnes API
Hermes Agent is a powerful tool. By integrating it with Agnes API, you can use it for free:
- Set Up WSL: Use WSL as the runtime environment for Hermes.
- Install Hermes Agent:
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
- Configure Agnes API in Hermes: When prompted, select
custom (direct API), set the API base URL tohttps://apihub.agnes-ai.com/v1, enter your Agnes API key, chooseChat Completionsfor the API format, and selectagnes-2.0-flashas the model. - Add a Messaging Channel:
hermes gateway setup
- Test Hermes: Send a message to your Hermes-enabled channel and approve the tool call when prompted.
Practical Applications for Overseas Websites
- Content Creation: Use Agnes-Image-2.1-Flash to generate unique images for blog posts or product pages.
python .codex/skills/agnes-imagegen/script/generate.py --prompt "A cute little horse by a river, watercolor style"
- Automated Tasks: Deploy Hermes to handle customer inquiries, fetch data, or automate content updates.
- Multimodal Marketing: Leverage Agnes-Video-V2.0 to create promotional videos for free.
By following this guide, you can harness the power of Codex, Hermes, and Agnes API to enhance your overseas website's functionality without incurring costs.