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
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:
# Anthropiccurl 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:
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:
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"}] }'| Header | Description |
|---|---|
Floopy-Cache | Cache strategy: semantic or exact |
floopy-property-* | Attach custom metadata for filtering in the dashboard |
floopy-fallback | Fallback model if the primary provider fails |
floopy-session-id | Group related requests into a session |
floopy-user-id | Associate requests with an end user |
Response Headers
Use -i to inspect response headers returned by the gateway:
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: falseSee the Headers Reference for the full list.