مرجع API
این صفحه مستقیماً از قرارداد OpenAPI ساخته میشود؛ با هر تغییر در قرارداد بهروزرسانی میشود.
مرجع API
POST/anthropic/v1/messagesAnthropic compatibility
Create an Anthropic-compatible message
احراز هویت: x-api-key: …
مشاهدهٔ راهنمای سازگاری با OpenAI و Anthropic
پارامترها
| نام | محل | الزام | نوع | توضیح |
|---|---|---|---|---|
| anthropic-version | header | الزامی | string | — |
| anthropic-beta | header | اختیاری | string | Accepted only when the selected model/protocol contract advertises that beta. |
| X-Correlation-ID | header | اختیاری | string | Optional safe correlation value. Content-derived values are rejected. |
پارامترهای بدنه
| نام | الزام | نوع | توضیح |
|---|---|---|---|
| model | الزامی | string | — |
| max_tokens | الزامی | integer | — |
| messages | الزامی | array<object> | — |
| system | اختیاری | oneOf[2] | — |
| stream | اختیاری | boolean | — |
| temperature | اختیاری | number | — |
| top_k | اختیاری | integer | — |
| top_p | اختیاری | number | — |
| stop_sequences | اختیاری | array<string> | — |
| tools | اختیاری | array<object> | — |
| tool_choice | اختیاری | oneOf[2] | — |
| thinking | اختیاری | oneOf[3] | — |
| cache_control | اختیاری | oneOf[2] | — |
| container | اختیاری | string | null | — |
| inference_geo | اختیاری | string | null | — |
| output_config | اختیاری | object | — |
| service_tier | اختیاری | enum(auto | standard_only) | — |
| metadata | اختیاری | object | — |
پاسخها
| کد | توضیح | نوع محتوا |
|---|---|---|
| 200 | Native Anthropic-compatible JSON response or ordered SSE event stream. | application/json, text/event-stream |
| 400 | Native Anthropic-compatible error envelope; overloaded errors use HTTP 529. | application/json |
| 401 | Native Anthropic-compatible error envelope; overloaded errors use HTTP 529. | application/json |
| 402 | Native Anthropic-compatible billing error envelope. | application/json |
| 403 | Native Anthropic-compatible error envelope; overloaded errors use HTTP 529. | application/json |
| 404 | Native Anthropic-compatible error envelope; overloaded errors use HTTP 529. | application/json |
| 409 | Native Anthropic-compatible conflict error envelope. | application/json |
| 422 | Native Anthropic-compatible error envelope; overloaded errors use HTTP 529. | application/json |
| 429 | Native Anthropic-compatible error envelope; overloaded errors use HTTP 529. | application/json |
| 500 | Native Anthropic-compatible error envelope; overloaded errors use HTTP 529. | application/json |
| 502 | Native Anthropic-compatible error envelope; overloaded errors use HTTP 529. | application/json |
| 503 | Native Anthropic-compatible error envelope; overloaded errors use HTTP 529. | application/json |
| 504 | Native Anthropic-compatible gateway timeout error envelope. | application/json |
| 529 | Native Anthropic-compatible error envelope; overloaded errors use HTTP 529. | application/json |
رفتار استریم
- قالببندی
- anthropic-native-sse
- تلاش دوباره پیش از اولین بایت
- exact-same-model-only
- تلاش دوباره پس از اولین بایت
- forbidden
- ثبت محتوا
- forbidden
POST/v1/chat/completionsOpenAI compatibility
Create an OpenAI-compatible chat completion
احراز هویت: Authorization: Bearer …
مشاهدهٔ راهنمای سازگاری با OpenAI و Anthropic
پارامترها
| نام | محل | الزام | نوع | توضیح |
|---|---|---|---|---|
| X-Correlation-ID | header | اختیاری | string | Optional safe correlation value. Content-derived values are rejected. |
پارامترهای بدنه
| نام | الزام | نوع | توضیح |
|---|---|---|---|
| model | الزامی | string | — |
| messages | الزامی | array<oneOf[5]> | — |
| stream | اختیاری | boolean | — |
| stream_options | اختیاری | object | — |
| max_completion_tokens | اختیاری | integer | — |
| max_tokens | اختیاری | integer | Legacy spelling of `max_completion_tokens`, still sent by the OpenAI SDKs predating the rename and by `@ai-sdk/openai-compatible`. `max_completion_tokens` wins when both are present; exactly one output bound leaves the gateway. |
| temperature | اختیاری | number | null | — |
| top_p | اختیاری | number | null | — |
| frequency_penalty | اختیاری | number | null | — |
| presence_penalty | اختیاری | number | null | — |
| n | اختیاری | integer | — |
| stop | اختیاری | oneOf[3] | — |
| logprobs | اختیاری | boolean | null | — |
| top_logprobs | اختیاری | integer | null | — |
| parallel_tool_calls | اختیاری | boolean | — |
| reasoning_effort | اختیاری | enum(none | minimal | low | medium | high | xhigh | max | ) | — |
| verbosity | اختیاری | enum(low | medium | high | ) | — |
| thinking | اختیاری | object | The thinking on/off switch DeepSeek V4 and Moonshot Kimi take on chat completions, sent by OpenCode (models.dev `toggle`), Cline and Cherry Studio. Only `type` is admitted; it reaches a provider only where a conformance capture verified it (captured 2026-10-20 on DeepSeek and Moonshot), and elsewhere it is `unsupported_capability` naming `thinking`. |
| response_format | اختیاری | oneOf[3] | — |
| service_tier | اختیاری | enum(auto | default | flex | scale | priority | ) | — |
| metadata | اختیاری | object | null | — |
| store | اختیاری | enum(false | ) | Provider-side storage opt-out, accepted because OpenCode and the OpenAI SDKs send `store: false` on every request. The gateway never lets a provider store a completion, so only the opt-out is admitted (`true` is `unsupported_parameter`); it is not a routing parameter and is not forwarded upstream. |
| prompt_cache_key | اختیاری | string | — |
| prompt_cache_options | اختیاری | object | — |
| safety_identifier | اختیاری | string | — |
| tools | اختیاری | array<object> | — |
| tool_choice | اختیاری | oneOf[2] | — |
پاسخها
| کد | توضیح | نوع محتوا |
|---|---|---|
| 200 | Non-streaming JSON response or ordered SSE stream. | application/json, text/event-stream |
| 400 | Malformed request or unsupported parameter. | application/json |
| 401 | Missing, malformed, invalid, revoked, disabled, or expired credential. | application/json |
| 402 | Prepaid available balance is insufficient for a bounded reservation. | application/json |
| 403 | Authenticated key is not allowed to perform the operation. | application/json |
| 404 | Requested model or resource is not publicly available. | application/json |
| 409 | Idempotency, price-version, reservation, or state conflict. | application/json |
| 422 | Valid JSON violates model capability, context, or media constraints. | application/json |
| 429 | RPM, TPM, concurrency, or configured limit exceeded. | application/json |
| 500 | Unexpected safe internal failure. | application/json |
| 502 | Upstream response could not be safely normalized. | application/json |
| 503 | Exact model has no eligible healthy endpoint or maintenance is active. | application/json |
| 504 | Upstream provider exceeded the request timeout budget. | application/json |
رفتار استریم
- قالببندی
- sse
- تلاش دوباره پیش از اولین بایت
- exact-same-model-only
- تلاش دوباره پس از اولین بایت
- forbidden
- ثبت محتوا
- forbidden
POST/v1/images/generationsOpenAI compatibility
Create an image for a model with verified image-generation capability
احراز هویت: Authorization: Bearer …
مشاهدهٔ راهنمای سازگاری با OpenAI و Anthropic
پارامترها
| نام | محل | الزام | نوع | توضیح |
|---|---|---|---|---|
| X-Correlation-ID | header | اختیاری | string | Optional safe correlation value. Content-derived values are rejected. |
پارامترهای بدنه
| نام | الزام | نوع | توضیح |
|---|---|---|---|
| model | الزامی | string | — |
| prompt | الزامی | string | — |
| n | اختیاری | integer | — |
| size | اختیاری | enum(auto | 256x256 | 512x512 | 1024x1024 | 1024x1536 | 1536x1024 | 1792x1024 | 1024x1792) | — |
| quality | اختیاری | enum(auto | low | medium | high | standard | hd) | — |
| background | اختیاری | enum(auto | transparent | opaque) | — |
| output_format | اختیاری | enum(png | jpeg | webp) | — |
| response_format | اختیاری | enum(url | b64_json) | — |
| moderation | اختیاری | enum(low | auto) | — |
| output_compression | اختیاری | integer | — |
| partial_images | اختیاری | integer | — |
| stream | اختیاری | boolean | — |
| style | اختیاری | enum(vivid | natural) | — |
| user | اختیاری | string | — |
پاسخها
| کد | توضیح | نوع محتوا |
|---|---|---|
| 200 | Generated image delivery references or bytes within the temporary delivery policy. | application/json, text/event-stream |
| 400 | Malformed request or unsupported parameter. | application/json |
| 401 | Missing, malformed, invalid, revoked, disabled, or expired credential. | application/json |
| 402 | Prepaid available balance is insufficient for a bounded reservation. | application/json |
| 403 | Authenticated key is not allowed to perform the operation. | application/json |
| 404 | Requested model or resource is not publicly available. | application/json |
| 409 | Idempotency, price-version, reservation, or state conflict. | application/json |
| 422 | Valid JSON violates model capability, context, or media constraints. | application/json |
| 429 | RPM, TPM, concurrency, or configured limit exceeded. | application/json |
| 500 | Unexpected safe internal failure. | application/json |
| 502 | Upstream response could not be safely normalized. | application/json |
| 503 | Exact model has no eligible healthy endpoint or maintenance is active. | application/json |
| 504 | Upstream provider exceeded the request timeout budget. | application/json |
رفتار استریم
- قالببندی
- openai-image-native-sse
- تلاش دوباره پیش از اولین بایت
- exact-same-model-only
- تلاش دوباره پس از اولین بایت
- forbidden
- ثبت محتوا
- forbidden
GET/v1/modelsModels
List currently available and policy-visible models
احراز هویت: Authorization: Bearer …
مشاهدهٔ راهنمای سازگاری با OpenAI و Anthropic
پارامترها
| نام | محل | الزام | نوع | توضیح |
|---|---|---|---|---|
| X-Correlation-ID | header | اختیاری | string | Optional safe correlation value. Content-derived values are rejected. |
پاسخها
| کد | توضیح | نوع محتوا |
|---|---|---|
| 200 | Dynamic model catalog. | application/json |
| 401 | Missing, malformed, invalid, revoked, disabled, or expired credential. | application/json |
| 429 | RPM, TPM, concurrency, or configured limit exceeded. | application/json |
| 500 | Unexpected safe internal failure. | application/json |
| 503 | Exact model has no eligible healthy endpoint or maintenance is active. | application/json |
POST/v1/responsesOpenAI compatibility
Create an OpenAI-compatible response
احراز هویت: Authorization: Bearer …
مشاهدهٔ راهنمای سازگاری با OpenAI و Anthropic
پارامترها
| نام | محل | الزام | نوع | توضیح |
|---|---|---|---|---|
| X-Correlation-ID | header | اختیاری | string | Optional safe correlation value. Content-derived values are rejected. |
پارامترهای بدنه
| نام | الزام | نوع | توضیح |
|---|---|---|---|
| model | الزامی | string | — |
| input | الزامی | oneOf[2] | — |
| instructions | اختیاری | string | — |
| stream | اختیاری | boolean | — |
| stream_options | اختیاری | object | — |
| max_output_tokens | اختیاری | integer | — |
| previous_response_id | اختیاری | string | null | — |
| conversation | اختیاری | oneOf[3] | — |
| reasoning | اختیاری | object | — |
| text | اختیاری | object | — |
| metadata | اختیاری | object | null | — |
| include | اختیاری | array<enum(file_search_call.results | message.input_image.image_url | reasoning.encrypted_content | code_interpreter_call.outputs | web_search_call.action.sources)> | — |
| safety_identifier | اختیاری | string | — |
| prompt_cache_key | اختیاری | string | — |
| prompt_cache_options | اختیاری | object | — |
| parallel_tool_calls | اختیاری | boolean | — |
| service_tier | اختیاری | enum(auto | default | flex | scale | priority | ) | — |
| temperature | اختیاری | number | null | — |
| top_p | اختیاری | number | null | — |
| truncation | اختیاری | enum(auto | disabled | ) | — |
| tools | اختیاری | array<object> | — |
| tool_choice | اختیاری | oneOf[2] | — |
پاسخها
| کد | توضیح | نوع محتوا |
|---|---|---|
| 200 | Non-streaming JSON response or ordered SSE stream. | application/json, text/event-stream |
| 400 | Malformed request or unsupported parameter. | application/json |
| 401 | Missing, malformed, invalid, revoked, disabled, or expired credential. | application/json |
| 402 | Prepaid available balance is insufficient for a bounded reservation. | application/json |
| 403 | Authenticated key is not allowed to perform the operation. | application/json |
| 404 | Requested model or resource is not publicly available. | application/json |
| 409 | Idempotency, price-version, reservation, or state conflict. | application/json |
| 422 | Valid JSON violates model capability, context, or media constraints. | application/json |
| 429 | RPM, TPM, concurrency, or configured limit exceeded. | application/json |
| 500 | Unexpected safe internal failure. | application/json |
| 502 | Upstream response could not be safely normalized. | application/json |
| 503 | Exact model has no eligible healthy endpoint or maintenance is active. | application/json |
| 504 | Upstream provider exceeded the request timeout budget. | application/json |
رفتار استریم
- قالببندی
- sse
- تلاش دوباره پیش از اولین بایت
- exact-same-model-only
- تلاش دوباره پس از اولین بایت
- forbidden
- ثبت محتوا
- forbidden
نمونهٔ درخواست
curl "https://gateway.dothoosh.com/v1/chat/completions" \
-H "Authorization: Bearer $DOTHOOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL",
"messages": [
{ "role": "system", "content": "پاسخ کوتاه بده." },
{ "role": "user", "content": "تهران کجاست؟" }
]
}'سرآیندها
- احراز هویت
- Authorization: Bearer …
- Content-Type
- application/json
- X-Correlation-ID
- اختیاری
محدودیتها
- api_key_rpm_exceeded
- سقف درخواست در دقیقه تکمیل است
- api_key_tpm_exceeded
- سقف توکن در دقیقه تکمیل است
- api_key_concurrency_exceeded
- سقف درخواست همزمان تکمیل است
- api_key_or_account_spend_limit
- سقف هزینهٔ کلید یا حساب رد شد