1For AI
  • Welcome
  • Getting Started
    • Quickstart
  • Model
    • Retrieve Model List
    • Get Single Model
  • Chat
    • Create new chat
    • Continue Chat Conversation
  • User
    • User Balance
  • Errors
    • Common Errors
Powered by GitBook
On this page
  1. Getting Started

Quickstart

PreviousWelcomeNextRetrieve Model List

Last updated 1 month ago

Quickstart Guide: 1For AI API

This guide will help you get started with the 1For AI API, enabling you to interact with leading AI models through a unified interface.​


1. Obtain Your API Key

Begin by signing up at to receive your API key. This key authenticates your requests and tracks usage.​


2. Make Your First API Call

With your API key, you can send a request to the 1For AI endpoint. Here's an example using curl:​

curl -X POST https://api.1for.ai/v1/chat/completions \
  -H "api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [
      {"role": "user", "content": "Hello, how can I use 1For AI?"}
    ]
  }'

Replace YOUR_API_KEY with your actual API key.​


3. Understand the Response

The API will return a JSON response containing the AI's reply. For example:

{
    "text": "Hi there! How are you doing today? Is there anything I can help you with?",
    "cost": 0.00046296,
    "role": "system",
    "chat_id": "6800b5f0750ba2214b51cd2d",
    "model": "claude-3-5-haiku-latest"
}

4. Explore Further

  • Model Selection: Set "model": "auto" to let 1For AI choose the best model, or specify a particular model like "gpt-4".​

  • Supported Models: Access models from OpenAI, Anthropic, Google, xAI, and Mistral through a single API.​

  • No Rate Limits: Enjoy unrestricted access without imposed rate limits or time restrictions.​


For comprehensive details and advanced configurations, refer to the full documentation at .

1for.ai
1for.ai/docs