Build applications using the powerful GPT4BD API. Our API is structurally identical to the official OpenAI API, making migration effortless.
The GPT4BD API uses REST, accepts JSON payloads, and returns JSON responses. It uses standard HTTP response codes to indicate success or errors.
Authenticate your API requests by providing your API key in the Authorization HTTP header.
We abstract the complex OpenAI models into three simple tiers.
| Model Interface ID | Underlying Tech | Cost (Tokens / 1k API Tokens) | Best For |
|---|---|---|---|
Model Air |
gpt-4o-mini | 1 token | Simple tasks, translation, high volume processing |
Model Pro |
gpt-4o | 5 tokens | Complex reasoning, coding, logical tasks |
Model Pro Max |
gpt-4-turbo | 15 tokens | Most capable model, deep analysis, long context |
POST /chat/completions
Creates a model response for the given chat conversation.
{
"model": "Model Pro",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
],
"temperature": 0.7,
"stream": true
}
{
"id": "chatcmpl-DDms4o3CadQWWiZDObf9CnfggRglI",
"object": "chat.completion",
"created": 1772178496,
"model": "Model Pro",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I assist you today?",
"refusal": null,
"annotations": []
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 19,
"completion_tokens": 9,
"total_tokens": 28,
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
},
"service_tier": "default",
"system_fingerprint": "fp_c7d0c94d9d"
}
POST /images/generations
Creates an image given a prompt. Powered by the incredibly advanced DALLĀ·E 3 engine. Note: Image generation bills a fixed cost of 500 tokens per image generated, rather than parsing tokens.
{
"model": "Model Image",
"prompt": "A cute baby sea otter playing with a colorful beach ball",
"n": 1,
"size": "1024x1024"
}
{
"created": 1589478378,
"data": [
{
"revised_prompt": "Create a visual representation of an adorable, playful baby sea otter. It's splashing in the clear, ocean water, where its fur is slightly wet and shimmering under the sun. The sea otter is actively engaged in a game, playfully nudging and splashing a vibrant beach ball which consists of colors such as red, yellow, blue, and white. The fun-filled interaction of the otter with the ball reflects a scene filled with joy, playfulness, and innocence. Overall, the image emanates warmth and gentle humor, evoking a sense of awe-inspiring cuteness overloaded.",
"url": "https://..."
}
]
}
POST /bot
An easy-to-use endpoint designed specifically for chatbots. You provide the business knowledge (instructions, policies, company context) and the user's message. The API automatically builds the system and user prompts, calls the model, and returns a clean, simplified reply.
knowledge parameter must be at least 100 characters long, or the request will be rejected.knowledge data.history array, which is an array of objects containing previous role and content messages.{
"knowledge": "You are a customer service representative for Bengal Electronics. Our return policy allows returns within 30 days for defective items. We only ship our products within Bangladesh.",
"message": "Do you ship to India?",
"history": [
{"role": "user", "content": "Hi there!"},
{"role": "assistant", "content": "Hello! I am a customer service rep for Bengal Electronics. How can I help you today?"}
],
"stream": false
}
{
"success": true,
"reply": "I'm sorry, but we only ship our products within Bangladesh."
}
Standard HTTP response codes indicate whether a request succeeded or failed.