OpenAI Compatible API
QuotaAPI provides an OpenAI-compatible API for OpenAI SDKs, Codex CLI, IDE plugins, agent frameworks and server-side integrations.
Base URL
https://quotarouter.ai/v1Authentication:
Authorization: Bearer YOUR_QUOTAAPI_KEYChat Completions
curl https://quotarouter.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_QUOTAAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"messages": [
{ "role": "system", "content": "You are a concise assistant." },
{ "role": "user", "content": "Explain QuotaAPI in one sentence." }
],
"temperature": 0.7,
"max_tokens": 120
}'Responses
curl https://quotarouter.ai/v1/responses \
-H "Authorization: Bearer YOUR_QUOTAAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"input": "Give me a short API connectivity test.",
"max_output_tokens": 120
}'Embeddings
curl https://quotarouter.ai/v1/embeddings \
-H "Authorization: Bearer YOUR_QUOTAAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-large",
"input": "QuotaAPI provides one API entry point for AI applications."
}'Embeddings are useful for retrieval, semantic search, similarity matching and knowledge-base indexing. This endpoint requires an OpenAI / GPT model group, and the request body must include model.
Image generation
curl https://quotarouter.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_QUOTAAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A clean technical dashboard illustration for QuotaAPI.",
"size": "1024x1024",
"response_format": "b64_json"
}'Image generation creates images from text prompts. It requires:
- An API Key bound to an OpenAI / GPT model group.
- Image generation enabled for that group in the console.
- A
gpt-image-*image model, such asgpt-image-2.
If model is omitted, QuotaAPI uses gpt-image-2 as the default image model. Use response_format: "b64_json" when your SDK should receive the image payload directly; URL responses can also be used when supported by the selected model and client.
Image edits
Image edits support multipart uploads:
curl https://quotarouter.ai/v1/images/edits \
-H "Authorization: Bearer YOUR_QUOTAAPI_KEY" \
-F "model=gpt-image-2" \
-F "prompt=Make the background darker and keep the object centered." \
-F "[email protected]" \
-F "size=1024x1024" \
-F "response_format=b64_json"You can also send image URLs in a JSON request:
curl https://quotarouter.ai/v1/images/edits \
-H "Authorization: Bearer YOUR_QUOTAAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "Replace the background with a quiet product studio.",
"images": [
{ "image_url": "https://example.com/input.png" }
],
"size": "1024x1024",
"response_format": "b64_json"
}'Image edits use the same group permission as image generation. If you see Images API is not supported for this platform, the API Key is usually not using an OpenAI / GPT group. If you see Image generation is not enabled for this group, enable image generation for the group in the console.
Models
curl https://quotarouter.ai/v1/models \
-H "Authorization: Bearer YOUR_QUOTAAPI_KEY"The model list depends on account permissions, model groups and console configuration. For production, confirm the model name in the console before putting it in client config.
Parameter notes
| Parameter | Recommendation |
|---|---|
model | Use a model name enabled in the console |
max_tokens | Use for Chat Completions output limits |
max_completion_tokens | Supported by some newer models |
max_output_tokens | Use for Responses output limits |
stream | Set to true when the client supports streaming |
input | Main input field for Responses and Embeddings |
prompt | Text prompt for image generation and image edits |
size | Image size, such as 1024x1024; usage records group image billing by count and size |
response_format | Image endpoints can return b64_json or URL responses depending on model capability |
For reasoning models, an output token limit that is too low may be rejected. Start at 16 or more and raise it for real tasks.
Error handling
QuotaAPI tries to preserve status codes and messages from the model service. Clients should handle:
| Status | Meaning |
|---|---|
400 | Request body, model name or parameters are invalid |
401 | API Key is invalid |
402 | Balance is insufficient |
403 | No permission for the target group, model or image generation capability |
429 | Rate or concurrency limit was reached |
500 | Server-side error, check request records for details |
TIP
For server-side integrations, keep https://quotarouter.ai/v1 and YOUR_QUOTAAPI_KEY in environment variables instead of hard-coding them.
