跳转到正文
GatewayOpenAPI

Create an Anthropic-compatible message

POST/api/gateway/v1/messages

Anthropic Messages-compatible input/output for supported providers. Common fields are documented, not a full provider validator. Provider capabilities, required fields, limits, response details and supported parameters vary; host overrides may supply request fields. Cloud routing: model identifies a route returned by GET /models; x-sine-route-id overrides route selection. Check the route's operations and billing_mode first. JSON bodies are limited to 1 MiB; supported multipart uploads are limited to 32 MiB, 128 fields and 65,536 characters per text field. Managed text-token pricing supports chat.completions only; other managed operations require an explicit operation price. Media execution requires a single target with automatic retry/fallback disabled. Idempotency-Key is optional and scoped to this organization and API key identity. Repeating an admitted key returns HTTP 409, never a cached success response or a replay of the provider call. invocationAlreadyExists means the stored input matches; idempotencyConflict means the key was used for different input. Preserve the same project, route and request when recovering. Capture x-sine-invocation-id; if x-sine-task-id or task is returned, retrieve the existing task. Otherwise inspect the invocation in the Console. A timeout, disconnected stream, unknown or expired task is not proof of failure; do not issue a new paid invocation until its outcome is resolved. Aborting HTTP does not cancel remote work.

组织 API Key 鉴权

Authorization: Bearer $SINECLOUD_API_KEY

所需权限: modelInvoke

参数

anthropic-version · header · 可选
Optional provider protocol version; host/provider configuration may override it.
anthropic-beta · header · 可选
Optional provider beta features; support depends on host/provider configuration.
x-sine-project-id · header · 可选
Select an organization project. A project-restricted key defaults to its bound project and cannot select another project. The projectId query parameter takes precedence.
projectId · query · 可选
Optional project selection; takes precedence over x-sine-project-id and must respect the key restriction.
x-sine-route-id · header · 可选
Optional Cloud route override; otherwise the request model selects the route. Use a route visible to this key.
Idempotency-Key · header · 可选
Use a stable key for one intended invocation. Reuse returns 409 and does not replay or return a cached success. Without a key, each request can admit new paid work.

请求体

必填

A JSON object is required; arrays, primitives and malformed JSON are rejected.

application/json

响应

200
Successful response. Provider-specific fields may be present.
400
Invalid request, project identifier, unsupported model parameters or operation configuration.
401
Missing, expired, revoked or invalid organization Bearer API key.
402
Organization billing, managed budget or available credits do not permit a new invocation.
403
The key scope, project restriction, route policy, current membership or product entitlement denies access.
404
The project, route or authorized task was not found.
409
invocationAlreadyExists, idempotencyConflict, or managedModelChanged. Recover the original invocation/task; reload model configuration for managedModelChanged.
413
Body exceeds the Cloud limit: 1 MiB JSON or 32 MiB multipart.
415
Use the request media type documented for this operation.
429
Rate or concurrency limit reached. Honor Retry-After when returned.
500
Sanitized Cloud or Gateway failure.
502
Sanitized upstream failure or invalid native media response.
503
Gateway or durable task execution is unavailable. Restore the required service before continuing.
default
Other provider/host status. Provider errors below 500 may retain native shapes; internal/upstream errors at 500 or above are sanitized by the gateway.

正在加载 API 参考文档…

Gateway · 接入与鉴权

基础 URLhttps://sinecloud.dev/api/gateway/v1

首次调用前

在控制台选择组织、准备资源,并创建具有所需产品权限范围的组织 API Key。每次调用都会检查当前权限、资源访问权限、预算和可用资金。

从模型目录选择可用路由,并将其 ID 用作 model。接口目录涵盖模型发现、聊天补全、Responses、Messages、嵌入、图像、音频、生成和持久化任务生命周期。请使用对应原生协议,保留 JSON、SSE 流式、multipart 及二进制请求与响应格式,在控制台核对当前模型权限、支持的操作和计费。

查询路由需要 modelRead,推理和任务操作需要 modelInvoke。每次请求都会检查项目限制和路由策略。托管路由需要可用资金与预算,自备密钥路由使用组织的供应商凭据。请保留原始任务 ID,并在重试结果不明确的调用前查询持久化状态。

组织密钥鉴权与基础 URL

产品 API 的生产源地址是 https://sinecloud.dev,不是文档站点。路径前缀为 /api/gateway/v1。请使用接口注明的完整路径,并将资源 ID、模型与端点版本替换为实际值。

Authorization: Bearer $SINECLOUD_API_KEY

将 SINECLOUD_API_KEY 设置为你自己的环境变量值,切勿使用平台服务凭据。各接口的 x-sinecloud-scopes 会注明所需的权限范围。

此文档为只读参考,请在控制台或自己的客户端中发起请求。浏览文档不会创建密钥、启动执行或产生执行费用。请保留请求 ID 和执行回执;连接中断不会取消任务,再次提交前请按接口说明恢复并确认状态。

控制台

输入关键词开始搜索…

↑↓ 移动↵ 选择Esc 关闭