# How AI APIs work

> Short, plain explanations of the ideas behind DigitSpace, with the numbers that matter.

Source: https://digitspace.ai/learn

- [What is an AI gateway?](https://digitspace.ai/learn/what-is-an-ai-gateway): An AI gateway is one API between your code and many AI providers, handling keys, routing, failover, costs and rules. What it does and when you need one.
- [LLM routing, explained](https://digitspace.ai/learn/llm-routing): LLM routing sends each request to the model and provider that best fit it. How capability matching, cost and latency strategies and quality levels work.
- [LLM API failover](https://digitspace.ai/learn/llm-failover): AI APIs fail with timeouts, rate limits and overloads. Which errors are worth retrying elsewhere, which aren't, and how automatic failover keeps features up.
- [How to cut LLM API costs](https://digitspace.ai/learn/reduce-llm-costs): Ways to lower LLM API spend: send simple requests to small models, cap output, cache prompts, set budgets, use cloud credits and measure every request.
- [Tokens and LLM pricing](https://digitspace.ai/learn/llm-token-pricing): How AI APIs charge: tokens, input and output prices per million, cached and cache-write tokens, and how to work out what a request costs.
- [BYOK vs. credits](https://digitspace.ai/learn/byok-vs-credits): Bring your own key (BYOK) or buy credits from the gateway? How each works, what they cost, and when to mix them.
- [OpenAI-compatible APIs](https://digitspace.ai/learn/openai-compatible-api): An OpenAI-compatible API takes the same requests as OpenAI's Chat Completions, so SDKs and tools work by changing the base URL. What to check.
