Skip to main content
POST /api/v1/context/search/chat/completions OpenAI-compatible chat completions endpoint that grounds answers in the caller’s private Alchemyst context. It works as a drop-in replacement for /v1/chat/completions from the OpenAI SDK. The default model is Big Bull Alpha, an Alchemyst model. You can also pass any OpenRouter provider/model id and bring your own key. OpenRouter is an implementation detail of the endpoint, not a separate product surface.

Authentication

The endpoint supports two modes: OpenRouter-only callers must send a valid email on their first request. If an Alchemyst account already exists for that email, the request is rejected and the caller must authenticate with their Alchemyst API key instead. Later requests are identified by the OpenRouter key and do not need the email again. OpenRouter-only mode only supports an OpenRouter base_url.

Request

Query parameters

Body

context_config accepts the same fields and takes precedence over the top-level aliases. It is sent inside the request body, next to messages and model:
body_metadata holds metadata filters for the underlying context search. Recognized keys: Extra keys are allowed. When body_metadata is present without groupName, the search defaults to the default group.
If you are calling without an Alchemyst API key (OpenRouter-only mode), keep body_metadata empty — "body_metadata": {} — since there is no Alchemyst context to filter.
similarity_threshold must be greater than or equal to minimum_similarity_threshold.query is deprecated. Retrieval queries are generated by the model through the server-side search_context tool.

Headers

Server-side tools

The API injects tools before forwarding the request upstream:
  • search_context — searches the user’s private context. The model calls this whenever the question may be answerable from the user’s documents, memories, or previous conversations.
  • add_memory — available for existing accounts and claimed placeholders. The model calls it only when the user explicitly asks to remember or save something.
For unclaimed OpenRouter placeholder accounts, every turn is saved to memory automatically, so add_memory is not attached. If no relevant context is found, the model answers from its own knowledge rather than refusing.

Example: OpenAI SDK

The SDK appends /chat/completions to the baseURL, so the example above targets POST /api/v1/context/search/chat/completions.

Example: curl

Response

Non-streaming responses use the OpenAI chat completion shape:
context is only present when ?context=true is passed. model is white-labelled back to the Alchemyst name when the request used an Alchemyst model. When stream: true, the response is proxied as text/event-stream. The response includes x-alchemyst-upstream-latency-ms with the upstream model latency.

Models

The endpoint exposes OpenAI-compatible model listing routes: Point an OpenAI SDK client at the /chat base URL and call client.models.list() to use GET /api/v1/context/search/chat/models. Big Bull Alpha is the default, Alchemyst-served model; any OpenRouter provider/model id is also accepted.

Errors

Errors use the OpenAI error shape:
Upstream provider errors are passed through with their original status and JSON body where possible.
  • GET /api/v1/context/search/models — list served models.
  • GET /api/v1/context/search/chat/models — the same list at the /chat base path used by OpenAI SDK clients.

Billing

Only context retrieval (context.search, measured in retrieved bytes) is billed. The Big Bull Alpha model is free while in launch. When using your own OpenRouter key, model usage is billed by OpenRouter.

See also