Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.fortapi.com/llms.txt

Use this file to discover all available pages before exploring further.

This guide takes you to your first successful request to OpenAI / Claude / Gemini through FortAPI in 3 steps.

Step 1. Create an API key

In the dashboard, go to TokensCreate token.
  • Name: anything for your own reference, e.g. local-dev.
  • Expiry: leave “Never” unless you need otherwise.
  • Spend limit: you can cap the token at a USD amount.
Copy the resulting key — it starts with sk-.... Save it immediately, you won’t be able to view the full key again later (only the last 4 characters).

Step 2. First request

FortAPI is OpenAI-compatible. Use your favourite SDK and just swap the base_url:
from openai import OpenAI

client = OpenAI(
    api_key="sk-YOUR_KEY",
    base_url="https://www.fortapi.com/v1",
)

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello!"}],
)

print(response.choices[0].message.content)

Step 3. Switch models

To switch to Claude or Gemini, change only the model parameter:
# Anthropic Claude
model="claude-3-5-sonnet-20241022"

# Google Gemini
model="gemini-2.0-flash"

# xAI Grok
model="grok-2-latest"
The full list of available models is in your dashboard under Models.

What’s next