G4F API
From H4KS
G4F API[edit]
The G4F API is a free, open-source AI text completion API provided by H4ks. It serves as an alternative API for getting text completions from various AI models and providers, powered by the g4f project.
Features[edit]
- Free text completions from multiple AI models
- OpenAPI/Swagger documentation
- RESTful API endpoint
- Compatible with OpenAI API format
API Endpoint[edit]
- Base URL:
https://g4f.h4ks.com - Documentation: g4f.h4ks.com/docs
- Completions endpoint:
POST /api/completions
Example Usage[edit]
<source lang="bash"> curl -X POST https://g4f.h4ks.com/api/completions \
-H "Content-Type: application/json" \
-d '{"prompt": "Hello, world!", "model": "gpt-4"}'
</source>