OpenAI protocol
POST /v1/chat/completions — industry standard, supported by virtually all SDKs and frameworks.Claude protocol
POST /v1/messages — native Anthropic format with thinking blocks and MCP support.Base URL
/v1. Auth via the Authorization: Bearer sk-... header.
With the OpenAI protocol,
base_url includes /v1 (https://www.fortapi.com/v1). With the Anthropic SDK, set ANTHROPIC_BASE_URL to the bare domain without /v1 (https://www.fortapi.com) — the SDK appends /v1/messages itself, and adding /v1 yourself causes a 404.OpenAI protocol
Use this protocol if your code already uses the official OpenAI SDK or a compatible framework (LangChain, LlamaIndex, Vercel AI SDK, etc.).Endpoint
Compatibility
The request/response format matches OpenAI’s Chat Completions API. Supported:messages(with rolessystem/user/assistant/tool)model— name of any model in the catalog (Claude/Gemini/Grok included — we convert on the fly)stream: truefor streaming responses (Server-Sent Events)tools/tool_choicefor function callingtemperature,top_p,max_tokensand other parameters
Example: Python (OpenAI SDK)
Example: Node.js (OpenAI SDK)
Example: curl + streaming
Replaceyour-model-name with any model name from the pricing page on the main site.
Claude protocol
Use this protocol if your code is built on the Anthropic SDK or you need Claude-specific features (thinking blocks, native tool calls).Endpoint
Compatibility
The request/response format matches Anthropic’s Messages API. Supported:messagesarray (native Claude format)systemas a separate fieldmodel— Claude model name or any other (we convert into Claude protocol)max_tokens(required for Claude)stream: truetools/tool_choicethinkingfor reasoning models
Example: Python (Anthropic SDK)
Example: Node.js (Anthropic SDK)
Example: curl
Replaceyour-model-name with any model name from the pricing page on the main site.
Anthropic SDK uses the
x-api-key header instead of Authorization: Bearer. FortAPI accepts both on the /v1/messages endpoint.Which protocol should I pick?
In every case — same API key, same per-token price, shared balance.
More usage
The examples below use the OpenAI protocol; for the Claude protocol see the equivalent calls in the respective SDK docs.Streaming (consuming SSE)
Withstream: true, the response is a series of Server-Sent Events: each line starts with data: and ends with a final data: [DONE]. The official SDKs parse this for you — just iterate.
Tool calling (function calling)
The model decides which function to call and returns the arguments; you run the function locally, then send the result back as arole: "tool" message, and the model produces the final answer.
Vision / multimodal
Write auser message’s content as an array and mix in image_url. The image can be a URL or a data: base64 string:
Embeddings / images / audio
All endpoints
The full list with current models is on the Pricing page on the main site. Which models each endpoint supports is defined by the Pricing page and the Models list in the console.
