How it works
An SDK (Software Development Kit) is a ready to use package in a specific language (Python, JavaScript, Go, etc.) that wraps a service API. Instead of building HTTP requests manually, you call library functions.
A typical SDK includes: a preconfigured HTTP client, classes for the API resources (models, files, embeddings), error handling and retry, automatic authentication and code examples.
For AI, the most common SDKs are those from OpenAI, Anthropic, Google (genai) and tools like LangChain or LlamaIndex. They abstract protocol details and let you focus on application logic.
Practical example
Without an SDK, calling the OpenAI API requires building a POST with headers, JSON body, handling timeouts and parsing the response. With the official SDK (openai for Python), you just need:
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Olá"}]
)
print(response.choices[0].message.content)The SDK handles authentication (via environment variable), retry on rate limit and response typing.
What it's for
It is used to speed up development, reduce integration errors and keep code up to date when the API changes. It also provides typing and autocomplete in the editor, improving the developer experience.
Difference between SDK and API
The API is the contract (endpoints, formats, authentication). The SDK is the ready made implementation of that contract in a language. You can use the API directly (via HTTP) or via SDK. The SDK is convenience; the API is the source of truth.