4EVERLAND Documents
HomeTwitterDiscordBlogs
  • Welcome to 4EVERLAND
  • Get started
    • Our Features
    • Quick Start Guide
      • Registration
      • Login options
        • MetaMask
        • OKX Wallet
        • Binance Web3 Wallet
        • Bitget Wallet
        • Phantom
        • Petra
        • Lilico
      • Usage Introduction
      • Dashboard stats
      • Account
        • Linking Your EVM Wallet to 4EVERLAND Account
        • Balance Alert
    • Billing and Pricing
      • What is LAND?
      • How to Obtain LAND?
      • Pricing Model
      • Q&As
    • Tokenomics
  • HOSITNG
    • What is Hosting?
      • IPFS Hosting
      • Arweave Hosting
        • Auto-Generation of Manifest
      • Internet Computer Hosting
      • Greenfield Hosting
    • Guides
      • Creating a Deployment
        • With Git
        • With IPFS Hash
        • With a Template
      • Site Deployment
      • Domain Management
        • DNS Setup Guide
        • ENS Setup Guide
        • SNS Setup Guide
          • The gateway: 4sol.xyz
        • SPACE ID Setup Guide
      • Project Setting
        • Git
      • Troubleshooting
      • Common Frameworks
    • Hosting Templates Centre
      • Templates Configuration File
    • Quick Addition
      • Implement Github 4EVER Pin
      • Github Deployment Button
    • Hosting API
      • Create Project API
      • Deploy Project API
      • Get Task Info API
      • IPNS Deployment Update API
    • Hosting CLI
  • Storage
    • Bucket
      • IPFS Bucket
        • Get Root CID - Snapshots
      • Arweave Bucket
        • Path Manifests
          • Instructions for Building Manifest
          • Auto-Generation of Manifest
        • Arweave Tags
        • Unleash Arweave
      • Guides
      • Bucket API - S3 Compatible
        • Coding Examples
          • AWS SDK - Go (Golang)
          • AWS SDK - Java
          • AWS SDK - JavaScript
          • AWS SDK - .NET
          • AWS SDK - PHP
          • AWS SDK - Python
          • AWS SDK - Ruby
        • S3 Tags Instructions
      • 4EVER Security Token Service API
      • Bucket Tools
      • Bucket Gateway Optimizer
    • 4EVER Pin
      • Guides
      • Pinning Services API
      • IPFS Migrator
    • Storage SDK
  • Gateways
    • IPFS Gateway
    • IC Gateway
    • Arweave Gateway
    • Dedicated Gateways
      • Gateway Access Controls
      • Video Streaming
      • IPFS Image Optimizer
    • IPNS Manager
      • IPNS Manager API
  • RPC
    • Guides
    • API Keys
    • JSON Web Token (JWT)
    • What's CUs/CUPS
    • WebSockets
    • Archive Node
    • Debug API
    • Chains RPC
      • BSC / opBNB
      • Ethereum
      • Optimism
      • Polygon
      • Taiko
  • AI
    • AI RPC
      • Quick Start
      • Models
      • API Keys
      • Requests & Responses
      • Parameters
    • 4EVER Chat
  • RaaS - Beta
    • What's Rollups?
    • 4EVER Rollup Stack
  • DePIN
    • 4EVER Network
    • Storage Nodes
  • More
    • Use Cases
      • Livepeer
      • Lens Protocol
      • Optopia.ai
      • Linear Finance
      • Snapshot
      • Tape
      • Taiko
      • Hey.xyz
      • SyncSwap
    • Community
    • Tutorials
    • Security
    • 4EVERLAND FAQ
Powered by GitBook
On this page
  • Introduction
  • Getting Started
  • API Example
  • Open AI
  1. AI
  2. AI RPC

Quick Start

Last updated 10 months ago

Introduction

The Quick Start guide is designed to help users or developers quickly begin using the 4EVER AI RPC API by covering model costs with API keys. Whether you prefer using curl commands or the , this guide will walk you through the necessary steps to integrate and utilize the API effectively.

Getting Started

To get started with 4EVERLAND AI RPC API, follow these simple steps:

  1. Obtain your from 4EVER AI RPC.

  2. Review the Request documentation to familiarize yourself with all possible parameters and endpoints.

  3. Choose your preferred method of integration: using curl commands or the OpenAI SDK.

API Example

Below is an example of how to make a request using the AI RPC:

typescript

fetch("https://ai.api.4everland.org/api/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${YOUR_API_KEY}`,
    "HTTP-Referer": `${YOUR_SITE_URL}`, // Optional
    "X-Title": `${YOUR_SITE_NAME}`, // Optional
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "google/gemini-pro-1.5",//choose a model
    "messages": [
      {"role": "user", "content": "What is the meaning of life?"},
    ],
    "top_p:" 1, //Optional parameter
    "temperature:" 1, //Optional parameter
    "repetition_penalty:" 1, //Optional parameter
  })
});

Python

import requests
import json
response = requests.post(
  url="https://ai.api.4everland.org/api/v1/chat/completions",
  headers={
    "Authorization": f"Bearer {YOUR_API_KEY}",
    "HTTP-Referer": f"{YOUR_SITE_URL}", # Optional
    "X-Title": f"{YOUR_APP_NAME}", # Optional
  },
  data=json.dumps({
    "model": "google/gemini-pro-1.5", # Optional
    "messages": [
      {"role": "user", "content": "What is the meaning of life?"}
    ]
    "top_p": 1, # Optional parameter
    "temperature": 1, # Optional parameter
    "frequency_penalty": 0, # Optional parameter
  })
)

Shell

curl --location 'https://ai.api.4everland.org/api/v1/chat/completions' \
--header 'authorization: Bearer $YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "model": "google/gemini-pro-1.5",
    "messages": [
        {
            "role": "user",
            "content": "what'\''s the meaning of life"
        }
    ],
    "top_p":1,
    "temperature": 1,
    "frequency_penalty":0,
    "presence_penalty":0,
    "repetition_penalty":1,
    "top_k":0
}'

Open AI

You can also use 4EVERLAND AI RPC with OpenAI's client API:

python

import openai
openai.api_base = "https://ai.api.4everland.org/api/v1"
openai.api_key = $YOUR_API_KEY
response = openai.ChatCompletion.create(
  model="openai/gpt-3.5-turbo",
  messages=[...],
  headers={
    "HTTP-Referer": $YOUR_SITE_URL, # Optional
    "X-Title": $YOUR_APP_NAME, # Optional
  },
)
reply = response.choices[0].message

typescript

import OpenAI from "openai"
const openai = new OpenAI({
  baseURL: "https://ai.api.4everland.org/api/v1",
  apiKey: $YOUR_API_KEY,
  defaultHeaders: {
    "HTTP-Referer": $YOUR_SITE_URL, // Optional
    "X-Title": $YOUR_SITE_NAME, // Optional
  },
  // dangerouslyAllowBrowser: true,
})
async function main() {
  const completion = await openai.chat.completions.create({
    model: "openai/gpt-3.5-turbo",
    messages: [
      { role: "user", content: "Say this is a test" }
    ],
  })
  console.log(completion.choices[0].message)
}
main()

To stream with Python, .

If you have any questions, please join our , or send us an email at .

Remember, innovation and creativity are at your fingertips with 4EVER AI RPC API. !

OpenAI SDK
API key
see this example from OpenAI
Discord server
contact@4everland.org
Start exploring today