Sign In
Open your user center to view only your own balance, access, and usage.
✦ QUICK START
Open your user center to view only your own balance, access, and usage.
Name the key, set its limits, and use every enabled model.
Set the API Base URL in your client and keep its native protocol.
https://api.luckyapi.online
A graphical provider switcher is the simplest option for Codex and Claude Code.
Open CC Switch and add a custom provider.
Choose Codex or Claude, then enter the matching Base URL below.
Enter your LuckyAPI key and activate the provider.
Restart the target app if it was already running.
https://api.luckyapi.online/v1https://api.luckyapi.onlineYOUR_API_KEYCodex CLI and Codex Desktop use the same user-level configuration when they run as the same system user with the same CODEX_HOME.
~/.codex/config.toml
model = "gpt-5.6-sol"
model_provider = "luckyapi"
[model_providers.luckyapi]
name = "LuckyAPI"
base_url = "https://api.luckyapi.online/v1"
wire_api = "responses"
requires_openai_auth = false
experimental_bearer_token = "YOUR_API_KEY"
Set the native Claude Code endpoint and authentication token once in its user settings.
~/.claude/settings.json
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.luckyapi.online",
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY"
}
}
Use Kimi Code's official KIMI_MODEL_* channel to connect one session without changing its persistent configuration.
KIMI_MODEL_NAME="k3" \
KIMI_MODEL_API_KEY="YOUR_API_KEY" \
KIMI_MODEL_PROVIDER_TYPE="kimi" \
KIMI_MODEL_BASE_URL="https://api.luckyapi.online/v1" \
kimi
Grok CLI uses a namespaced Base URL so its model list does not conflict with Codex.
export GROK_MODELS_BASE_URL="https://api.luckyapi.online/v1/grok"
export XAI_API_KEY="YOUR_API_KEY"
grok models
grok
POST /v1/chat/completionsCall the OpenAI Chat Completions contract with the official OpenAI SDK.
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.luckyapi.online/v1",
)
result = client.chat.completions.create(
model="gpt-5.5",
messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(result.choices[0].message.content)
POST /v1/responsesCall the OpenAI Responses contract with the official OpenAI SDK.
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.luckyapi.online/v1",
)
result = client.responses.create(
model="gpt-5.6-sol",
input="Say hello in one sentence.",
)
print(result.output_text)
Model catalog: GET /v1/models
POST /v1/messagesCall the Anthropic Messages contract with the official Anthropic SDK.
from anthropic import Anthropic
client = Anthropic(
api_key="YOUR_API_KEY",
base_url="https://api.luckyapi.online",
)
result = client.messages.create(
model="claude-sonnet-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(result.content[0].text)
Token count: POST /v1/messages/count_tokens
POST /v1/images/generationsImage generation can take longer than text requests, so allow a longer client timeout.
curl https://api.luckyapi.online/v1/images/generations \
--max-time 240 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-image-2","prompt":"A red apple on a wooden table"}'
POST /v1/grok/responsesGrok uses the namespaced Responses endpoint and streams Server-Sent Events.
curl -N https://api.luckyapi.online/v1/grok/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"grok-4.5","input":"Say hello in one sentence.","stream":true,"store":false}'
Model catalog: GET /v1/grok/models
POST /v1/grok-web/videos/generationsRun one script to generate the video, read the terminal event, and download the MP4.
(
set -euo pipefail
API_KEY="YOUR_API_KEY"
RESULT_FILE="$(mktemp)"
OUTPUT_FILE="./grok-video-$(date +%Y%m%d-%H%M%S).mp4"
trap 'rm -f "$RESULT_FILE"' EXIT
curl -N -sS --fail-with-body --max-time 900 \
"https://api.luckyapi.online/v1/grok-web/videos/generations" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"prompt":"A paper airplane flying through a sunlit library",
"aspect_ratio":"16:9",
"duration":6,
"resolution":"720p"
}' | tee "$RESULT_FILE"
VIDEO_URL="$(
jq -r '
select(.result.response.streamingVideoGenerationResponse.progress == 100)
| .result.response.streamingVideoGenerationResponse.videoUrl // empty
' "$RESULT_FILE" | tail -1
)"
if [ -z "$VIDEO_URL" ]; then
echo "Generation finished without a video URL." >&2
exit 1
fi
curl -L --fail --progress-bar "$VIDEO_URL" -o "$OUTPUT_FILE"
echo "Saved: $OUTPUT_FILE"
)
POST /v1/antigravity/v1internal:streamGenerateContentGemini is exposed through the captured AntiGravity native protocol, not Google's public Gemini API schema.
curl -N https://api.luckyapi.online/v1/antigravity/v1internal:streamGenerateContent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model":"gemini-3.6-flash-high",
"requestType":"agent",
"request":{"contents":[{"role":"user","parts":[{"text":"Say hello in one sentence."}]}]}
}'
No matching models.
PARTNERSHIPS
Token sponsorship for quality projects, helping them reach more users.
A 30% token revenue share for quality software and agents: integrate our tokens into your product and earn on every user's usage.
Reach us through the channel where you received LuckyAPI access.
Effective: July 24, 2026
This policy explains how LuckyAPI handles information while providing accounts, API access, usage, and billing features.
We process account email and username, session and security metadata, and usage, billing, and payment-status records.
Account identity and credentials are processed to authenticate you, protect access, and recover your account.
Information is used to create and protect accounts, issue local sessions, provide API service, record usage, settle charges, prevent abuse, and meet necessary security and legal obligations.
We do not sell personal information. Information is processed only as needed for hosting, payment, security, or legal compliance, and retained only for operational, security, accounting, and legal needs.
To request access, correction, or deletion of account data, use the contact channel through which your LuckyAPI access was provided.
Effective: July 24, 2026
By using LuckyAPI, you agree to these service terms.
Provide accurate account information and protect sessions, passwords, and API keys. Accounts and keys may not be sold, leased, or used for unauthorized access.
Do not use the service unlawfully, infringe rights, bypass access controls, attack systems, distribute malware, or interfere with other users or upstream services.
Billing is based on LuckyAPI records of requests, tokens, models, rates, and applicable multipliers. Top-ups, refunds, and payment status follow verified payment results and the rules shown in the product.
Upstream models and networks can change or fail. LuckyAPI may limit or suspend access for security, compliance, maintenance, or abuse risk, while making reasonable efforts to keep records accurate and service available.
Material changes update the effective date on this page. Continued use after a change means acceptance of the updated terms.
Revocation and deletion take effect immediately. Historical usage and billing remain available.
Copy and store it now. Do not share it. Revoke and replace it if exposure is suspected.
| Name | Status | Quota | Expiration | Last Used | Actions |
|---|
Submit a top-up request and wait for confirmation.
Review top-up requests and their current status.
| Order Number | Amount | Status | Created | Actions |
|---|
Review usage and cost changes for the selected time range.
Granularity is chosen automatically from the actual usage range.
Cost grouped by model for the same time range as the trend.
Daily token and cost totals.
| Date | Requests | Input | Cache Read | Cache Write | Output | Total Tokens | Cost |
|---|
Review every request, its usage and cost.
| Time | Provider | Model | Key | Request Type | Usage | Cost |
|---|