Connect in three steps
01Create a key
Open “API keys” in your dashboard. Set a project name, budget, and allowed models. Save the key: you will not be able to view it again.
02Set the API base URL
export GHOSTROUTE_API_KEY="your-api-key" export OPENAI_BASE_URL="https://your-domain/v1"
03Send a request
curl https://your-domain/v1/chat/completions \
-H "Authorization: Bearer $GHOSTROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model",
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"max_tokens": 256
}'Using the Python SDK
from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["GHOSTROUTE_API_KEY"],
base_url="https://your-domain/v1"
)
response = client.chat.completions.create(
model="your-model",
messages=[{"role": "user", "content": "Hello!"}],
max_tokens=256
)
print(response.choices[0].message.content)Prompt logging
Accepted chat requests are logged, including all messages, tool definitions and structured output instructions. Administrators can read these logs for 30 days. Transport credentials are excluded; secrets you type inside a message are still part of that message. Do not submit sensitive data. Logs expire after 30 days and are removed during request or administrator-read cleanup; backups may retain copies. See our privacy policy.
Streaming responses
Set stream: true. Responses arrive as SSE, including the provider's usage metadata. If the stream ends without confirmed usage, the hold remains until reconciliation. Do not automatically retry an uncertain request.
Prevent duplicate requests
Send a unique Idempotency-Key for each generation. Reusing the same value returns HTTP 409 and the original request ID without starting another generation. The X-Request-ID header helps you find the request in your logs.
Supported parameters
model, messages, max_tokens or max_completion_tokens, stream, temperature, top_p, tools, tool_choice, response_format, stop, seed. This release supports text messages. Request limit: 100 KB, up to 100 messages, and up to 8,192 output tokens, subject to the model's limits.
Error responses
400 | Check the request format and model limits |
401 | The key is missing, revoked, or expired |
403 | The model is not allowed for this key |
409 | A request with this Idempotency-Key was already accepted |
429 | Rate, concurrency, key budget, or balance limit reached |
502 | Provider error; check the request status |
503 | The model is not connected yet |