Anthias AMM Router API Documentation
Last updated: July 3, 2025
Overview
Anthias Router is a on-chain DEX aggregator built on Hyperliquid. It aggregates liquidity and routes swaps across multiple Automated Market Makers (AMMs) and DEXs to provide the best price and route for token swaps on HyperEVM. Routing through the HyperCore orderbook is in development.
It supports multi-hop and split-routing.
Supported Liquidity Sources
-
HyperSwap V2, V3
-
Kittenswap (Stable, Volatile, V3)
-
Hybra Finance (Stable, Volatile, V3)
-
Laminar V3
-
Curve Finance (Stableswap)
Authentication
API Key: Required for the /quote endpoint. Contact your Anthias Router representative to obtain an API key.
API Endpoints
1. Get Swap Quote
Endpoint:
GET /quote?tokenA=<address>&tokenB=<address>&amount=<amount>&api_key=<api_key>
Description: Returns the best route and expected output for swapping a specified amount of tokenA to tokenB.
Parameters:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
tokenA |
string |
Yes |
Address of input token |
|
tokenB |
string |
Yes |
Address of output token |
|
amount |
string |
Yes |
Amount of input token (in wei) |
|
api_key |
string |
Yes |
Your API key |
Sample Request (Python)
import requests
base_url = "http://api.anthiasrouter.xyz/quote"
api_key = "YOUR_API_KEY"
def get_quote(token_in: str, token_out: str, amount_in: str) -> tuple[float, float]:
url = f"{base_url}?tokenA={token_in}&tokenB={token_out}&amount={amount_in}"
headers = {
"Authorization": f"{api_key}" # or "X-API-Key": api_key depending on API
}
response = requests.get(url, headers=headers)
response.raise_for_status()
response_time = response.elapsed.total_seconds()
result = response.json()
return float(result["output_amount"]), response_time
if __name__ == "__main__":
# Example token addresses and amount
token_in = "0x5555555555555555555555555555555555555555"
token_out = "0xca79db4b49f608ef54a5cb813fbed3a6387bc645"
amount_in = 100
try:
output, time_taken = get_quote(token_in, token_out, amount_in)
print(f"Expected Output: {output}")
print(f"API Response Time: {time_taken:.4f} seconds")
except Exception as e:
print(f"Error: {e}")
JavaScript (Node.js, using Axios)
const axios = require('axios');
const baseUrl = "http://api.anthiasrouter.xyz/quote";
const apiKey = "YOUR_API_KEY";
async function getQuote(tokenIn, tokenOut, amountIn) {
const url = ${baseUrl}?tokenA=${tokenIn}&tokenB=${tokenOut}&amount=${amountIn};
const headers = {
'Authorization': ${apiKey},
};
const start = Date.now();
const response = await axios.get(url, { headers });
const responseTime = (Date.now() - start) / 1000;
return [parseFloat(response.data.output_amount), responseTime];
}
async function main() {
const tokenIn = "0x5555555555555555555555555555555555555555";
const tokenOut = "0xdAbB040c428436d41CECd0Fb06bCFDBAaD3a9AA8";
const amountIn = 100;
try {
const [output, timeTaken] = await getQuote(tokenIn, tokenOut, amountIn);
console.log(`Expected Output: ${output}`);
console.log(`API Response Time: ${timeTaken.toFixed(4)} seconds`);
} catch (err) {
console.error("Error:", err.message);
}
}
main();
Go
package main
import (
"encoding/json"
"fmt"
"net/http"
"time"
)
var (
baseUrl = "http://api.anthiasrouter.xyz/quote"
apiKey = "YOUR_API_KEY"
)
func getQuote(tokenIn string, tokenOut string, amountIn float64) (float64, float64, error) {
url := fmt.Sprintf("%s?tokenA=%s&tokenB=%s&amount=%.0f", baseUrl, tokenIn, tokenOut, amountIn)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return 0, 0, err
}
req.Header.Set("Authorization", apiKey)
client := &http.Client{}
start := time.Now()
resp, err := client.Do(req)
if err != nil {
return 0, 0, err
}
defer resp.Body.Close()
responseTime := time.Since(start).Seconds()
if resp.StatusCode != http.StatusOK {
return 0, responseTime, fmt.Errorf("HTTP error: %d", resp.StatusCode)
}
var result map[string]interface{}
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return 0, responseTime, err
}
var output float64
output, ok := result["output_amount"].(float64)
if !ok {
return 0, responseTime, fmt.Errorf("type assertion to float64 failed")
}
return output, responseTime, nil
}
func main() {
tokenIn := "0x5555555555555555555555555555555555555555"
tokenOut := "0xdAbB040c428436d41CECd0Fb06bCFDBAaD3a9AA8"
var amountIn float64 = 100
output, timeTaken, err := getQuote(tokenIn, tokenOut, amountIn)
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Printf("Expected Output: %f\n", output)
fmt.Printf("API Response Time: %.4f seconds\n", timeTaken)
}
Sample Response
{
"amount_in": 1000,
"amount_out": 992,
"min_output_amount": 991,
"price_impact": "-0.195",
"route": [
...route information objects here ...
]
}
Response Schema:
|
Field |
Type |
Description |
|---|---|---|
|
input_amount |
float |
Amount of input tokens |
|
min_output_amount |
float |
Minimum output amount (after slippage) |
|
output_amount |
float |
Expected output amount |
|
path |
array |
Swap route (list of token addresses) |
|
price_impact |
string |
Price impact percentage (as string, may be negative) |
2. List All Tokens
Endpoint:
GET /tokens?all
Description: Returns a list of all tokens on HyperEVM with their contract addresses.
Authentication: No API key required.
Sample Response
{
"0x5555555555555555555555555555555555555555": "WHYPE",
"0xdAbB040c428436d41CECd0Fb06bCFDBAaD3a9AA8": "mHYPE",
"0x02c6a2fA58cC01A18B8D9E00eA48d65E4dF26c70": "feUSD"
}
Python Example
import requests
BASE_URL = "http://api.anthiasrouter.xyz/tokens"
def get_all_tokens():
"""
Fetches a dictionary of all tokens on HyperEVM with their contract addresses.
No API key required.
"""
url = f"{BASE_URL}?all"
try:
response = requests.get(url)
response.raise_for_status()
tokens = response.json()
return tokens
except requests.RequestException as e:
print(f"Error fetching all tokens: {e}")
return None
if __name__ == "__main__":
# Example: Get all tokens
all_tokens = get_all_tokens()
if all_tokens:
print(f"Total tokens fetched: {len(all_tokens)}")
# Print first 5 tokens
for addr, symbol in list(all_tokens.items())[:5]:
print(f"{symbol}: {addr}")
3. Get Token Address by Symbol
Endpoint:
GET /tokens?{token_symbol}
Description: Returns the contract address for the specified token symbol if it exists on HyperEVM.
Parameters:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
token_symbol |
string |
Yes |
Symbol of the token |
Sample Response
{
"address": "0x5555555555555555555555555555555555555555"
}
Python Example
import requests
BASE_URL = "http://api.anthiasrouter.xyz/tokens"
def get_token_address(token_symbol: str):
"""
Fetches the contract address for a given token symbol on HyperEVM.
No API key required.
"""
url = f"{BASE_URL}?{token_symbol}"
try:
response = requests.get(url)
response.raise_for_status()
data = response.json()
# Expected response: {"address": "0x..."}
return data.get("address")
except requests.RequestException as e:
print(f"Error fetching address for token '{token_symbol}': {e}")
return None
if __name__ == "__main__":
# Example: Get address for a specific token symbol
token_symbol = "WHYPE"
address = get_token_address(token_symbol)
if address:
print(f"Address for token '{token_symbol}': {address}")
else:
print(f"Token symbol '{token_symbol}' not found.")
Additional Notes
-
Price Impact Calculation: Price impact is computed using DexScreener API
-
API Rate Limits: Contact Support team for rate limits and usage policies
-
Error Handling: All endpoints return standard HTTP status codes. In case of errors, the response will include a descriptive message
Contact & Support
For API key requests, technical support, or further documentation, please contact the Anthias Router team directly at team@anthias.xyz.
Disclaimer
This documentation is intended for developers integrating with the Anthias Router API on HyperEVM. Ensure you handle API keys securely and comply with all relevant security best practices.