Calling the API with curl
After reading this guide, you can make a chat completion call from the command line with curl. Our API is OpenAI-compatible — for full parameter details, see the OpenAI API reference.
Request
curl https://api.tvtapi.com/v1/chat/completions \
-H "Authorization: Bearer sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model-name",
"messages": [
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Hello"}
]
}'
Three substitutions:
sk-xxxxxxxx→ your API Keyyour-model-name→ a model name copied from the model marketplaceHello→ the message you want to send
Response
A JSON response is returned. The model's reply is in choices[0].message.content.
Common Parameters
temperature: randomness — 0 is most stable, 1 is most creativemax_tokens: caps the maximum reply lengthstream: set totruefor streaming output — the reply arrives token by token
Troubleshooting
- 401: wrong Key — see Error Code Reference.
- 429: too many requests — retry later.
- No response for a long time: check your network and confirm the Base URL is
https://api.tvtapi.com/v1.