Quickstart
Start building with leading AI models through one API. If you already use an OpenAI SDK, set the ProfusAPI base URL and key, then choose a model from the catalog.
- Create an account.
- Add credits on the Wallet page.
- Create a key on the API Keys page.
- Pick a model from the catalog and send a request:
from openai import OpenAI
client = OpenAI(
base_url="https://profusapi.com/v1",
api_key="<PROFUSAPI_API_KEY>",
)
completion = client.chat.completions.create(
model="gemini-3.8-flash",
messages=[{"role": "user", "content": "What is the meaning of life?"}],
)
print(completion.choices[0].message.content)Authentication
Send your key as a Bearer token on every request. Keys start with sk-pf-v1-. Never expose them in client-side code.
Authorization: Bearer sk-pf-v1-...API Reference
Base URL:
https://profusapi.com/v1POST /chat/completions
Creates a model response for the given conversation. Accepts the standard OpenAI chat completion parameters (temperature, max_tokens, top_p, tools, response_format, …) which are forwarded to the model.
| model | string, required | Model ID, e.g. anthropic/claude-sonnet-5.5 |
| messages | array, required | List of {role, content} messages |
| stream | boolean | Stream tokens as server-sent events |
| temperature | number | Sampling temperature, 0–2 |
| max_tokens | integer | Maximum tokens to generate |
The response is the standard chat completion object. usage.cost contains the amount (USD) billed for the request.
{
"id": "gen_...",
"model": "gemini-3.8-flash",
"choices": [{ "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" }],
"usage": { "prompt_tokens": 14, "completion_tokens": 120, "total_tokens": 134, "cost": 0.0012175 }
}Streaming
Set "stream": true to receive server-sent events. The stream ends with data: [DONE]. Add "stream_options": {"include_usage": true} to get token usage in the final chunk.
curl https://profusapi.com/v1/chat/completions \
-H "Authorization: Bearer $PROFUSAPI_API_KEY" \
-H "Content-Type: application/json" \
-N -d '{"model":"gemini-3.8-flash","stream":true,"messages":[{"role":"user","content":"Hello"}]}'Conversation memory
ProfusAPI does not store conversation content: every request is processed on its own and your messages don't stay on our servers afterwards. One customer's conversations can never reach another customer.
To let a model "remember" earlier conversations, keep the history on your side and send it as the messages array with each request. Tools like Claude Code, Cursor and Cline already do this on your own machine. A minimal example for your own app:
import json, os, requests
HISTORY = "history.json" # stays on your own machine
messages = json.load(open(HISTORY)) if os.path.exists(HISTORY) else []
messages.append({"role": "user", "content": "What did we work on last time?"})
r = requests.post(
"https://profusapi.com/v1/chat/completions",
headers={"Authorization": f"Bearer {os.environ['PROFUSAPI_API_KEY']}"},
json={"model": "gemini-3-flash", "messages": messages},
)
reply = r.json()["choices"][0]["message"]
messages.append({"role": "assistant", "content": reply["content"]})
json.dump(messages, open(HISTORY, "w"))
print(reply["content"])Longer history means more tokens (and cost) per request. For long projects, replace old messages with a short summary.
Claude Code & Anthropic API
ProfusAPI also speaks the Anthropic Messages API (POST /v1/messages, including streaming, tools, thinking and count_tokens), so Claude Code and Anthropic SDKs work by changing the base URL:
export ANTHROPIC_BASE_URL=https://profusapi.com
export ANTHROPIC_API_KEY=$PROFUSAPI_API_KEY
export ANTHROPIC_MODEL=claude-sonnet-5-5
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5-20251001
claudeUse our model ids (anthropic/claude-sonnet-5.5) or the provider ids (claude-sonnet-5-5, claude-opus-5-5, claude-haiku-4-5-20251001). Prompt caching works across turns; cached input is billed at 10% of the input price.
Plain HTTP example:
curl https://profusapi.com/v1/messages -H "x-api-key: $PROFUSAPI_API_KEY" -H "anthropic-version: 2023-06-01" -H "content-type: application/json" -d '{"model":"claude-sonnet-5-5","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}'Listing models
GET /models returns every available model with pricing (USD per token) and context length. No key required.
curl https://profusapi.com/v1/modelsKey & credit info
GET /key returns the usage and spending limit of the key making the request. GET /credits returns your balance and rolling 24-hour spending limit. Inference requests share an account-wide rate limit across all keys and API formats.
curl https://profusapi.com/v1/key -H "Authorization: Bearer $PROFUSAPI_API_KEY"
curl https://profusapi.com/v1/credits -H "Authorization: Bearer $PROFUSAPI_API_KEY"Errors
Errors return a JSON body: {"error": {"code": 402, "message": "..."}}
| 400 | Invalid request body or parameters |
| 401 | Missing or invalid API key |
| 402 | Insufficient credits, or the key reached its credit limit |
| 403 | The API key is disabled |
| 404 | Unknown model |
| 429 | Too many requests for this key. Slow down and retry |
| 502 | The upstream model provider failed or is unreachable |
| 503 | Inference is temporarily unavailable |