๐ธ KeyFrog API
AI infrastructure for production applications.
KeyFrog is a unified API gateway that provides developers and businesses with access to 58+ AI models from 14+ providers through a single, OpenAI-compatible endpoint. No vendor lock-in. One API key for everything.
Quick Start
Make your first API call in under 5 minutes.
Create API Key
Sign up at Dashboard and generate your API key.
Copy Base URL
Use https://api.keyfrog.top/v1 as your API endpoint.
Send Your First Request
Make a chat completion call. See the code example โ
gpt-4o-mini or deepseek-v4-flash โ they're fast and cheap, perfect for testing.Authentication
Authenticate all requests with a Bearer token.
Include your API key in the Authorization header of every request:
Best practices
- Never expose keys in client-side code. Use environment variables or a backend proxy.
- Rotate keys periodically. Generate new keys from the Dashboard.
- Use separate keys for development and production environments.
Base URL
All API requests use a single endpoint.
All endpoints are fully compatible with the OpenAI API specification. You can use any OpenAI SDK or HTTP client by simply changing the base URL.
Available endpoints
| Endpoint | Method | Description |
|---|---|---|
| /v1/chat/completions | POST | Create chat completions |
| /v1/models | GET | List all available models |
Chat Completion
Create a model response for a conversation. Compatible with OpenAI's Chat Completions API.
Request body
| Parameter | Type | Description |
|---|---|---|
| model REQUIRED | string | Model ID (e.g., gpt-4o-mini, deepseek-v4-pro) |
| messages REQUIRED | array | Array of message objects with role and content |
| temperature OPTIONAL | number | Sampling temperature (0โ2). Default: 1 |
| max_tokens OPTIONAL | integer | Maximum tokens in the response |
| stream OPTIONAL | boolean | Enable SSE streaming. Default: false |
Message roles
- system โ Sets the assistant's behavior and instructions
- user โ The user's input message
- assistant โ Previous assistant responses (for multi-turn conversations)
Streaming
Get real-time token-by-token responses via Server-Sent Events (SSE).
Set "stream": true in your request. The server sends data: chunks. The stream ends with data: [DONE].
How it works
- Set
"stream": truein the request body - The server responds with
text/event-streamcontent type - Each chunk contains a
deltafield with incremental content - The stream ends with
data: [DONE]
Models
List all available models. Currently serving 58+ models from 14+ providers.
Models are loaded dynamically from our backend. Use the id field in your chat completion requests.
Available Models
Pricing
Pay-as-you-go. No subscriptions. No hidden fees.
All prices are in USD per 1 million tokens. Pricing data is synced from our backend in real time.
Price List
* All prices in USD per 1M tokens. See full pricing page for details.
Error Codes
KeyFrog uses standard HTTP status codes with OpenAI-compatible error responses.
| Code | Status | Description |
|---|---|---|
| 401 | Unauthorized | Invalid or missing API key |
| 403 | Forbidden | API key doesn't have permission, or key has been revoked |
| 404 | Not Found | The requested model or endpoint does not exist |
| 429 | Rate Limited | Too many requests. Implement exponential backoff |
| 500 | Server Error | Internal server error. Retry with backoff |
Error response format
All errors return a JSON body with an error object containing message, type, and code.
Rate Limits
Rate limits protect the platform and ensure fair usage for all users.
If you exceed the rate limit, you'll receive a 429 Too Many Requests response.
Best practices
- Implement exponential backoff. Wait 1s, 2s, 4s, 8s between retries.
- Batch requests when possible to reduce call volume.
- Use streaming to reduce the number of API calls needed.
- Cache responses for identical prompts when appropriate.
SDKs
Use KeyFrog with your favorite language. All OpenAI SDKs work out of the box.
Python
Install: pip install openai
The official OpenAI Python SDK works with KeyFrog by changing the base_url.
Node.js
Install: npm install openai
The official OpenAI Node.js SDK works identically.
Go
Use any HTTP client. The API is standard REST with JSON.
cURL
Works with any HTTP client. No SDK required.
FAQ
kf-.model field in your request. All models share the same endpoint and API key. See the Models section for available models.base_url to https://api.keyfrog.top/v1 and use your KeyFrog API key. All OpenAI SDK methods work โ chat completions, models list, streaming, etc.glm-4-flash are completely free. Great for prototyping and low-cost applications."stream": true in your request. All models support SSE streaming. See the Streaming section.