Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.

Cheat sheet · Specialise

LLM APIs cheat sheet (OpenAI)

Opens with credits

A quick-revision book on building features with large language model APIs: tokens, prompts, streaming, structured output, tool calling, retrieval, caching, batching, cost, evals and security. Each edition shows the same ideas with one provider’s official Python SDK; model names come from a MODEL setting so the code outlives any one model.

Curated by Tauseef Fayyaz8 chapters56 concepts78 glossary terms

Chapters

8 chapters · 56 concepts

  1. 1How LLM APIs workAn LLM API takes text (and sometimes images) in and returns generated text, billed by the token. These ideas shape every request you will write.6 concepts
  2. 2Prompts, roles and samplingHow you structure a request: who says what, which instructions persist, how history is kept, and which knobs change the style and length of the answer.8 concepts
  3. Streaming, structured output and imagesGetting output into a shape your product can use: streamed for chat interfaces, schema-checked JSON for code, and images as input when text is not enough.6 conceptsOpens with credits
  4. Tool calling and agentsTool calling lets the model ask your code to do things: look up an order, run a query, send an email. Your code runs the tool and sends the result back, in a loop, until the model answers.7 conceptsOpens with credits
  5. Embeddings and retrieval (RAG)Retrieval-augmented generation finds the most relevant pieces of your own data and puts them in the prompt, so answers are grounded in current, private information the model was never trained on.7 conceptsOpens with credits
  6. Cost, caching, batching and reliabilityWhat changes when real traffic arrives: repeated prompts should hit the cache, bulk jobs should go through batch APIs, and every call needs retries, timeouts and a budget.8 conceptsOpens with credits
  7. Evals and observabilityPrompts and models change behaviour in ways unit tests do not catch. Evals turn "it seems better" into a number, and tracing shows what actually happened in production.7 conceptsOpens with credits
  8. Security and safetyLLM features add new attack surface: text can carry instructions, output can carry payloads, and API keys are valuable. Design as if every input and output is untrusted.7 conceptsOpens with credits
  9. 9Glossary, A to ZEvery concept in the sheet and the smaller terms it uses, in one list.78 terms

About this sheet

Building on OpenAI, Anthropic and Gemini APIs: prompts, streaming, structured output, tools, RAG, caching, cost, evals and safety.

Picked from the other libraries by shared topics.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.

  • 1:1 Mentorship
  • Fresh Graduate Mentorship
  • Career Guidance

Brand deals, promos and partnerships: tauseeffayyaz@gmail.com