Website
  1. API integration explanation
  • Start
    • Product Intrduction
    • Quick to use
    • Using Nexhina in AI Coding Tools
  • API integration explanation
    • HTTP Status Codes
    • Getting an API Key
    • Authentication
    • Quick Start
    • Streaming Output Guide
    • Request URL
  • API Endpoints
    • Chat
      • Chat Completion
    • Models
      • List Available Models
    • Responses
      • Responses API
    • Embeddings
      • Text Embedding
    • Images
      • Generate Image
    • Audio
      • Text-to-Speech (TTS)
      • Speech-to-Text (STT)
      • Audio Translation
    • Video
      • Generate Video
    • Moderation
      • Content Moderation
    • Rerank
      • Rerank
  • Platform-related
    • Platform agreement
    • Privacy Policy
    • General Questions
  • Schemas
    • ChatRequest
    • Log
    • ChatMessage
    • ToolCall
    • User
    • FunctionDefinition
    • Channel
    • ToolDefinition
    • Token
    • ChatCompletionRequest
    • Redemption
    • ChatCompletionChoice
    • ChatCompletionResponse
    • ChatCompletionChunk
    • ResponseInputText
    • ResponseRequest
    • ResponseOutputText
    • ResponseOutputMessage
    • ResponseObject
    • EmbeddingRequest
    • EmbeddingData
    • EmbeddingResponse
    • ImageGenerationRequest
    • ImageData
    • ImageUsageInputTokensDetails
    • ImageUsage
    • ImageGenerationResponse
    • SpeechRequest
    • TranscriptionRequest
    • TranslationRequest
    • TranscriptionResponse
    • TranslationResponse
    • VideoGenerationRequest
    • VideoData
    • VideoGenerationResponse
    • ModerationRequest
    • ModerationCategory
    • ModerationResult
    • ModerationResponse
    • RerankRequest
    • RerankResult
    • RerankResponse
  1. API integration explanation

HTTP Status Codes

Status CodeMeaningHandling Suggestion
200SuccessProcess the response normally
400Request parameter errorCheck the request body format and required parameters
401Authentication failedCheck whether the API Key is correct
402Insufficient quotaTop up or switch to a Key with quota
403No permissionThe Key does not have access to this model or interface
404Interface does not existCheck whether the request path is correct
429Request rate limit exceededLower the request rate, or contact the administrator to increase the limit
500Server internal errorRetry later; contact operations if it persists
502Gateway errorUpstream service exception, retry later
503Service unavailableService is temporarily overloaded, retry later

Error Response Format#

All errors follow a unified format:
{
  "error": {
    "message": "Specific error description",
    "type": "Error type",
    "code": "Error code"
  }
}

Common Error Codes#

codeMeaningTrigger Scenario
invalid_api_keyInvalid API KeyKey is incorrect, deleted, or disabled
insufficient_quotaInsufficient quotaKey balance is exhausted
model_not_foundModel does not existAn invalid model parameter was passed
context_length_exceededInput too longThe total length of messages exceeds the model's context window
rate_limit_exceededRate limit exceededToo many requests in a short period
invalid_request_errorRequest format errorMissing required parameters, incorrect types, etc.
server_errorServer errorInternal exception, usually recoverable by retry

Retry Recommendations#

429 / 500 / 502 / 503: Retriable. We recommend exponential backoff (1s → 2s → 4s → 8s)
400 / 401 / 402 / 403 / 404: Do not retry. Fix the request first
Retry the same request no more than 3 times
Modified at 2026-06-30 09:30:24
Previous
Using Nexhina in AI Coding Tools
Next
Getting an API Key
Built with