Before You Start
- API key: To use the API, create a personal API key or ask your workspace admin for a workspace API key with the Completion API scope.
Base URL
Parameters
Request bodies follow the Anthropic “Create a message” endpoint shape, with the following exceptions:
From the
anthropic-beta request header, Langdock forwards only fine-grained-tool-streaming-2025-05-14 and drops other comma-separated values. Bedrock receives the value in the request body as anthropic_beta. Anthropic receives it as the anthropic-beta header. Vertex routes omit it.
Prompt caching
Cache large, stable prompt parts such as system prompts and tool definitions across requests to reduce latency and input token cost. Add acache_control marker with {"type": "ephemeral"} to the last block of the prompt section you want to cache:
cache_controlis supported onsystemtext blocks, ontext,image,tool_use, andtool_resultcontent blocks inmessages, and on tool definitions intools.- The system prompt must use the array of text blocks form. A plain string
systemvalue cannot carry acache_controlmarker. - Only the block-level marker with
{"type": "ephemeral"}is supported. Anthropic’s top-level automatic caching field and TTL options are not supported.
cache_control markers return 400 Bad Request with the resolved route in the error message. Responses report cache activity in usage.cache_creation_input_tokens (tokens written to the cache) and usage.cache_read_input_tokens (tokens read from the cache).
See the Anthropic prompt caching guide for caching strategy, minimum cacheable prompt lengths, and model support.
Rate limits
The default limits are 500 RPM (requests per minute) and 150,000 TPM (tokens per minute).- RPM is enforced per workspace, model, and API key.
- TPM is shared by all API keys using the same model in a workspace.
- On Langdock Cloud, admins can set TPM for custom models in Settings > Workspace > Products > API; it caps the estimated size of a single request.
- On dedicated deployments, admins can configure custom limits per model in Settings > Workspace > Products > API.
429 Too Many Requests response.
Streaming requests (stream: true) stay open with keep-alive bytes while the model is slow to respond. If a non-streaming request does not complete within 105 seconds, you will receive 504 Gateway Timeout with {"message": "The model did not respond in time. Please retry."}.
Using Anthropic-compatible libraries
You can use popular libraries like the Anthropic Python library or the Vercel AI SDK against this endpoint. Send request bodies that match the Parameters section.Example using the Anthropic Python library
Example using the Vercel AI SDK in Node.js
Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on API Key Best Practices.