Skip to content

curl

Overview

Floopy exposes a standard OpenAI-compatible REST API. You can call it directly with curl or any HTTP client — no SDK required. Just send requests to https://api.floopy.ai/v1 with your Floopy API key in the Authorization header.

Basic Request

Terminal window
curl https://api.floopy.ai/v1/chat/completions \
-H "Authorization: Bearer $FLOOPY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Explain quantum computing in one sentence."}
]
}'

Set FLOOPY_API_KEY in your environment. You can create one in the dashboard.

Switch providers by changing the model name — no other changes needed:

Terminal window
# Anthropic
curl https://api.floopy.ai/v1/chat/completions \
-H "Authorization: Bearer $FLOOPY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-20250514",
"messages": [{"role": "user", "content": "Hello!"}]
}'

Streaming

Add "stream": true to the request body and use --no-buffer to see tokens as they arrive:

Terminal window
curl --no-buffer https://api.floopy.ai/v1/chat/completions \
-H "Authorization: Bearer $FLOOPY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Write a short poem."}],
"stream": true
}'

Custom Headers

Add Floopy-specific headers with -H:

Terminal window
curl https://api.floopy.ai/v1/chat/completions \
-H "Authorization: Bearer $FLOOPY_API_KEY" \
-H "Content-Type: application/json" \
-H "Floopy-Cache: semantic" \
-H "floopy-property-environment: production" \
-H "floopy-property-feature: chat" \
-H "floopy-fallback: claude-sonnet-4-20250514" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello"}]
}'
HeaderDescription
Floopy-CacheCache strategy: semantic or exact
floopy-property-*Attach custom metadata for filtering in the dashboard
floopy-fallbackFallback model if the primary provider fails
floopy-session-idGroup related requests into a session
floopy-user-idAssociate requests with an end user

Response Headers

Use -i to inspect response headers returned by the gateway:

Terminal window
curl -i https://api.floopy.ai/v1/chat/completions \
-H "Authorization: Bearer $FLOOPY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello"}]
}'
# Response includes:
# Floopy-Provider: openai
# Floopy-Model: gpt-4o
# Floopy-Fallback-Used: false

See the Headers Reference for the full list.