Skip to main content
The BLACKBOX AI API provides programmatic access to a wide range of advanced generative models. You can integrate this technology into your own applications to power features like conversational chat, automated content creation, image generation, and much more. This documentation will guide you through authenticating, understanding the AI models, and making your first API calls. Get started with just a few lines of code using your preferred programming language or framework.
New to BLACKBOX AI? Check out our Authentication guide to get your API key and start making requests.
BLACKBOX AI uses OpenRouter under the hood for managing the vast models and its request and response schemas are very similar to the OpenAI Chat API, with a few small differences. It normalizes the schema across models and providers.

Quick Start

Get up and running with the BLACKBOX AI API in minutes. The examples below show you how to make your first chat completion request using different approaches.

Using Direct API Calls

You can use our interactive Chat API documentation to explore all available parameters and test requests directly.
import requests

API_KEY = "YOUR_API_KEY"
API_URL = "https://api.blackbox.ai/chat/completions"

headers = {
  "Authorization": f"Bearer {API_KEY}",
  "Content-Type": "application/json"
}

data = {
    "model": "blackboxai/openai/gpt-4",
    "messages": [
        {
            "role": "user",
            "content": "What is async and await in JS?"
        }
    ],
    "temperature": 0.7,
    "max_tokens": 256,
    "stream": False
}

response = requests.post(API_URL, headers=headers, json=data)
print(response.json())

Using OpenAI-Compatible SDKs

Since BLACKBOX AI is compatible with the OpenAI API format, you can use existing OpenAI SDKs by simply changing the base URL:
from openai import OpenAI

client = OpenAI(
  base_url="https://api.blackbox.ai",
  api_key="YOUR_API_KEY",
)

completion = client.chat.completions.create(
  model="blackboxai/openai/gpt-4",
  messages=[
    {
      "role": "user",
      "content": "What is async and await in JS?"
    }
  ]
)

print(completion.choices[0].message.content)

Which Model to Choose?

Through BLACKBOX AI API you have access to a wide range of chat, image and video generation models. For each of these models the user will be charged differently based on the tokens the user uses and size of the model. You can have a look at the list of different models that BLACKBOX AI API supports below:
  • Chat Models: Explore available chat completion models for conversational AI.
  • Image Models: Discover models for generating images from text prompts.
  • Video Models: Learn about video generation capabilities.

Key Features

  • Multiple AI Models: Access to a wide variety of state-of-the-art models including GPT-4, Claude, and more
  • OpenAI Compatibility: Use existing OpenAI SDKs and tools with minimal changes
  • Streaming Support: Real-time response streaming for better user experience
  • Tool Calling: Advanced function calling capabilities for building AI agents
  • Image Generation: Create images from text descriptions
  • Video Generation: Generate videos from prompts

Next Steps

Now that you’ve seen how easy it is to get started, explore these resources to build more advanced applications:

Additional Resources

Have questions? Check out our comprehensive API reference documentation for detailed information about all endpoints, parameters, and response formats.
I