Skip to main content
We have implemented the following endpoints to be compatible with the OpenAI API, allowing you to use amber as a drop-in replacement for OpenAI’s API. This means you can use amber in applications that are designed to work with OpenAI’s API without any modifications. Upon successful integration, you will also be able to use our custom tools, such as amberSearch and webSearch, to enhance your application’s capabilities. The base URL for the API is:
Let’s start with the endpoints that we support, the authentication method, and how to use the chat completion endpoint with our tools and agents.

Supported Endpoints

  • GET /models
  • GET /models/
  • POST /chat/completions
  • GET /credits
Other endpoints that are not listed here are not supported at the moment. The remaining OpenAI endpoints for models and chat completions (DELETE /models/{model}, GET /chat/completions, GET, POST and DELETE /chat/completions/{completion_id} and GET /chat/completions/{completion_id}/messages) exist, but they are not functional and return 405 Endpoint not supported. if you try to use them.
In addition to the endpoints above, which run through the amber AI pipeline, we provide a plain OpenAI-compatible API at https://customerDomain.ambersearch.de/api/beta/openai/v1 with GET /models, POST /chat/completions and GET /credits. It forwards your request to the model as is, without amber tools, agents or files. See Create chat completion (OpenAI format) and List models (OpenAI format).

Authentication

Authorization for the endpoints is the same as other Endpoints. You need to provide an API key (or an OAuth2 client access token) in the Authorization header of your request, prefixed with Bearer . Regular amber web app session tokens are not accepted by these endpoints.
API access requires a paid plan: requests from tenants on a free trial (or with an expired license plan) are rejected with 403.

Models

Model endpoints are for getting the model identifiers, which are needed to create chat completions. Each model has a unique identifier, and you can retrieve the list of available models or details about a specific model using the following endpoints:
  • GET /models to list all available models.
  • GET /models/{model} to get details about a specific model.
Only the models that are activated for your user are returned. Requesting any other model returns 404. Each model has a pricing object with its price in credits per 1 million tokens: input, output and cached_input (null if the model has no cache price). These are the base prices; for some models, prompts above 200k tokens cost more. pricing is null if no price is known for a model.

Usage and credits

Every chat completion reports what it used in its usage object: the tokens and the credits the request costs. A single request can make several model calls (for example when the model uses amberSearch), and usage covers all of them.
credits is computed from the token counts and the model prices. To see how many credits you have left, call GET /credits:
  • remaining: the credits you can still spend through the API in the current period, i.e. the lower of your company’s remaining API credits and what is left of your personal limit. Once it reaches 0, chat completions return 429 (insufficient_quota).
  • used: the credits you used this calendar month (API and premium models in amber).
  • personal_limit: your monthly credits limit set by your admin, or null if you have none.
  • api_access: whether your company allows API usage. If false, remaining is 0.
  • period_start / period_end: the current credits period (UTC), or null if your company has no credits.

Chat Completions

The chat completions endpoint is used to generate responses based on a given set of messages. For getting chat completions, you can specify the model you want to use, the messages that form the conversation, and various parameters to control the generation process. It mirrors the same flow that would happen if similar inputs (messages, tools, model) were provided via the amber frontend. Let’s take a look at the endpoints:

Create Chat Completion

The endpoint for creating chat completions is:
We only support the following parameters in the request body:
  • messages: list (required)
  • model: str (required)
  • stream: bool (default false)
  • temperature: float (default 1.0)
  • metadata: dict (default {})
  • tools: list (default [])

Messages

We follow the same structure as OpenAI for the messages parameter, which is a list of message objects. Each message object should have a role and content. The roles can be one of the following:
  • system
  • user
  • assistant
Messages with any other role (for example developer) are ignored, so use system for instructions. The content can be a string or a list of text parts ({"type": "text", "text": "..."}), which are joined into one text. Image parts are not supported on this endpoint and are rejected with 422. At least one user or assistant message is required, otherwise the request fails with 400 (see Errors for streaming requests).

Response

