Quick Start

In this Quick Start guide, we'll walk you through the essential steps to begin using our powerful API models for various purposes, such as chat, search, and image generation. Let's dive right in!

Chat Models

Our API offers a range of chat models, each tailored to different needs and use cases. Here's a table summarizing the available chat models along with their corresponding model IDs, token pricing, and billing methods:

Chat Models Table:

ModelModel IDWeb PriceAPI PriceBilling Method
TheB.AItheb-ai0.002$ / 1k tokens0.002$ / 1k tokensToken
GPT-3.5gpt-3.5-turbo0.0015$ / 1k in & 0.002$ / 1k out0.0015$ / 1k in & 0.002$ / 1k outToken
GPT-3.5-16Kgpt-3.5-turbo-16k0.003$ / 1k in & 0.004$ / 1k out0.003$ / 1k in & 0.004$ / 1k outToken
GPT-4gpt-40.03$ / 1k in & 0.06$ / 1k out0.03$ / 1k in & 0.06$ / 1k outToken
GPT-4 32Kgpt-4-32k0.12$ / 1k tokens0.12$ / 1k tokensToken
Claude 2claude-20.02$ / 1k in & 0.05$ / 1k out0.02$ / 1k in & 0.05$ / 1k outToken
Claude 1claude-10.02$ / 1k in & 0.05$ / 1k out0.02$ / 1k in & 0.05$ / 1k outToken
Claude 1 100Kclaude-1-100k0.02$ / 1k in & 0.05$ / 1k out0.02$ / 1k in & 0.05$ / 1k outToken
Claude Instantclaude-instant-10.003$ / 1k in & 0.008$ / 1k out0.003$ / 1k in & 0.008$ / 1k outToken
Claude Instant 100Kclaude-instant-1-100k0.003$ / 1k in & 0.008$ / 1k out0.003$ / 1k in & 0.008$ / 1k outToken
PaLM 2palm-20.0008$ / 1k characters0.0008$ / 1k charactersCharacter
Codeypalm-2-codey0.0008$ / 1k characters0.0008$ / 1k charactersCharacter
Llama 2 7Bllama-2-7b-chatFree0.0004 / 1k tokens
Llama 2 13Bllama-2-13b-chatFree0.0008 / 1k tokens
Llama 2 70Bllama-2-70b-chat0.006 / 1k tokens0.006 / 1k tokens
Code Llama 7Bcode-llama-7bFree0.0004 / 1k tokens
Code Llama 13Bcode-llama-13bFree0.0008 / 1k tokens
Code Llama 34Bcode-llama-13b0.003 / 1k tokens0.003 / 1k tokens

Choose the chat model that best suits your requirements based on the token pricing and billing method.

Search Models

Our API's search models are designed to help you with efficient information retrieval. Here's a table outlining the available search model along with its model ID and usage billing:

Search Model Table:

ModelModel IDUsage Billing
SearchN/A0.02$ per usage

Select the search model to enhance your search capabilities and streamline information retrieval.

Image Models

For image generation tasks, our API offers a variety of image models that cater to different pixel resolutions. Below is a table detailing the available image models, their model IDs, pixel resolutions, and pricing per image:

Image Models Table:

ModelModel IDPixel ResolutionPrice per Image
DALL·E 2dall-e-2256x2560.016$/image
DALL·E 2dall-e-2512x5120.018$/image
DALL·E 2dall-e-21024x10240.020$/image
Google Imagengoogle-imagen1024x10240.030$/image

Select an image model based on the desired pixel resolution and price per image to generate stunning visuals effortlessly.

Making Your First API Request

To get started with our API, you'll need to create an API key. Here's how you can do it:

  1. You need to have an TheB.AI account. If you don't have one, sign up here.
  2. Sign in and navigate to the Manage Account section.
  3. Navigate to the API keys section and generate an API key.
  4. Copy the generated key for later use.

Now that you have your API key, let's make your first API request. Here's a simple example using cURL to interact with the chat model:

Example Request

POST
/v1/chat/completions
curl --location 'https://api.theb.ai/v1/chat/completions' \
# curl --location 'https://api.baizhi.ai/v1/chat/completions' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Content-Type: application/json' \
--data '{
  "model": "gpt-3.5-turbo",
  "messages": [
    {
      "role": "user",
      "content": "Hello, World!"
    }
  ],
  "stream": false
}'

What's Next?

You've now gained a solid understanding of our various model offerings and how to make your first API request. What's next? Continue exploring our API Reference for detailed information about each endpoint and its parameters. Dive into the possibilities our models offer and start integrating them into your projects to drive innovation and excellence.

Thank you for choosing our API. Let's embark on this journey of technological advancement together!