Cheapest GPT-4 Turbo, GPT 4 Vision, ChatGPT OpenAI AI API

FREEMIUM
Por NextAPI | Atualizado 9 дней назад | Artificial Intelligence/Machine Learning
Popularidade

9.8 / 10

Latência

185ms

Nível de serviço

100%

Health Check

100%

Voltar para todos os tutoriais (2)

How to get started

Cheapest GPT-4 Turbo & Vision - Your Affordable Access to Powerful OpenAI Models

Introduction

Welcome to the Cheapest GPT-4 Turbo & Vision API on RapidAPI. We offer an affordable way to access OpenAI’s powerful NLP and vision recognition models. If you’re familiar with OpenAI’s API, you’ll feel right at home with ours! You can use the same formatting and functions.

Our pricing matches exactly to OpenAI’s but with a unique twist — we offer flexible subscription plans where you receive more credits than the dollars you spend, rewarding you with more use-cases at less cost. This guide will walk you through how to use our API, understand the credit system, and leverage the benefits of different price tiers.

Understanding the Credit System

When you subscribe to a tier, you receive a certain amount of credits that represents the monetary value for API usage. For example, if you subscribe to our $5 tier, you don’t just get $5 worth of usage, but $15 worth of credits! This extra credit given above the actual cost increases with higher tiers, providing you a great savings option. Credit usage depends on the specific queries and tasks performed and each time you make a API call, credits are deducted from your account balance.

Our pricing also follows OpenAI’s, so you can imagine that the $15 worth of OpenAI Credits are useable across all the GPT-4 models if you buy the $5 subscription. Check out the usage/token pricing: https://openai.com/pricing.

Available Pricing Tiers

  • Free Tier

    For exploration and trial purposes, we offer $0.50 worth of credits for no cost.

  • Basic Tier - $5 Subscription

    Get $15 worth of OpenAI credits upon subscription.

  • Advanced Tier - $10 Subscription

    Get $30 worth of OpenAI credits upon subscription.

  • Professional Tier - $25 Subscription

    Enjoy $75 worth of OpenAI credits after subscribing to this tier.

Code Examples & Guide

Our API is language agnostic and compatible with any programming language that can make HTTP requests and handle HTTP responses. Below are examples in Python and Javascript for different cases - simple chat prompt, using the vision API, and calling functions using the API. For all codes go to our main endpoints site: Cheapest GPT-4 Turbo & Vision on RapidAPI

Simple Chat Prompt

First, you need to import the requests library. Here’s an example of a simple chat completion using Python. This generates a response to the message “Hello, how is it going?”.

import requests

url = "https://cheapest-gpt-4-turbo-gpt-4-vision-chatgpt-openai-ai-api.p.rapidapi.com/v1```python
/chat/completions"

payload = {
	"messages": [
		{
			"role": "user",
			"content": "Hello, how is it going?"
		}
	],
	"model": "gpt-4-turbo-preview",
	"max_tokens": 200,
	"temperature": 0.9
}
headers = {
	"content-type": "application/json",
	"X-RapidAPI-Key": "YOUR_KEY_HERE",
	"X-RapidAPI-Host": "cheapest-gpt-4-turbo-gpt-4-vision-chatgpt-openai-ai-api.p.rapidapi.com"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

Using the Vision API with JavaScript

For those incorporating vision capabilities, here’s how you can call the API using JavaScript and axios:

const axios = require('axios');

const options = {
  method: 'POST',
  url: 'https://cheapest-gpt-4-turbo-gpt-4-vision-chatgpt-openai-ai-api.p.rapidapi.com/v1/chat/completions',
  headers: {
    'content-type': 'application/json',
    'X-RapidAPI-Key': 'YOUR_KEY_HERE',
    'X-RapidAPI-Host': 'cheapest-gpt-4-turbo-gpt-4-vision-chatgpt-openai-ai-api.p.rapidapi.com'
  },
  data: {
    model: 'gpt-4-vision-preview',
    messages: [
      {
        role: 'user',
        content: [
          {
            type: 'text',
            text: 'What’s in this image?'
          },
          {
            type: 'image_url',
            image_url: {
              url: 'https://example.com/image.jpg'
            }
          }
        ]
      }
    ],
    max_tokens: 300
  }
};

axios.request(options).then(response => {
	console.log(response.data);
}).catch(error => {
	console.error(error);
});

Function Calling Example in Python

To utilize custom functions, here’s an approach in Python for an advanced use case:

import requests

url = "https://cheapest-gpt-4-turbo-gpt-4-vision-chatgpt-openai-ai-api.p.rapidapi.com/v1/chat/completions"

payload = {
	"model": "gpt-4",
	"messages": [
		{
			"role": "user",
			"content": "What is the weather like in Boston?"
		}
	],
	"tools": [
		{
			"type": "function",
			"function": {
				"name": "get_current_weather",
				"description": "Get the current weather in a given location",
				"parameters": {
					"type": "object",
					"properties": {
						"location": {
							"type": "string",
							"description": "The city and state, e.g. San Francisco, CA"
						},
						"unit": {
							"type": "string",
							"enum": ["celsius", "fahrenheit"]
						}
					},
					"required": ["location"]
				}
			}
		}
	],
	"tool_choice": "auto"
}
headers = {
	"content-type": "application/json",
	"X-RapidAPI-Key": "YOUR_KEY_HERE",
	"X-RapidAPI-Host": "cheapest-gpt-4-turbo-gpt-4-vision-chatgpt-openai-ai-api.p.rapidapi.com"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

Conclusion & Tips

To get started, ensure you’ve registered on RapidAPI and subscribed to our API using your choice of tier. Incorporate the appropriate code snippet into your project, replacing "YOUR_KEY_HERE" with your actual RapidAPI Key. Always consider your tier’s credit limit when making calls, to stay within your subscription plan.

Our flexible credit system, combined with affordable tier options, is designed to maximize your ability to explore and integrate advanced AI functionalities into your applications while maintaining cost-effectiveness.

Should you need additional help or have questions, please visit our main API page at Cheapest GPT-4 Turbo & Vision on RapidAPI for more information and support.

Happy coding, and we look forward to seeing what you build with our API!