Without streaming, the endpoint returns a chat.completion object. The answer is in choices[0].message.content. If the answer cites sources (e.g. from amberSearch or webSearch), the citations are written into the text as ([title](url)) and listed as url_citation entries in choices[0].message.annotations. The usage object contains the tokens and credits of the request (see Usage and credits). With "stream": true, the endpoint returns server-sent events. Each event is a data: line containing a chat.completion.chunk object; the stream may also contain SSE comment lines (: ping - ...) as keep-alives, which SSE clients ignore. The first chunk’s delta contains "role": "assistant", and the following chunks contain the next piece of text in delta.content (plus delta.annotations if that piece contains citations). In a streamed annotation, start_index and end_index refer to the content of the same chunk, not to the whole message. The stream ends with a chunk whose delta is empty and whose finish_reason is "stop". Only this last chunk has a usage object with the tokens and credits of the whole request. No data: [DONE] message is sent; the stream is simply closed.

Errors

  • 400 if webSearch is requested but web search is not available for your account, if web_search_mode is invalid, or if no user/assistant message is given.
  • 403 if AI access is not enabled for your account, or if your tenant is on a free trial or its license plan has expired.
  • 404 if the model or the agent does not exist or is not available to you.
  • 422 if the request body is malformed (e.g. a missing required field or an image content part).
  • 429 with the error code insufficient_quota if your API budget is exhausted.
  • 500 if metadata.agent_id is not a valid UUID, or if the request could not be processed.
With "stream": true, the checks for an invalid web_search_mode and for a missing user/assistant message happen after the stream has started. Instead of a 400, such requests return 200 with an empty event stream. Validate these inputs on your side, or send a non-streaming request to see the error.

Tools

We officially support two tools at the moment: amberSearch and webSearch. If no tool is passed, the model cannot perform any search in external or internal data sources. It can still e.g. give an answer based on its own knowledge only, or process an uploaded file (if it is passed as described below). To specify which tool should be used, simply pass it in the request body as follows:
The model can still decide to not use the tool if not needed for the given request. The tool names amber_search and web_search are accepted as aliases. Tools with unknown names are ignored. The names of other amber tools (deepResearch, outlook, imageGeneration, videoGeneration and canvas) are also accepted and passed to the pipeline, but they are not officially supported via the API and their behaviour may change. If you request webSearch but web search is not enabled for your account, the request fails with 400 Web search tool is not available.

Agents

To create chat completions with an agent, you need to specify the agent ID in the metadata of the request body as follows:
When an agent is used, the request runs with the agent’s configuration:
  • The agent’s model is used instead of the model from the request. The model from the request is still required and must be one of your available models, otherwise the request fails with 404.
  • The agent’s tools replace the tools from the request.
  • The agent’s instructions are added in front of your system messages.
  • The agent’s files are available in addition to the files you pass in metadata.files.
If the agent does not exist or you don’t have access to it, the request fails with 404. The agent_id must be a valid UUID; any other value currently results in 500.

Files

To attach files to the chat completion request, you can use the files parameter in the metadata of the request body as follows:
The value of the files parameter should be a list of file IDs that you have previously received when uploading files to amber via the /api/beta/files/upload endpoint. Instead of plain IDs, you can also pass objects with an id (or file_id) field. File IDs that cannot be found or that you don’t have access to are skipped.

Web search mode

When the webSearch tool is enabled, you can control which search engine it uses for this request via the web_search_mode parameter in the metadata of the request body as follows:
The web_search_mode parameter accepts one of the following values:
  • search - a standard Brave web search that also crawls the resulting pages for their full content.
  • context - Brave’s LLM Context API, which returns content optimized for grounding an LLM response without crawling individual pages.
  • perplexity - the Perplexity Search API.
  • staan_context - the staan.ai search API, returning relevance-scored passages of the resulting pages.
  • staan_full - the staan.ai search API, returning the whole resulting pages as markdown.
If web_search_mode is omitted (or set to an empty string), the tenant’s configured default is used, falling back to search if no default is set. Values are case-insensitive. Any other value is rejected with 400, even if the webSearch tool is not included in tools. Apart from this validation, the parameter has no effect if the webSearch tool is not included.

Language

To specify which language your messages are in, you can use the language parameter in the metadata of the request body as follows:
The default value for the language parameter is de (German). If you don’t specify it, the system will assume that the messages are in German. If you want to use English, you need to explicitly set the language parameter to en. This is mostly relevant for very short user inputs, where the model has to ‘guess’ the language it should respond in.