APIFree
APIFree
Text Generation

Text Generation Overview

Overview of APIFree text generation APIs across multiple protocol styles.

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

EndpointProtocol styleStreamingBest for
POST /v1/chat/completionsOpenAI Chat CompletionsYesMost chat-based LLM integrations and existing OpenAI-compatible clients
POST /v1/messagesAnthropic MessagesYesApplications already built around Anthropic-style message payloads
POST /v1/responsesOpenAI ResponsesYesNew OpenAI-style text generation integrations
POST /google/geminiGoogle GeminiYesClients that need Gemini-native request and response structures

How to choose

  • Use POST /v1/chat/completions if your application already speaks the classic OpenAI chat format with messages, or if you want the most familiar migration path.
  • Use POST /v1/messages if your application already sends messages in Anthropic’s format and expects Anthropic-style events.
  • Use POST /v1/responses if you want an OpenAI Responses-compatible interface for text generation and tool orchestration.
  • Use POST /google/gemini if 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 model field in the request body.
  • Validate the request against the selected model schema before forwarding it upstream.
  • Support standard JSON responses and streaming responses when stream is 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 chunks
  • messages: Anthropic-style SSE events
  • responses: OpenAI-style SSE events
  • google/gemini: Gemini stream output format

Choose the endpoint whose request and stream shape best matches your client runtime.