Send a prompt to a model in the Playground, then call the same model from your own code with the OpenAI SDK.
Try a model in the Playground
Section titled “Try a model in the Playground”- In TIR, open your project. In the side menu’s PRODUCTS list, select GenAI API to see every model you can use.
- Select an available model, such as DeepSeek V3, which the examples use. A model that is out of inventory offers Request instead. Which models are available changes over time; the FAQ explains what that means for code you have written.
- Type a prompt in the chat and send it.
Generate a Personal Access Token
Section titled “Generate a Personal Access Token”Every GenAI API request needs a token to authenticate it.
- In the side menu, select Personal Access Tokens.
- Select Create Token. Keep the generated name or type your own, then confirm.
- Copy the Auth Token shown in the dialog and store it somewhere safe. You can copy it again later from the Personal Access Tokens list.
Call the model with the OpenAI SDK
Section titled “Call the model with the OpenAI SDK”DeepSeek V3 is a text-generation model, so it works with the OpenAI SDK pointed at its TIR endpoint.
-
Install the SDK:
pip install -U openai -
On the model’s page, select Get Code, then the Python tab. The sample already has the model’s endpoint for your project.
-
Copy the sample into a file, and set its API key value to the Auth Token you copied. Use the Auth Token here rather than E2E’s separate API Key.
-
Run the script. The model’s reply prints to your console.
What to do next
Section titled “What to do next”- To try every model type, the Advanced Parameters panel, and streaming, see Use the Playground.
- Call the API with the OpenAI SDK covers streaming replies and every text or embedding model, DeepSeek V3 included.
- For a plain HTTP request to any model, see Call the API with REST.
- Call the API with the TIR SDK covers the small set of models it supports, including speech models such as Whisper Large V3.
If a request fails, Troubleshooting TIR GenAI API explains what to do.
Was this page helpful?