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"
}
}
POST /v1/images/*Text-to-image and reference-image editing are both available. Image requests can take longer than text requests, so allow a longer client timeout.
curl -sS --max-time 600 \
https://api.luckyapi.online/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A red apple on a wooden table, square 1:1 composition",
"n": 1,
"response_format": "b64_json"
}' \
-o image-response.json
curl -sS --max-time 600 \
https://api.luckyapi.online/v1/images/edits \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gpt-image-2" \
-F "prompt=Combine the references into one cyberpunk scene, keep the subjects and use a square 1:1 composition" \
-F "image[]=@./reference-1.png" \
-F "image[]=@./reference-2.png" \
-F "image[]=@./reference-3.png" \
-F "n=1" \
-F "response_format=b64_json" \
-o image-edit-response.json
POST /v1/images/*Generate images from text or edit up to three local reference images through the same LuckyAPI key.
curl -sS --fail-with-body --max-time 600 \
https://api.luckyapi.online/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-quality",
"prompt": "A cinematic spacecraft leaving a Martian canyon",
"aspect_ratio": "16:9",
"resolution": "2k",
"n": 1,
"response_format": "url"
}' \
-o grok-image-response.json
RESPONSE=grok-image-response.json
jq . "$RESPONSE"
URL=$(jq -er '.data[0].url' "$RESPONSE") || exit 1
curl -fL "$URL" -o grok-image.png
curl -sS --fail-with-body --max-time 600 \
https://api.luckyapi.online/v1/images/edits \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=grok-imagine-image-quality" \
-F "prompt=Combine the subjects into one cinematic cyberpunk scene" \
-F "image=@./reference-1.png" \
-F "image=@./reference-2.png" \
-F "image=@./reference-3.png" \
-o grok-image-edit-response.json
POST /v1/videos/generationsVideo generation is asynchronous: submit a task first, inspect its status when needed, then use the protected content endpoint to wait for and download the MP4.
API_KEY="YOUR_API_KEY"
BASE="https://api.luckyapi.online"
ID=$(curl -fsS "$BASE/v1/videos/generations" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1.5",
"prompt": "A cinematic spacecraft leaving a Martian canyon",
"duration": 10,
"aspect_ratio": "16:9",
"resolution": "720p"
}' \
| jq -er '.request_id') || exit 1
printf 'Request ID: %s\n' "$ID"
curl -fsS "$BASE/v1/videos/$ID" \
-H "Authorization: Bearer $API_KEY" | jq .
curl -fSL --retry 120 --retry-delay 5 --retry-all-errors \
"$BASE/v1/videos/$ID/content" \
-H "Authorization: Bearer $API_KEY" \
-o grok-video.mp4
base64 < ./reference.png | tr -d '\n' | \
jq -Rs '{
model: "grok-imagine-video-1.5",
prompt: "Animate this still image with a slow cinematic camera move",
image: {url: ("data:image/png;base64," + .)},
duration: 10,
resolution: "720p"
}' > grok-video-request.json
curl -sS --fail-with-body \
https://api.luckyapi.online/v1/videos/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @grok-video-request.json | jq .
curl -sS --fail-with-body \
https://api.luckyapi.online/v1/videos/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1.5",
"prompt": "Use the person from <IMAGE_0> and the clothing from <IMAGE_1>",
"reference_images": [
{"url": "https://example.com/person.png"},
{"url": "https://example.com/clothing.png"}
],
"duration": 10,
"aspect_ratio": "16:9",
"resolution": "720p"
}' | jq .
Reserved for a future Gemini Omni integration. No public endpoint is available yet; the official endpoint, model name, and examples will appear here when it launches.
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 |
|---|