सार्वभौमिक पैरामीटर
हेडर, प्रमाणीकरण योजनाएँ, त्रुटि लिफ़ाफ़े और परंपराएँ जो प्रत्येक समापन बिंदु पर लागू होती हैं।
हर endpoint द्वारा साझा किए गए conventions यहाँ रहते हैं: स्वीकृत authentication headers, एकसमान error envelope, और request तथा response content types कैसे negotiate किए जाते हैं।
किसी एक endpoint के लिए विशिष्ट parameters उस endpoint के अपने पेज पर documented हैं; यह पेज cross-cutting reference है।
प्रमाणीकरण
सभी समापन बिंदुओं के लिए Airforce एपीआई कुंजी की आवश्यकता होती है। नीचे डैशबोर्ड में एक जनरेट करें एपीआई कुंजी. कुंजियाँ से प्रारंभ होती हैं sk-air-.
| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Required | Bearer sk-air-YOUR_API_KEY. Accepted on every endpoint. |
| x-api-key | string | Optional | Alternative auth header. Accepted on /v1/messages and /v1/responses for Anthropic SDK compatibility. |
| anthropic-version | string | Optional | Required when using /v1/messages with the @anthropic-ai/sdk. Use "2023-06-01". |
| Content-Type | string | Optional | application/json for body posts. multipart/form-data for endpoints that accept file uploads (transcriptions, voice cloning, etc.). |
उदाहरण
# Standard
curl https://api.airforce/v1/chat/completions \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
…
# Anthropic SDK style (only on /v1/messages, /v1/responses)
curl https://api.airforce/v1/messages \
-H "x-api-key: sk-air-YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
…
# Multipart upload (file endpoints)
curl https://api.airforce/v1/audio/transcriptions \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-F "[email protected]" \
-F "model=whisper-1"वैकल्पिक अनुरोध शीर्षलेख
| Parameter | Type | Required | Description |
|---|---|---|---|
| User-Agent | string | Optional | Helpful for debugging. Logged with every request. |
प्रतिक्रिया शीर्षलेख
| Parameter | Type | Required | Description |
|---|---|---|---|
| Content-Type | string | Optional | application/json for JSON, text/event-stream for streams, or the media MIME (audio/mpeg, image/png, …) for binary endpoints. |
उपयोग और लागत कस्टम X-* headers के रूप में नहीं लौटाए जाते। Token गणनाएँ /v1/chat/completions और /v1/messages पर रिस्पॉन्स बॉडी के usage ऑब्जेक्ट में वापस आती हैं (Anthropic prompt-cache हिट भी वहीं दिखती हैं, जैसे cache_read_input_tokens)। प्रति-रिक्वेस्ट लागत आपके डैशबोर्ड के usage log में दर्ज होती है, और async मीडिया jobs अपने स्टेटस रिस्पॉन्स में एक cost_cents फ़ील्ड रखते हैं।
तर्क और सोच (क्रॉस-एंडपॉइंट)
Cross-model, not DeepSeek-only: every ID with supports_reasoning: true accepts the same canonical parameters on /v1/chat/completions और /v1/messages. Claude, OpenAI o/GPT-5, Gemini, Qwen, DeepSeek, resellers — same fields; we map per provider.
| Parameter | Type | Required | Description |
|---|---|---|---|
| reasoning_effort | string | Optional | "low" | "medium" | "high" | "xhigh" | "max" — how much the model may reason before answering. Works on every supports_reasoning model. Some upstreams only honour a subset; we map unsupported levels to the nearest served value. |
| thinking | string | object | Optional | "on" / "off" / "auto"; Anthropic-style { type: "enabled", budget_tokens: N }; hybrid { type: "enabled" | "disabled" }. All forms accepted; we normalise to the upstream native shape. |
| thinking_budget | integer | Optional | Maximum tokens the model may spend reasoning before visible output starts. Takes precedence over reasoning_effort when you send both and the upstream exposes a budget. |
| ignore_defaults | boolean | Optional | Bypass your saved per-model defaults for this single request. Useful when a saved default (e.g. thinking on) is overriding the value you sent. |
तर्क समर्थन वाले मॉडल
…· liveदेखना चैट पूर्णता → तर्क पूर्ण उदाहरणों के लिए.
स्ट्रीमिंग सम्मेलन
समापन बिंदु जो स्वीकार करते हैं stream: true के साथ जवाब दें Content-Type: text/event-stream और सर्वर-भेजे गए ईवेंट उत्सर्जित करें। तार का प्रारूप समापन बिंदु पर निर्भर करता है:
| Parameter | Type | Required | Description |
|---|---|---|---|
| /v1/chat/completions | OpenAI SSE | Optional | data: {…JSON chunk…}, terminated by data: [DONE]. |
| /v1/messages | Anthropic SSE | Optional | Named events: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop. |
| /v1/images/generations (sse: true) | OpenAI-shape SSE | Optional | Single data: event with the full response, then [DONE]. Useful for long-running image jobs to keep the connection alive. |
| /v1/video/tasks/:id/stream | progress SSE | Optional | Periodic { progress, status } events for in-flight video tasks. Stream closes once the task is done. |
त्रुटि लिफ़ाफ़ा
प्रत्येक त्रुटि प्रतिक्रिया समान JSON आकार का उपयोग करती है। HTTP स्थिति कोड विफलता वर्ग को दर्शाता है।
| Parameter | Type | Required | Description |
|---|---|---|---|
| error.message | string | Optional | Human-readable message safe to display. |
| error.type | string | Optional | Machine-readable category. See table below. |
| error.code | string | Optional | Specific identifier when applicable, e.g. "model_not_found". |
| error.param | string | Optional | Field name that failed validation, when relevant. |
| Parameter | Type | Required | Description |
|---|---|---|---|
| 400 | invalid_request | Optional | Malformed JSON, unknown field, validation failed. |
| 401 | authentication_error | Optional | Missing or invalid API key. |
| 403 | permission_error | Optional | Plan or per-key restriction blocks this request. |
| 404 | not_found | Optional | Unknown resource (model, task ID, voice ID). |
| 413 | payload_too_large | Optional | Upload exceeds size limit (200 MB for voice samples, etc.). |
| 429 | rate_limit | Optional | Per-second throttle, daily token cap, or balance exhausted. |
| 500 | internal_error | Optional | Unexpected. Quote the X-Request-ID when reporting. |
| 503 | upstream_error | Optional | Every key for the requested provider is failing right now. Retry with a different model or wait. |
{
"error": {
"message": "Model 'gpt-99' not found.",
"type": "invalid_request",
"param": "model",
"code": "model_not_found"
}
}दर सीमा और पुनः प्रयास
एपीआई कुंजी के अनुसार सीमाएं लागू की जाती हैं। उनमें से किसी से अधिक होने पर रिटर्न मिलता है 429:
- Per-second request throttle (plan-dependent).
- Daily token cap on free / pay-as-you-go plans.
- जब आप डैशबोर्ड में सेट करते हैं तो प्रति-कुंजी क्रेडिट सीमा।
- Concurrent video tasks (typically 4 in flight).
- Models requested with the :free suffix (where a free variant exists) skip the per-second request throttle but remain bound by the daily free-tier token cap. See /docs/api/models.
Retry with exponential backoff on 429 and 503. Don't retry on 4xx other than 429.
नपुंसकता
जनरेशन एंडपॉइंट (चैट, छवि, ऑडियो, वीडियो) निष्क्रिय नहीं हैं - प्रत्येक कॉल एक ताज़ा प्रतिक्रिया उत्पन्न करती है और स्वतंत्र रूप से बिल की जाती है। नियतात्मक परिणामों के लिए, जहां समर्थित हो वहां एक निश्चित बीज सेट करें (छवि/ऑडियो/कुछ चैट मॉडल)। लंबे समय तक चलने वाले एसिंक एंडपॉइंट (/v1/वीडियो/पीढ़ी) एक टास्क_आईडी लौटाते हैं जिसे आप सुरक्षित रूप से दोबारा मतदान कर सकते हैं।
समापन बिंदु मानचित्र
प्रत्येक सार्वजनिक समापन बिंदु एक नज़र में।
| Parameter | Type | Required | Description |
|---|---|---|---|
| POST /v1/chat/completions | chat | Optional | OpenAI Chat Completions. See /docs/api/chat. |
| POST /v1/messages | chat | Optional | Anthropic Messages. See /docs/api/chat. |
| POST /v1/responses | chat | Optional | Anthropic Responses (stateful). See /docs/api/chat. |
| GET /v1/models | models | Optional | List available models. See /docs/api/models. |
| POST /v1/images/generations | image | Optional | Generate / edit images. See /docs/api/media. |
| POST /v1/audio/speech | audio | Optional | Text-to-speech. See /docs/api/audio. |
| POST /v1/audio/music | audio | Optional | Music generation. |
| POST /v1/audio/sound-effects | audio | Optional | SFX generation. |
| POST /v1/audio/transcriptions | audio | Optional | Speech-to-text. |
| POST /v1/audio/audio-isolation | audio | Optional | Voice isolation / noise removal. |
| POST /v1/audio/voice-changer | audio | Optional | Speech-to-speech voice conversion. |
| POST /v1/audio/dubbing | audio | Optional | Async multi-language dubbing. |
| GET /v1/audio/voices | audio | Optional | Catalog of TTS voices. |
| POST /v1/voices/clone | voice | Optional | Clone a custom voice. See /docs/api/audio#voice-cloning. |
| GET /v1/voices/library | voice | Optional | List your cloned voices. |
| POST /v1/video/generations | video | Optional | Async video generation. See /docs/api/video. |
| GET /v1/video/tasks/:id | video | Optional | Poll a video task. |