Alphakek AI
WebsiteTwitterTelegramDiscordBlog
  • Introduction
  • AIKEK Network
  • Case Studies
  • Tokenomics
  • Roadmap
  • RESEARCH
    • Fractal
    • DeFAI Terminal
      • Chat Summary
      • Wallet Finder
      • Token Audit
      • Sentiment Analysis
      • AI News Search
    • Onchain Analysis
  • CREATE
    • Meme Generator
      • Text-to-Image
      • Effect
      • Mirage
      • Caption Meme
      • Text-to-Video
    • Meme Models
    • Prompt Enhancer
  • Launch
    • AI Agents
      • Agent Swarm
    • Universal Agents
    • Knowledge Swarms
    • NFT Art Generation
  • DEVELOPERS
    • Enterprise API
      • Memelord API
      • Wizard API
      • Alpha Alerts API
    • API Pricing
    • Changelog
  • GUIDES
    • Bot Commands
    • User Tiers
    • Bridging to Base
    • Bridging to Solana
    • API Usage Examples
    • AIKEK vs. ChatGPT
    • AIKEK vs. Stability AI
  • LEGAL
    • Privacy Policy
    • Token Disclosure
  • LINKS
    • Team
    • DexScreener
    • Twitter
    • Telegram
    • Website
    • Discord
    • Warpcast
    • Blog
    • Email
Powered by GitBook
On this page
  • Checking Account Status
  • Comparing Our AI Models
  1. GUIDES

API Usage Examples

PreviousBridging to SolanaNextAIKEK vs. ChatGPT

Last updated 4 months ago

The only pre-requisite to start using Alpha API is to obtain a token. Learn about it in .

Checking Account Status


The code sample below checks the account status of the API token owner: API Credits balance, User Tier, and $AIKEK balance. This API endpoint is free.

import requests  # pip install requests

api_key = "YOUR_TOKEN_HERE"
url = "https://api.alphakek.ai/account"

response = requests.get(url, headers={"Authorization": f'Bearer {api_key}'})

user_data = response.json()

print(f"User credits: {user_data['credits']}")
print(f"User tier: {user_data['tier']}")
print(f"Amount of $AIKEK in USD: {user_data['tokens_usd']}")
const api_key = "YOUR_TOKEN_HERE";
const url = "https://api.alphakek.ai/account";

fetch(url, {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${api_key}`
  }
})
.then(response => {
  if (response.ok) {
    return response.json();
  }
  throw new Error('Network response was not ok.');
})
.then(user_data => {
  console.log(`User credits: ${user_data['credits']}`);
  console.log(`User tier: ${user_data['tier']}`);
  console.log(`Amount of $AIKEK in USD: ${user_data['tokens_usd']}`);
})
.catch(error => {
  console.error('There has been a problem with your fetch operation:', error);
});

Comparing Our AI Models


This code sample calls Enterprise API for each of the three available DeFAI Terminal Universal Agents, asks them the same question, and returns a streaming response.

Note: The code sample below spends 6 API Credits upon running.

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_TOKEN_HERE",
    base_url="https://api.alphakek.ai/v1"
)
question = "What to expect from Ethereum ETFs?"
print("Question:", question)

models = ["versa", "nexus", "eclipse"]
for model in models:
    response = client.chat.completions.create(
        model=model,
        messages=[
            {
                'role': 'user',
                'content': question
            }
        ],
        stream=True,
    )

    print(f"\n\nResponse from the {model.capitalize()} model:")
    for chunk in response:
        if chunk.choices[0].delta.content is None:
            continue
        print(chunk.choices[0].delta.content, end="")
import OpenAI from 'openai';

const apiKey = "YOUR_TOKEN_HERE";
const client = new OpenAI({
    apiKey: apiKey,
    baseURL: 'https://api.alphakek.ai/v1'
});

const question = "What to expect from Ethereum ETFs?";
console.log("Question:", question);

const models = ["versa", "nexus", "eclipse"];
models.forEach(async model => {
    try {
        const stream = await client.chat.completions.create({
            model: model,
            messages: [{
                role: 'user',
                content: question
            }],
            stream: true,
        });

        console.log(`\n\nResponse from the ${model.charAt(0).toUpperCase() + model.slice(1)} model:`);
        for await (const chunk of stream) {
            if (chunk?.choices[0]?.delta?.content) {
                process.stdout.write(chunk.choices[0].delta.content);
            }
        }
    } catch (error) {
        console.error('Error handling:', error);
    }
});
Authentification