Skip to content

Tutor

Register and Login

Register and log in using your email and password.

Get Key

Click on the "Key" at the top and add a new token as needed. The quota can be allocated to multiple keys as required, and you can set whether they have an expiration date or not.

Usage

Replace the Interface

Follow the official interface to replace https://api.openai.com with https://api.inferkit.ai.

Replace with Our Site's Key

Then replace it with the key from our site.

Quick Start

Text Model

curl -L https://api.inferkit.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-XX" \
-d '{
"model": "gpt-4",
"stream": true,
"messages": [
    {
    "role": "system",
    "content": "You are a helpful assistant."
    },
    {
    "role": "user",
    "content": "hello!"
    }
]
}'
from openai import OpenAI

api_key = "sk-xxx"
client = OpenAI(api_key=api_key)
client.base_url = "https://api.inferkit.ai/v1"

completion = client.chat.completions.create(
    model="gpt-4",
    messages=[
        {"role": "system", "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},
        {"role": "user", "content": "Compose a poem that explains the concept of recursion in programming"}
    ]
)
print(completion.choices[0].message)

TTS

curl https://api.inferkit.ai/v1/audio/speech \
-H "Authorization: Bearer $Inferkit_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "tts-1",
    "input": "Today is a wonderful day to build something people love!",
    "voice": "alloy"
}' \
--output speech.mp3
from pathlib import Path
from openai import OpenAI

api_key = "sk-xxx"  # key of Inferkit
client = OpenAI(api_key=api_key)
client.base_url = "https://api.inferkit.ai/v1"

speech_file_path = Path(__file__).parent / "speech.mp3"
response = client.audio.speech.create(
    model="tts-1",
    voice="alloy",
    input="Today is a wonderful day to build something people love!"
)

response.stream_to_file(speech_file_path)

Image models

curl https://api.inferkit.ai/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $Inferkit_API_KEY" \
-d '{
    "model": "dall-e-3",
    "prompt": "a white siamese cat",
    "n": 1,
    "size": "1024x1024"
}'
from openai import OpenAI
api_key = "sk-xxx"  # key of Inferkit
client = OpenAI(api_key=api_key)
client.base_url = "https://api.inferkit.ai/v1"

response = client.images.generate(
model="dall-e-2",
prompt="a white siamese cat",
size="256x256",
quality="standard",
n=1,
)

image_url = response.data[0].url

print(image_url)

Support Models

GPT4

  • gpt-4
  • gpt-4-0314
  • gpt-4-0613

GPT4-Turbo

  • gpt-4-0125-preview
  • gpt-4-1106-preview
  • gpt-4-turbo-preview

GPT3.5-Turbo

  • gpt-3.5-turbo
  • gpt-3.5-turbo-0301
  • gpt-3.5-turbo-0613
  • gpt-3.5-turbo-1106
  • gpt-3.5-turbo-0125

Embedding

  • text-embedding-ada-002
  • text-embedding-3-small
  • text-embedding-3-large

TTS

  • tts-1
  • tts-1-1106
  • tts-1-hd
  • tts-1-hd-1106

Image models

  • dall-e-2
  • dall-e-3

How to Use the Beta Version

By default, users are using the beta version after registration and login, with no extra configuration needed. Simply refer to the quick verification instructions above to send requests. Cost information will be displayed in the "Log" at the top.

How to Use the Azure Version

To use the Azure version, refer to the supported models above and use the models starting with "Azure". Cost information will also be shown in the "Log" at the top.

How to Recharge

Click on "Price" at the top to view your current balance. On the "Price" page, you can add funds by adding customer service personnel on WeChat to get a recharge code, then enter this code to recharge.

Fee Explanation

Click on "Log" at the top to view the token usage and billing details for each call. The quota column shows the discounted cost of the official website's API, and details on discounts can be found in the details column. It is recommended to use the beta version API, as its price is 50% of the official website's.