Developers Documentation
Last Updated: 1/12/2025
1. Making a POST Request
The API expects a POST request with specific parameters in JSON format. You'll also need to include an API key in the query string.
Example Request:
curl -X POST "https://api.nofiltergpt.com/v1/chat/completions?api_key=AIzacDsdsaXZ-HjGw7I11vevV" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello! Can you help me with something?"}
],
"temperature": 0.7,
"max_tokens": 150,
"top_p": 1
}'
2. Parameters
The following parameters must be included in the body of the POST request:
- messages: An array of objects where each object contains the role (
"system"
,"user"
, etc.) and the corresponding content. - temperature: A number to control the randomness of the model's output.
- max_tokens: Maximum number of tokens (words or subwords) to generate.
- top_p: For nucleus sampling; this parameter controls diversity.
3. API Key Authentication
Make sure to include the API key in the query string:
https://api.nofiltergpt.com/v1/chat/completions?api_key=YOUR_API_KEY
Replace YOUR_API_KEY
with the actual API key provided: AIzacDsdsaXZ-HjGw7I11vevV.
4. Handling Response
The API will return the response, which might include data such as the generated text or error messages if any required parameters are missing or the API key is invalid. If successful, the response will be saved to a file, and you can see the data as part of the output stream.
5. Error Handling
The API responds with error messages and appropriate HTTP status codes:
- 400 Bad Request: Missing required parameters.
- 401 Unauthorized: Invalid API key.