{"openapi":"3.1.0","info":{"title":"AICredits API","description":"Unified LLM API gateway. OpenAI-compatible endpoint for 300+ models including GPT-4o, Claude, Gemini, DeepSeek, and Mistral. INR billing via Razorpay for Indian developers.","version":"1.0.0","contact":{"email":"chetan@aicredits.in","url":"https://aicredits.in"},"x-logo":{"url":"https://aicredits.in/logos/AiCredits_logo.png"}},"servers":[{"url":"https://api.aicredits.in","description":"Production"}],"security":[{"BearerAuth":[]}],"paths":{"/v1/chat/completions":{"post":{"summary":"Create chat completion","description":"OpenAI-compatible chat completions endpoint. Supports streaming (SSE), tool calling, vision, and all model providers.","operationId":"createChatCompletion","security":[{"APIKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string","description":"Model ID in provider/model-name format (e.g. openai/gpt-4o-mini, anthropic/claude-sonnet-4.5, google/gemini-2.0-flash-001). Short names like gpt-4o also work.","example":"openai/gpt-4o-mini"},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant","tool"]},"content":{"type":"string"}}}},"temperature":{"type":"number","minimum":0,"maximum":2},"max_tokens":{"type":"integer"},"stream":{"type":"boolean","default":false},"tools":{"type":"array"},"response_format":{"type":"object"}}}}}},"responses":{"200":{"description":"Chat completion response (OpenAI-compatible)"},"402":{"description":"Insufficient credits"},"429":{"description":"Rate limit exceeded"}}}},"/v1/responses":{"post":{"summary":"Create response (Responses API)","description":"OpenAI Responses API endpoint. Used by OpenAI SDK v4.75+, OpenAI Agents SDK, and n8n. Supports all models in the catalog. Note: stateful features (previous_response_id) are not supported.","operationId":"createResponse","security":[{"APIKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","example":"gpt-4o-mini"},"input":{"oneOf":[{"type":"string"},{"type":"array"}],"description":"Text input or array of message objects"},"stream":{"type":"boolean","default":false}}}}}},"responses":{"200":{"description":"Response object (OpenAI Responses format)"},"402":{"description":"Insufficient credits"},"429":{"description":"Rate limit exceeded"}}}},"/v1/messages":{"post":{"summary":"Create message (Anthropic Messages format)","description":"Accepts requests in the Anthropic Messages API format and returns responses in the same format. Works with any model in the catalog — not just Claude. Use the Anthropic SDK or Claude Code with any provider by changing only the base URL.","operationId":"createMessage","security":[{"APIKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","max_tokens","messages"],"properties":{"model":{"type":"string","example":"anthropic/claude-sonnet-4.5"},"max_tokens":{"type":"integer","example":1024},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"type":"string"}}}},"system":{"type":"string"},"stream":{"type":"boolean","default":false}}}}}},"responses":{"200":{"description":"Message response (Anthropic Messages format)"},"402":{"description":"Insufficient credits"},"429":{"description":"Rate limit exceeded"}}}},"/v1/embeddings":{"post":{"summary":"Create embeddings","description":"Generate text embeddings. Supported models: text-embedding-3-small, text-embedding-3-large, text-embedding-ada-002.","operationId":"createEmbeddings","security":[{"APIKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","example":"text-embedding-3-small"},"input":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"encoding_format":{"type":"string","enum":["float","base64"],"default":"float"}}}}}},"responses":{"200":{"description":"Embedding vectors"}}}},"/v1/audio/speech":{"post":{"summary":"Text-to-speech","description":"Generate audio from text using OpenAI TTS models.","operationId":"createSpeech","security":[{"APIKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input","voice"],"properties":{"model":{"type":"string","example":"tts-1"},"input":{"type":"string"},"voice":{"type":"string","enum":["alloy","echo","fable","onyx","nova","shimmer"]},"response_format":{"type":"string","default":"mp3"},"speed":{"type":"number","minimum":0.25,"maximum":4,"default":1}}}}}},"responses":{"200":{"description":"Audio file (mp3 or other format)"}}}},"/v1/audio/transcriptions":{"post":{"summary":"Speech-to-text","description":"Transcribe audio to text using OpenAI Whisper.","operationId":"createTranscription","security":[{"APIKeyAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file","model"],"properties":{"file":{"type":"string","format":"binary"},"model":{"type":"string","example":"whisper-1"},"language":{"type":"string","example":"en"},"response_format":{"type":"string","default":"json"}}}}}},"responses":{"200":{"description":"Transcription text"}}}},"/v1/credits":{"get":{"summary":"Check credit balance","description":"Returns the current INR wallet balance for the API key owner.","operationId":"getCredits","security":[{"APIKeyAuth":[]}],"responses":{"200":{"description":"Balance in INR","content":{"application/json":{"schema":{"type":"object","properties":{"balance":{"type":"number","description":"INR balance"}}}}}}}}},"/v1/models":{"get":{"summary":"List models","description":"Returns all available models in OpenAI-compatible format.","operationId":"listModels","security":[],"responses":{"200":{"description":"List of models","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","example":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"openai/gpt-4o-mini"},"object":{"type":"string","example":"model"},"owned_by":{"type":"string","example":"openai"}}}}}}}}}}}},"/v1/images/generations":{"post":{"summary":"Create image","description":"Generate images using DALL-E 3 and other image models.","operationId":"createImage","security":[{"APIKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"model":{"type":"string","example":"dall-e-3"},"prompt":{"type":"string"},"size":{"type":"string","example":"1024x1024"},"quality":{"type":"string","enum":["standard","hd"]},"n":{"type":"integer","default":1}}}}}},"responses":{"200":{"description":"Generated image URLs"}}}},"/api/auth/signup":{"post":{"summary":"Create account","description":"Register a new user. Only create an account if the user intends to add credits.","operationId":"signup","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password","name"],"properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":8},"name":{"type":"string"}}}}}},"responses":{"200":{"description":"User created, JWT cookie set"}}}},"/api/auth/login":{"post":{"summary":"Login","operationId":"login","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string"},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"JWT token","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"}}}}}}}}},"/api/auth/me":{"get":{"summary":"Get profile and balance","operationId":"getMe","responses":{"200":{"description":"User profile with INR balance","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"balance":{"type":"number","description":"INR balance"},"email":{"type":"string"},"name":{"type":"string"}}}}}}}}}}},"/api/api-keys":{"post":{"summary":"Create API key","operationId":"createApiKey","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"rate_limit":{"type":"integer","default":60,"maximum":60,"description":"Max 60 RPM"},"budget":{"type":"number","default":0,"description":"INR spend limit, 0 = unlimited"}}}}}},"responses":{"200":{"description":"API key (shown only once)","content":{"application/json":{"schema":{"type":"object","properties":{"api_key":{"type":"string","example":"sk-..."}}}}}}}},"get":{"summary":"List API keys","operationId":"listApiKeys","responses":{"200":{"description":"List of API keys"}}}}},"components":{"securitySchemes":{"APIKeyAuth":{"type":"http","scheme":"bearer","description":"API key (sk-...) for /v1/* endpoints"},"BearerAuth":{"type":"http","scheme":"bearer","description":"JWT token for /api/* endpoints"}}}}