Authentication
How to authenticate your API requests
Requests under /v1 and /v1beta need an API key. Create an account on the home page. Generate an API key on the Keys page.
The public status endpoints and the public model list need no API key. See Overview and OpenAI Style for details.
API Key Security
SilentAPI stores API keys as hashes. Treat your API keys like passwords. Do not commit them to version control. Do not put them in browser code or logs.
Sending Your Key
Send your API key in a supported header. Query parameters are available for clients that require them.
| Name | Location | Value |
|---|---|---|
| Authorization | Header | Bearer YOUR_API_KEY |
| x-api-key | Header | YOUR_API_KEY |
| x-goog-api-key | Header | YOUR_API_KEY |
| apiKey | Query parameter | YOUR_API_KEY |
| key | Query parameter | YOUR_API_KEY |
Authorization Header (Recommended)
Authorization: Bearer YOUR_API_KEY
This works with the OpenAI SDK, the Anthropic SDK, curl, and most HTTP libraries.
x-api-key Header
x-api-key: YOUR_API_KEY
The Anthropic SDK sends the x-api-key header. All authenticated API endpoints accept it.
x-goog-api-key Header
x-goog-api-key: YOUR_API_KEY
The Google GenAI SDK sends the x-goog-api-key header. All authenticated API endpoints accept it.
Query Parameter
https://api.silentapi.com/v1/chat/completions?apiKey=YOUR_API_KEY
https://api.silentapi.com/v1/chat/completions?key=YOUR_API_KEY
Use a query parameter only when a client cannot set a header.
Query parameter authentication puts your API key in the URL. A URL can appear in logs. Use the Authorization header when possible.
SDK Examples
OpenAI SDK (Python)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.silentapi.com/v1"
)
response = client.chat.completions.create(
model="gpt-6-sol",
messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)
OpenAI SDK (JavaScript)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.silentapi.com/v1"
});
const response = await client.chat.completions.create({
model: "gpt-6-sol",
messages: [{ role: "user", content: "Hello" }]
});
const responseText = response.choices[0].message.content;
Anthropic SDK (Python)
import anthropic
client = anthropic.Anthropic(
api_key="YOUR_API_KEY",
base_url="https://api.silentapi.com"
)
message = client.messages.create(
model="claude-sonnet-5.5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
)
print(message.content[0].text)
Google GenAI SDK (Python)
from google import genai
client = genai.Client(
api_key="YOUR_API_KEY",
http_options={"base_url": "https://api.silentapi.com"}
)
response = client.models.generate_content(
model="gemini-3.8-flash",
contents="Hello"
)
print(response.text)
Per-Key Budgets
Set a monthly credit budget on each API key on the Keys page. Requests with that API key return HTTP 402 when its budget is reached.