الانتقال إلى المحتوى الرئيسي

نظرة عامة

تكشف LemonData عن عدة صيغ API حتى تتمكن أدوات الترميز الشائعة وSDKs والأطر من التكامل مع أقل قدر ممكن من كود الربط. تُعد هذه الصفحة أضيق نطاقًا من مصفوفة تسويقية عن قصد:
  • Supported تعني أننا نوثق مسار إعداد ملموس وتكشف LemonData عن شكل البروتوكول الذي يتوقعه ذلك المسار.
  • Strong native path تعني أن المستودع يحتوي أيضًا على أداة موائمة مباشرة أو دليل على شكل الطلب لتلك عائلة البروتوكول.
  • Best-effort تعني أن التكامل يمكن أن يعمل، لكن العميل upstream لا يعامل سير عمل بوابة مخصصة هذا كعقد مستقر.
لا تتم معالجة الحقول غير المدعومة بشكل موحد. على مسارات التوافق، يتم تجاهل بعض الحقول أو تطبيعها. على /v1/responses، يمكن أن تُرجع الحقول غير المدعومة أخطاء 400 أو 503 صريحة عندما لا تستطيع تلك المسار ضمان السلوك المطلوب.

صيغ API المدعومة

EndpointFormatUse Case
/v1/chat/completionsOpenAI ChatUniversal compatibility
/v1/responsesOpenAI ResponsesStateful conversations
/v1/messagesAnthropic MessagesClaude native features
/v1beta/models/:model:generateContentGoogle GeminiGemini native features

التوافق مع IDE و CLI

مسارات الأدوات الموثقة

ToolSupport LevelFormatNotes
CursorSupported with limitsOpenAI-compatibleWorks for BYOK standard chat/editor flows, not as a replacement for Cursor-managed features like Tab Completion
Claude Code CLIStrong native pathAnthropicNative /v1/messages route with adapter coverage for thinking and tool_choice
Codex CLISupported with model/path limitsOpenAI ResponsesTreat /v1/responses as an advanced path for Codex-specific workflows; some Responses-only fields are not guaranteed across every model and routed path
Gemini CLIBest-effort / experimentalGeminiCustom LemonData base URL flow is not a stable upstream contract
OpenCodeSupportedOpenAI-compatibleUse an OpenAI-compatible provider by default; move to a Responses-based provider only when you explicitly need it
غالبًا ما تعمل محررات ووكلاء متوافقة مع OpenAI بنفس نمط عنوان base URL، لكن هذا المستودع لا يحتفظ حاليًا بتغطية توافق انحدار خاصة بالأدوات لـ Windsurf وAider وContinue.dev وCline/Roo Code وGitHub Copilot والعملاء المماثلين.

أمثلة التكوين

Base URL: https://api.lemondata.cc/v1
API Key: sk-your-lemondata-key
يستخدم Cursor داخليًا تنسيق أدوات على طريقة Anthropic. تدعم LemonData كلا التنسيقين:
  • OpenAI format: { type: "function", function: { name, parameters } }
  • Anthropic format: { name, input_schema } (بدون حقل type)

توافق SDK

مسارات SDKs والأطر الموثقة

SDK / FrameworkLanguageSupport LevelNotes
OpenAI SDKPython/JS/GoSupported core pathChat Completions and Embeddings are the default documented path; some Responses-only fields are not guaranteed across every model and routed path
Anthropic SDKPython/JSStrong native pathNative Messages route with direct evidence for tools, thinking, and prompt caching
Vercel AI SDKTypeScriptRecommended integration patternPrefer @ai-sdk/openai-compatible; use @ai-sdk/openai only when you explicitly want Responses-native behavior
LangChainPython/JSSupported standard surfacesChatOpenAI and OpenAIEmbeddings are the intended scope; vendor-native extras are out of scope
LlamaIndexPythonSupported via OpenAILikeUse OpenAILike, not the built-in OpenAI classes, for third-party gateways such as LemonData
Dify-Supported with scope limitsOpenAI provider and chat-completions-oriented flows are the intended path; not a fit for Codex-specific Responses or WebSocket behavior

معلمات Chat Completions

المعلمات الأساسية

ParameterTypeDescription
modelstringModel identifier (required)
messagesarrayConversation messages (required)
max_tokensintegerMaximum output tokens
temperaturenumberSampling temperature (0-2)
top_pnumberNucleus sampling (0-1)
streambooleanEnable streaming

استدعاء الأدوات

{
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get weather for a location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": { "type": "string" }
          }
        },
        "strict": true
      }
    }
  ],
  "tool_choice": "auto",
  "parallel_tool_calls": true
}

خيارات Tool Choice

FormatExampleDescription
String"auto", "none", "required"Simple selection
OpenAI Object{ "type": "function", "function": { "name": "fn" } }Force specific function
Anthropic Object{ "type": "tool", "name": "fn", "disable_parallel_tool_use": true }Anthropic native format

