API Documentation - Chat, Image & Video Generation - LayerCloud AI
LayerCloud AI docs: authentication, chat, image generation and video generation over the OpenAI-compatible endpoint, model catalogue, client quickstarts.
LayerCloud AI docs: authentication, chat, image generation and video generation over the OpenAI-compatible endpoint, model catalogue, client quickstarts.
Every request goes to one base URL: https://ai.layercloud.org. The OpenAI-compatible paths live under /v1; the Anthropic-compatible path sits on the root so Claude Code works with no extra configuration.
Authentication is the Authorization header with an API key. You create the key in the panel and it is shown once, so keep it in an environment variable rather than in source.
curl https://ai.layercloud.org/v1/models \
-H "Authorization: Bearer $LAYERCLOUD_API_KEY"Four paths cover the gateway. Everything else - streaming, tools, structured output, reasoning effort - is a parameter on these.
| POST /v1/chat/completions | Chat over the OpenAI protocol; supports stream, tools and response_format |
|---|---|
| POST /v1/messages | Chat over the Anthropic protocol; the path Claude Code calls |
| GET /v1/models | Live models with their exact ids and context windows |
| POST /v1/embeddings | Text to vectors for search and retrieval |
Send one plain request before you configure an editor. If the response carries choices, the key and the model id are right and anything left is client configuration.
curl https://ai.layercloud.org/v1/chat/completions \
-H "Authorization: Bearer $LAYERCLOUD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek/deepseek-v4.1-flash","messages":[{"role":"user","content":"hi"}]}'Any client that accepts a custom base URL works without code changes. Three common ones:
Read the model list from /v1/models at runtime, because models are added and retired. The pricing page shows the same catalogue with input and output price per million tokens and is the authority for billing.
Billing is per token. A request rejected for a client error (400 or 401) is not charged; only a successful response with its token usage is. Create one token per device or project to see spend per project.
Errors use the standard OpenAI shape and carry a message in the error field.
| 401 | Key invalid, revoked, or missing from the header |
|---|---|
| 404 | Unknown model id, or the wrong path was called |
| 400 | The body does not match the schema - usually a field name or message type |
| 429 | Token quota or rate limit; wait or raise the token quota |
| 499 | The client closed the connection before the response finished |
The status page is readable without an account. If you hit something this page does not explain, send the request id and the exact time from the contact page.