api
11 tutorials tagged “api”.
- Tokens, Cost and Rate LimitsEstimate what a model API feature costs: count tokens, price input and output separately, compare models, and handle rate limits with retries.
- API Keys and SecretsKeep API keys safe: load them from environment variables, keep them out of code and git, never ship them to browsers or apps, and rotate them when exposed.
- Messages, System Prompts and ParametersControl a model API call: send a whole conversation as messages, set rules in the system prompt, and shape the reply with max_tokens, stop and temperature.
- Calling a Model APICall a hosted AI model from Python with one small helper that works with most providers: send a system prompt and a message, then read the reply.
- Streaming ResponsesShow a model's reply as it is written: stream text piece by piece in Python, then read the finished reply for the finish reason and token usage.
- Structured Output and JSONGet JSON your code can trust from a model: define a schema with Pydantic, ask the API to follow it, and validate the result before using it.
- Tool Use and Function CallingLet a model ask your code for data: describe a tool, run it when the model requests it, send the result back, and get an answer built on real data.
- The AI Ecosystem MapThe layers every AI product is built from: interface, application, API, model, data, cloud and monitoring, and how to place any AI tool on the map.
- Model vs Application vs InterfaceThe restaurant analogy for AI products: model, application, interface, API, data and infrastructure, and how a chat assistant fits together.
- Open and Closed ModelsOpen-weight models you can download and run yourself vs closed models you use through an API, and how cost, privacy and control decide.