Api.Airforce
API REFERENCE

सार्वभौमिक पैरामीटर

हेडर, प्रमाणीकरण योजनाएँ, त्रुटि लिफ़ाफ़े और परंपराएँ जो प्रत्येक समापन बिंदु पर लागू होती हैं।

प्रमाणीकरण

सभी समापन बिंदुओं के लिए एयरफोर्स एपीआई कुंजी की आवश्यकता होती है। नीचे डैशबोर्ड में एक जनरेट करें एपीआई कुंजी. कुंजियाँ से प्रारंभ होती हैं sk-air-.

ParameterTypeRequiredDescription
AuthorizationstringRequiredBearer sk-air-YOUR_API_KEY. Accepted on every endpoint.
x-api-keystringOptionalAlternative auth header. Accepted on /v1/messages and /v1/responses for Anthropic SDK compatibility.
anthropic-versionstringOptionalRequired when using /v1/messages with the @anthropic-ai/sdk. Use "2023-06-01".
Content-TypestringOptionalapplication/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"

वैकल्पिक अनुरोध शीर्षलेख

ParameterTypeRequiredDescription
X-Request-IDstringOptionalEchoed in the response. Send your own correlation ID and we forward it through to logs and intercept records.
User-AgentstringOptionalHelpful for debugging. Logged with every request.

प्रतिक्रिया शीर्षलेख

ParameterTypeRequiredDescription
X-Request-IDstringOptionalServer-generated request ID. Quote this when filing a support ticket.
X-Cost-CentsintegerOptionalCost of the request in cents (4 decimals of precision). Present on completed billing-relevant calls.
X-Tokens-Prompt / X-Tokens-CompletionintegerOptionalToken counts for chat / messages calls.
X-Cache-HitstringOptional"5m" / "1h" / "miss" on Anthropic-style cached calls.

तर्क और सोच (क्रॉस-एंडपॉइंट)

के साथ मॉडल supports_reasoning: true हर जगह समान विहित पैरामीटर स्वीकार करें (वर्तमान में)। /v1/chat/completions और /v1/messages).

ParameterTypeRequiredDescription
reasoning_effortstringOptional"low" | "medium" | "high". OpenAI o-series / GPT-5 reasoning models only — has no effect on Claude. Use `thinking_budget` for Anthropic budget control.
thinkingstring | objectOptional"on" / "off" / "auto" for a quick toggle, or { type: "enabled", budget_tokens: N } Anthropic shape. Both forms accepted, both normalised to the upstream's native shape.
thinking_budgetintegerOptionalMaximum tokens spent reasoning before visible output starts. Maps to budget_tokens (Anthropic) and thinking_budget (Gemini).
ignore_defaultsbooleanOptionalBypass 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 और सर्वर-भेजे गए ईवेंट उत्सर्जित करें। तार का प्रारूप समापन बिंदु पर निर्भर करता है:

ParameterTypeRequiredDescription
/v1/chat/completionsOpenAI SSEOptionaldata: {…JSON chunk…}, terminated by data: [DONE].
/v1/messagesAnthropic SSEOptionalNamed events: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop.
/v1/images/generations (sse: true)OpenAI-shape SSEOptionalSingle data: event with the full response, then [DONE]. Useful for long-running image jobs to keep the connection alive.
/v1/video/tasks/:id/streamprogress SSEOptionalPeriodic { progress, status } events for in-flight video tasks. Stream closes once the task is done.

त्रुटि लिफ़ाफ़ा

प्रत्येक त्रुटि प्रतिक्रिया समान JSON आकार का उपयोग करती है। HTTP स्थिति कोड विफलता वर्ग को दर्शाता है।

ParameterTypeRequiredDescription
error.messagestringOptionalHuman-readable message safe to display.
error.typestringOptionalMachine-readable category. See table below.
error.codestringOptionalSpecific identifier when applicable, e.g. "model_not_found".
error.paramstringOptionalField name that failed validation, when relevant.
ParameterTypeRequiredDescription
400invalid_requestOptionalMalformed JSON, unknown field, validation failed.
401authentication_errorOptionalMissing or invalid API key.
403permission_errorOptionalPlan or per-key restriction blocks this request.
404not_foundOptionalUnknown resource (model, task ID, voice ID).
413payload_too_largeOptionalUpload exceeds size limit (200 MB for voice samples, etc.).
429rate_limitOptionalPer-second throttle, daily token cap, or balance exhausted.
500internal_errorOptionalUnexpected. Quote the X-Request-ID when reporting.
503upstream_errorOptionalEvery 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).

Retry with exponential backoff on 429 and 503. Don't retry on 4xx other than 429.


नपुंसकता

जनरेशन एंडपॉइंट (चैट, छवि, ऑडियो, वीडियो) निष्क्रिय नहीं हैं - प्रत्येक कॉल एक ताज़ा प्रतिक्रिया उत्पन्न करती है और स्वतंत्र रूप से बिल की जाती है। नियतात्मक परिणामों के लिए, जहां समर्थित हो वहां एक निश्चित बीज सेट करें (छवि/ऑडियो/कुछ चैट मॉडल)। लंबे समय तक चलने वाले एसिंक एंडपॉइंट (/v1/वीडियो/पीढ़ी) एक टास्क_आईडी लौटाते हैं जिसे आप सुरक्षित रूप से दोबारा मतदान कर सकते हैं।


समापन बिंदु मानचित्र

प्रत्येक सार्वजनिक समापन बिंदु एक नज़र में।

ParameterTypeRequiredDescription
POST /v1/chat/completionschatOptionalOpenAI Chat Completions. See /docs/api/chat.
POST /v1/messageschatOptionalAnthropic Messages. See /docs/api/chat.
POST /v1/responseschatOptionalAnthropic Responses (stateful). See /docs/api/chat.
GET /v1/modelsmodelsOptionalList available models. See /docs/api/models.
POST /v1/images/generationsimageOptionalGenerate / edit images. See /docs/api/media.
POST /v1/audio/speechaudioOptionalText-to-speech. See /docs/api/audio.
POST /v1/audio/musicaudioOptionalMusic generation.
POST /v1/audio/sound-effectsaudioOptionalSFX generation.
POST /v1/audio/transcriptionsaudioOptionalSpeech-to-text.
POST /v1/audio/audio-isolationaudioOptionalVoice isolation / noise removal.
POST /v1/audio/voice-changeraudioOptionalSpeech-to-speech voice conversion.
POST /v1/audio/dubbingaudioOptionalAsync multi-language dubbing.
GET /v1/audio/voicesaudioOptionalCatalog of TTS voices.
POST /v1/voices/clonevoiceOptionalClone a custom voice. See /docs/api/audio#voice-cloning.
GET /v1/voices/libraryvoiceOptionalList your cloned voices.
POST /v1/video/generationsvideoOptionalAsync video generation. See /docs/api/video.
GET /v1/video/tasks/:idvideoOptionalPoll a video task.