Calling the API¶
This section shows how to make requests to an LLM provider from Python.
Start here¶
- Get an API key — pick a provider, sign up, get a key.
- First call — smallest possible "hello world" with the OpenAI SDK.
Going further¶
- Unified client — target OpenAI, DeepSeek, and Qwen with the same
openaiclient by swappingbase_url. - Streaming — token-by-token output.
- Tool use — let the model call your functions.
One SDK covers three providers¶
All three providers covered here speak the OpenAI wire format, so a single Python client works for all of them:
flowchart LR
A[openai Python SDK] --> OA[OpenAI]
A -->|base_url swap| DS[DeepSeek]
A -->|base_url swap| QW[Qwen / DashScope]
The practical consequence: learn the openai client well and you can reach every provider in this tutorial.