Skip to main content
Creates a model response for the given chat conversation. This endpoint follows the OpenAI API specification. Requests are routed to the OpenAI or Azure OpenAI deployment configured for the model in your workspace. For Codex and other clients that use the Responses format, see OpenAI Responses.

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

Dedicated deploymentsReplace api.langdock.com with <your-deployment-url>/api/public in all requests.

Parameters

All parameters from the OpenAI Chat Completion endpoint are supported according to the OpenAI specifications, with the following exceptions:

Prompt caching

Prompt caching is automatic for eligible requests. When a request shares a sufficiently long prefix with a recent request on the same model, the provider reuses the cached prefix. You do not need to add any fields to your request. Top-level OpenAI cache controls such as prompt_cache_key and prompt_cache_options are not supported and are removed from the request during parsing. Non-streaming responses report cached tokens in usage.prompt_tokens_details.cached_tokens. See the OpenAI prompt caching guide for eligibility, minimum prefix lengths, and caching behavior.

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.
If you exceed your rate limit, you will receive a 429 Too Many Requests response.

Using OpenAI-compatible libraries

As the request and response format is the same as the OpenAI API, you can use popular libraries like the OpenAI Python library or the Vercel AI SDK to use the Langdock API.

Example using the OpenAI 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.