Knowledge Bank · AI & GenAI

Using LLM APIs in Applications

By Karthick Selvam · Published

Most AI applications call a language model through a provider's API. Here are the essentials developers need.

The basic call

Send a list of messages (system instructions plus user input) to the API, choose a model and parameters, and receive the generated response. Responses can be streamed token by token.

Key parameters

Model choice, maximum output tokens and sampling settings such as temperature. Many APIs also support structured output and tool calling.

Production concerns

Handle rate limits and retries, set timeouts, log requests responsibly, monitor cost per request, and keep API keys in a secrets manager.

Quality

Version prompts, build an evaluation set, and test before changing models.

Frequently asked questions

Should keys be stored in code?

Never. Use environment variables or a secrets manager.

Related programmes

Turn this into a team capability

Our corporate programmes cover topics like this hands-on, mapped to your stack.

Talk to us