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.
From sign-up to your first request in about five minutes.
Create an account: register with email or Google, then open the console.
Top up: open Wallet in the console and pay with PayPal — Visa, Mastercard and Amex work without a PayPal account, starting from $1.
Create an API key: open API Keys in the console, create a key and copy it somewhere safe.
Send your first request with the command below, replacing YOUR_API_KEY with your key.
curl https://api.luckyapi.online/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"input": "Introduce yourself in one sentence"
}'
Next: connect a coding tool, or call the media APIs directly. CC SwitchGPT Image
Every request goes to the same Base URL and authenticates with your API key as a Bearer token.
https://api.luckyapi.online
Authorization: Bearer YOUR_API_KEY
| OpenAI Responses | POST /v1/responses |
| OpenAI Chat Completions | POST /v1/chat/completions |
| Anthropic Messages | POST /v1/messages |
| Model list | GET /v1/models |
| Image generation & edits | POST /v1/images/generations · /v1/images/edits |
| Video generation (async) | POST /v1/videos/generations |
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 .
POST /v1/videos/generationsGemini Omni is an asynchronous video API. It supports text-to-video, one local first-frame image, or 1–5 local reference images, and returns one MP4 per request.
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": "gemini-omni-flash",
"prompt": "A cinematic sunrise over the ocean with a slow camera push",
"duration": 8,
"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 gemini-omni.mp4
curl -sS --fail-with-body \
https://api.luckyapi.online/v1/videos/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gemini-omni-flash" \
-F "prompt=Animate this first frame with a slow cinematic camera move" \
-F "duration=8" \
-F "aspect_ratio=16:9" \
-F "resolution=720p" \
-F "image=@./first-frame.jpg;type=image/jpeg" | jq .
curl -sS --fail-with-body \
https://api.luckyapi.online/v1/videos/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gemini-omni-flash" \
-F "prompt=Use the person and wardrobe from the reference images" \
-F "duration=8" \
-F "aspect_ratio=9:16" \
-F "resolution=720p" \
-F "reference_images=@./person.png;type=image/png" \
-F "reference_images=@./wardrobe.jpg;type=image/jpeg" | jq .
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 |
|---|