APIFree provides a unified text generation layer across multiple protocol styles while keeping authentication, billing, and model access consistent at the platform level.
Available endpoints
| Endpoint | Protocol style | Streaming | Best for |
|---|---|---|---|
POST /v1/chat/completions | OpenAI Chat Completions | Yes | Most chat-based LLM integrations and existing OpenAI-compatible clients |
POST /v1/messages | Anthropic Messages | Yes | Applications already built around Anthropic-style message payloads |
POST /v1/responses | OpenAI Responses | Yes | New OpenAI-style text generation integrations |
POST /google/gemini | Google Gemini | Yes | Clients that need Gemini-native request and response structures |
How to choose
- Use
POST /v1/chat/completionsif your application already speaks the classic OpenAI chat format withmessages, or if you want the most familiar migration path. - Use
POST /v1/messagesif your application already sendsmessagesin Anthropic’s format and expects Anthropic-style events. - Use
POST /v1/responsesif you want an OpenAI Responses-compatible interface for text generation and tool orchestration. - Use
POST /google/geminiif you need Gemini-native protocol compatibility instead of OpenAI- or Anthropic-style payloads.
Common behavior
All text generation endpoints:
- Use the same APIFree API key authentication model.
- Require a
modelfield in the request body. - Validate the request against the selected model schema before forwarding it upstream.
- Support standard JSON responses and streaming responses when
streamis enabled.
Authentication
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Streaming
When stream is true, the API returns the upstream stream format for the selected protocol:
chat/completions: OpenAI Chat Completions SSE chunksmessages: Anthropic-style SSE eventsresponses: OpenAI-style SSE eventsgoogle/gemini: Gemini stream output format
Choose the endpoint whose request and stream shape best matches your client runtime.