Skip to main content
FortAPI supports two API protocols simultaneously: classic OpenAI-compatible and native Anthropic Claude-compatible. The same API key works with both.

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

All endpoints live under /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 roles system / user / assistant / tool)
  • model — name of any model in the catalog (Claude/Gemini/Grok included — we convert on the fly)
  • stream: true for streaming responses (Server-Sent Events)
  • tools / tool_choice for function calling
  • temperature, top_p, max_tokens and other parameters

Example: Python (OpenAI SDK)

Example: Node.js (OpenAI SDK)

Example: curl + streaming

Replace your-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:
  • messages array (native Claude format)
  • system as a separate field
  • model — Claude model name or any other (we convert into Claude protocol)
  • max_tokens (required for Claude)
  • stream: true
  • tools / tool_choice
  • thinking for reasoning models

Example: Python (Anthropic SDK)

Example: Node.js (Anthropic SDK)

Example: curl

Replace your-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)

With stream: 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 a role: "tool" message, and the model produces the final answer.

Vision / multimodal

Write a user 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.