API Reference

OpenAI-compatible chat completions API. Replace the base URL and keep your existing code.

Base URL

https://keymeai.com/v1

Authentication

Include your API key in the Authorization header. Get your key at keymeai.com/signup.

export KEYMEAI_KEY="km-your-key-here"

Chat Completions

POST /v1/chat/completions

Create a chat completion. Compatible with the OpenAI chat completions format.

Request

curl -s https://keymeai.com/v1/chat/completions \
  -H "Authorization: Bearer $KEYMEAI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "deepseek-chat",
  "messages": [
    {"role": "user", "content": "Explain quantum computing in simple terms"}
  ]
}'

Parameters

ParameterTypeDescription
modelstringModel ID. See available models below.
messagesarrayArray of message objects with role and content.
temperaturefloatSampling temperature (0-2). Default: 0.7
max_tokensintegerMaximum tokens in the response. Optional.
streambooleanEnable streaming responses. Default: false

Response

{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "created": 1779000000,
  "model": "deepseek-chat",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Quantum computing uses quantum bits..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 45,
    "total_tokens": 57
  }
}

Available Models

Model IDProviderBest for
deepseek-chatDeepSeekGeneral purpose, coding, analysis
deepseek-reasonerDeepSeekMath, logic, complex reasoning
doubao-pro-32kByteDanceLong documents, 32K context
qwen-maxAlibaba CloudCreative writing, multi-language
qwen-plusAlibaba CloudFast, cost-effective throughput

Python Example

import requests

url = "https://keymeai.com/v1/chat/completions"
headers = {
    "Authorization": "Bearer km-your-key-here",
    "Content-Type": "application/json"
}
data = {
    "model": "deepseek-chat",
    "messages": [{"role": "user", "content": "Hello!"}]
}

response = requests.post(url, headers=headers, json=data)
print(response.json()["choices"][0]["message"]["content"])

OpenAI SDK Compatibility

KeyMeAI is compatible with the OpenAI Python SDK. Just change the base URL:

from openai import OpenAI

client = OpenAI(
    api_key="km-your-key-here",
    base_url="https://keymeai.com/v1"
)

response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)

Rate Limits

TierRate Limit
Free100 requests / day
Hobby5M tokens / month
StandardNo hard limit (fair use)
ScaleCustom

Errors

StatusMeaning
200Success
401Invalid or missing API key
429Rate limit exceeded
500Server or upstream model error
503All upstream models temporarily unavailable
← Back to KeyMeAI