API Reference
Public developer API reference for AICredits endpoints — chat completions, responses, images, audio, embeddings, models, credits, and health checks.
Use this page with an AI assistant
Opens a new chat with this docs URL and the correct AICredits base URLs.
Base URL: https://api.aicredits.in
LLM endpoints use the /v1/ prefix and are OpenAI-compatible. Public platform metadata endpoints use /api/.
Endpoint Matrix
| Area | Method | Path | Auth | Notes |
|---|---|---|---|---|
| Chat | POST | /v1/chat/completions | API key | OpenAI-compatible chat completions, including streaming and tools |
| Responses | POST | /v1/responses | API key | OpenAI-compatible responses endpoint where supported |
| Images | POST | /v1/images/generations | API key | Text-to-image generation |
| Audio | POST | /v1/audio/speech | API key | Text-to-speech generation |
| Audio | POST | /v1/audio/transcriptions | API key | Speech-to-text transcription |
| Embeddings | POST | /v1/embeddings | API key | Vector embeddings |
| Credits | GET | /v1/credits | API key | Current API-key wallet balance |
| Models | GET | /api/models | Public | Public model catalog |
| Health | GET | /health | Public | Basic service health |
| Health | GET | /health/ready | Public | Dependency readiness |
Authentication
All endpoints except GET /api/models and GET /health require a Bearer token:
Authorization: Bearer sk-your-key-hereAPI keys are created in Dashboard → API Keys. Keys follow the format sk-{64 hex chars}.
Dashboard session APIs are intentionally not part of the public developer API contract. Use the dashboard UI for sign-in, wallet top-ups, billing history, and API-key management.
Chat Completions
POST /v1/chat/completions
The core LLM proxy endpoint. OpenAI-compatible — works with any OpenAI SDK.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID, e.g. openai/gpt-4o-mini or anthropic/claude-sonnet-4.6 |
messages | array | Yes | Array of {role, content} objects |
stream | boolean | No | Enable SSE streaming (default: false) |
temperature | number | No | 0–2, controls randomness |
max_tokens | integer | No | Maximum tokens to generate |
response_format | object | No | {"type": "json_object"} for JSON mode |
tools | array | No | Function definitions for tool calling |
tool_choice | string/object | No | "auto", "none", "required", or specific tool |
cache | boolean | No | Enable prompt caching for Claude models |
no_cache | boolean | No | Bypass semantic cache for this request |
from openai import OpenAI
client = OpenAI(
base_url="https://api.aicredits.in/v1",
api_key="sk-your-key-here",
)
response = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.aicredits.in/v1",
apiKey: "sk-your-key-here",
});
const response = await client.chat.completions.create({
model: "openai/gpt-4o-mini",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);curl https://api.aicredits.in/v1/chat/completions \
-H "Authorization: Bearer sk-your-key-here" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [{"role": "user", "content": "Hello!"}]
}'Response:
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1709123456,
"model": "gpt-4o-mini",
"choices": [{
"index": 0,
"message": { "role": "assistant", "content": "Hello! How can I help you?" },
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 19,
"completion_tokens": 9,
"total_tokens": 28
}
}Image Generation
POST /v1/images/generations
Generate images from text prompts. Compatible with the OpenAI Images API.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
model | string | No | dall-e-3 (default) or dall-e-2 |
prompt | string | Yes | Text description (max 4000 chars for DALL-E 3) |
n | integer | No | Number of images (DALL-E 3: max 1) |
size | string | No | 1024x1024, 1792x1024, or 1024x1792 |
quality | string | No | standard or hd |
response_format | string | No | url (default) or b64_json |
curl https://api.aicredits.in/v1/images/generations \
-H "Authorization: Bearer sk-your-key-here" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "A serene view of the Himalayas at sunrise",
"size": "1024x1024"
}'Text-to-Speech
POST /v1/audio/speech
Convert text to speech. Returns raw audio bytes.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | openai/tts-1, openai/tts-1-hd, or sarvam/bulbul-v2 |
input | string | Yes | Text to synthesize (max 4096 chars) |
voice | string | Yes | alloy, echo, fable, onyx, nova, shimmer |
response_format | string | No | mp3 (default), opus, aac, flac |
Transcription
POST /v1/audio/transcriptions
Transcribe audio to text.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | openai/whisper-1 or sarvam/saarika-v2 |
input_audio.data | string | Yes | Base64-encoded audio |
input_audio.format | string | Yes | mp3, wav, m4a, webm, etc. |
language | string | No | ISO-639-1 code, auto-detected if omitted |
Embeddings
POST /v1/embeddings
Generate vector embeddings for text.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | e.g. openai/text-embedding-3-small |
input | string or array | Yes | Text(s) to embed |
curl https://api.aicredits.in/v1/embeddings \
-H "Authorization: Bearer sk-your-key-here" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/text-embedding-3-small",
"input": "The quick brown fox"
}'Models
GET /api/models
List all available models. No authentication required.
curl https://api.aicredits.in/api/modelsResponse:
{
"object": "list",
"data": [
{
"id": "openai/gpt-4o-mini",
"name": "GPT-4o Mini",
"provider": "openai",
"context_window": 128000,
"input_cost_per_1m": 0.15,
"output_cost_per_1m": 0.60
}
]
}Health
GET /health
Returns {"status": "ok"}. No authentication required. Used for uptime monitoring.
GET /health/ready
Returns {"status": "ready", "db": "ok", "redis": "ok"} when all dependencies are healthy.
Error Format
All errors follow the same structure:
{
"error": {
"message": "Human-readable description",
"type": "error_type",
"code": 400
}
}See Error Handling → for the full error code reference and retry guidance.
The credit balance check (GET /v1/credits) returns your current API-key wallet balance in INR with Bearer token authentication.