DigitSpace

What happens to each request

DigitSpace sits between your code and 6 AI providers. For each request it works out what the request needs, shortlists the models that can do all of it, sends it to the healthiest provider at the best price, moves to another provider if that one fails, and records the model, provider, cost and time.

POST /v1/chat/completions

  1. Check the keyproduction-api · budget ok · IP allowed
  2. Read the needstools · 2,100 tokens in
  3. Shortlist8 models qualify at balanced
  4. Rankhealthy first, then price
  5. Sendanthropic / claude-haiku-5-5
  6. Record$0.000290 · 1.9 s

Six steps, in about the time of one call

Routing adds no extra round trip: the decision is made in the gateway before the request is sent.

  1. Check the key.

    The API key is looked up by its hash. Its project, budget, access rules and allowed IP ranges are checked before the request is read.

  2. Read what the request needs.

    Images in the messages, tools, a JSON schema, reasoning effort, streaming, and roughly how many tokens go in and come out.

  3. Shortlist the models that can do it.

    For a named model, its providers. For "auto", the models in the auto pool at your quality level. Anything that lacks a needed capability, or that your rules forbid, is dropped.

  4. Rank by price, speed and health.

    Unhealthy providers go to the back. The rest are ordered by your strategy: cheapest, fastest from your region, or a balance of the two.

  5. Send, and fail over if needed.

    The first choice gets the request. A timeout, a 429 or a 5xx moves it to the next provider, up to three in all; a bad request is returned to you straight away.

  6. Record what happened.

    The model and provider that answered, tokens, cost, time to first token, total time and every attempt, in your dashboard and through the API.

Telephone switchboard operators with headsets at a long switchboard, plugging cords into the panel.

In 1953 an operator put each call through by hand. DigitSpace routes every request.

Switchboard operators, NIH Clinical Center, 1953. NIH History Office, public domain, via Wikimedia Commons.

One request, start to finish

A request for "auto" that needs tools. Two models qualify; the cheaper one answers on its first provider.

Asked forauto (balanced)
Needstools, 2,100 tokens in

Shortlist, per 1M tokens in / out

  • claude-haiku-5-5Anthropic · $0.10 / $0.50
  • gpt-6-lunaOpenAI · $0.10 / $0.50
  • gemini-3.8-flashGoogle · $0.75 / $3.75

Chosen: claude-haiku-5-5 on Anthropic, first attempt

What you control

Which model
Name a model to pin it, name "provider/model" to pin the provider too, or send "auto" and let routing choose.
How good auto should be
Economy, balanced or best, set per project or per request with "auto:economy", "auto:balanced" or "auto:best".
What matters most
Price, latency or a balance, set per project or per request with the X-DigitSpace-Routing header.
Where it runs
Pin a project to a region, or let the caller's region decide which provider is closest.
Who may use what
Budgets and allow or deny rules for models, providers, prices and IP ranges, per key, member and team.

What the gateway serves

EndpointFormatWhat it does
POST /v1/chat/completionsOpenAIChat, streaming and tools for every model
POST /v1/messagesAnthropicThe same models through Anthropic's Messages API
GET /v1/modelsOpenAIEvery model with a live provider (47 today)
GET /v1/keyDigitSpaceThe calling key's usage and limits

Text models only for now: no image generation, embeddings or audio endpoints.

Questions

Does routing make requests slower?

The decision is made inside the gateway from data it already holds, so there is no extra network round trip. What you notice is the provider's own speed.

Can I turn routing off?

Yes. Name a model to always use it, and "provider/model" to always use one provider. Routing then only handles failover between that model's providers, or none if you pinned the provider.

What happens when every provider fails?

You get a 502 with a plain message after at most three attempts, and the failed attempts appear in your logs.

Is my prompt stored?

Only if your organisation turns on retention. By default DigitSpace records the request's metadata (model, tokens, cost, time) and not its content.

Read next

Live in a minute.

Create a key, change the base URL, send a request. No card needed with your own provider keys.

Start free