المعلمات المتقدمة

ParameterTypeDescription
stream_optionsobject{ include_usage: true } for token counts
reasoning_effortstring"low", "medium", "high" for reasoning-enabled GPT-5 models
service_tierstring"auto" or "default"
seedintegerDeterministic outputs
logprobsbooleanReturn log probabilities
top_logprobsintegerNumber of top logprobs (0-20)
logit_biasobjectToken bias map (-100 to 100)
frequency_penaltynumberRepetition penalty (-2 to 2)
presence_penaltynumberTopic penalty (-2 to 2)
stopstring/arrayStop sequences
nintegerNumber of completions (1-128)
userstringUser identifier for tracking

ميزات OpenAI المتقدمة

ParameterTypeDescription
modalitiesarray["text", "audio"] for multimodal
audioobjectAudio output config (voice, format)
predictionobjectPredicted output for faster completion
metadataobjectKey-value pairs for tracking
storebooleanStore for later retrieval

خيارات خاصة بالمزود

{
  "anthropic_options": {
    "thinking": {
      "type": "enabled",
      "budget_tokens": 10000
    },
    "prompt_caching": true
  },
  "google_options": {
    "safety_settings": [...],
    "google_search": true,
    "code_execution": true
  }
}

معلمات Anthropic Messages

المعلمات الأساسية

ParameterTypeDescription
modelstringModel identifier
messagesarrayConversation messages
max_tokensintegerMaximum output (up to 128000)
systemstring/arraySystem prompt
streambooleanEnable streaming

استدعاء الأدوات

{
  "tools": [
    {
      "name": "get_weather",
      "description": "Get weather",
      "input_schema": {
        "type": "object",
        "properties": {
          "location": { "type": "string" }
        }
      }
    }
  ],
  "tool_choice": {
    "type": "auto",
    "disable_parallel_tool_use": false
  }
}

التفكير الموسع

{
  "model": "claude-opus-4-6",
  "thinking": {
    "type": "enabled",
    "budget_tokens": 10000
  }
}

معلمات Responses API

المعلمات الأساسية

ParameterTypeDescription
modelstringModel identifier
inputstring/arrayInput content
instructionsstringSystem instructions
max_output_tokensintegerMaximum output tokens
previous_response_idstringContinue conversation

المعلمات المتقدمة

ParameterTypeDescription
truncation_strategystring"auto" or "disabled"
includearray["reasoning.encrypted_content"]
reasoning_effortstringFor reasoning models
service_tierstringPriority tier

تنسيق الأدوات

يدعم كلا من تنسيقات أدوات OpenAI وAnthropic:
// OpenAI format
{ "type": "function", "name": "fn", "parameters": {...} }

// Anthropic format (Cursor compatibility)
{ "name": "fn", "input_schema": {...} }

معلمات Gemini API

المعلمات الأساسية

ParameterTypeDescription
contentsarrayConversation content
systemInstructionobjectSystem prompt
generationConfigobjectGeneration settings

الأدوات

{
  "tools": [{
    "functionDeclarations": [{
      "name": "search",
      "description": "Search the web",
      "parameters": {...}
    }],
    "codeExecution": {},
    "googleSearch": {}
  }],
  "toolConfig": {
    "functionCallingConfig": {
      "mode": "AUTO"
    }
  }
}

إعدادات السلامة

{
  "safetySettings": [
    {
      "category": "HARM_CATEGORY_HARASSMENT",
      "threshold": "BLOCK_MEDIUM_AND_ABOVE"
    }
  ]
}

معلمات إضافية

ParameterTypeDescription
cachedContentstringCached content reference
responseMimeTypestring"text/plain" or "application/json"
responseSchemaobjectJSON schema for structured output

البث (Streaming)

تدعم جميع نقاط النهاية بث Server-Sent Events (SSE):
# Chat Completions
curl https://api.lemondata.cc/v1/chat/completions \
  -H "Authorization: Bearer sk-xxx" \
  -d '{"model": "gpt-4o", "messages": [...], "stream": true}'

# With usage tracking
-d '{"...", "stream_options": {"include_usage": true}}'

التعامل مع الأخطاء

تعيد LemonData استجابات أخطاء متوافقة مع OpenAI:
{
  "error": {
    "message": "Invalid API key",
    "type": "invalid_api_key",
    "code": "invalid_api_key"
  }
}
انظر Error Handling Guide للتفاصيل.

أفضل الممارسات

تستخدم كل المخططات .passthrough() - يتم تمرير المعلمات غير المعروفة إلى المزودين upstream.
فعّل stream_options.include_usage للحصول على عدّ دقيق للـ tokens في الاستجابات المتدفقة.
طابق التنسيق المتوقع في SDK الخاص بك. تقبل LemonData كلا من تنسيقات OpenAI وAnthropic.