Generate marketing content programmatically. BYOK — bring your own Gemini key, we handle the orchestration.
Visit Google AI Studio, sign in, and create an API key. Free tier available with generous limits.
No account needed — use stateless BYOK mode:
curl -X POST https://marketos.org/api/v1/generate/caption \
-H "Content-Type: application/json" \
-H "X-Api-Keys: $(echo '{"gemini":"YOUR_GEMINI_KEY"}' | base64)" \
-d '{
"prompt": "New product launch for our coffee brand",
"platform": "instagram"
}'
If you have a MarketOS license, register your keys once:
curl -X POST https://marketos.org/api/api-keys/register \
-H "Content-Type: application/json" \
-d '{
"licenseKey": "MOS_XXXX-XXXX-XXXX-XXXX",
"apiKeys": { "gemini": "YOUR_GEMINI_KEY" }
}'
Then use the returned mos_xxx token in all requests:
Authorization: Bearer mos_xxxxxxxxxxxx
Four authentication methods are supported, checked in this order:
| Method | Header | Description |
|---|---|---|
| Stateless BYOK | X-Api-Keys: <base64> |
Pass keys per request as base64-encoded JSON. Never stored. Maximum privacy. |
| Plan Holder | Authorization: Bearer sub_xxx or lt_xxx |
Existing MarketOS subscribers (sub_) or lifetime license holders (lt_). API access included with 1,000 requests/day. |
| Registered BYOK | Authorization: Bearer mos_xxx |
Register keys once via /api/api-keys/register. Keys encrypted at rest (AES-256-GCM). Convenient for agents. |
| x402 Payment | X-PAYMENT: <signed payload> |
Pay per request with USDC on Base. No account or signup needed. Include X-Api-Keys header alongside for your Gemini key. |
gemini — your Google Gemini API key. This is the only required AI provider key.jina — Jina Reader API key for enhanced scraping (the scrape endpoint works without it, but a Jina key removes rate limits).
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Marketing brief (e.g. "Instagram post for our new espresso blend") |
brandContext | string | No | Brand summary from /api/v1/scrape |
platform | string | No | instagram | linkedin | twitter | tiktok | general (default: instagram) |
imageModel | string | No | Image model ID (default: imagen-4.0-generate-001). See Image Models below. |
aspectRatio | string | No | 1:1 | 16:9 | 9:16 | 4:3 | 3:4 (default: 1:1) |
style | string | No | Visual style description (e.g. "minimalist flat illustration") |
language | string | No | ISO language code or auto (default: auto) |
skipImage | boolean | No | Skip image generation for faster caption-only response |
Returns: { image?, caption, hashtags, platform, imagePrompt, enhancedBrief, imageError? }
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | What the caption should be about |
platform | string | No | instagram | linkedin | twitter | tiktok | general (default: instagram) |
brandContext | string | No | Brand summary for tone matching |
hashtagThemes | string[] | No | Broad themes for hashtag generation (default: ["marketing"]) |
expanded | boolean | No | Generate longer caption (5-8 sentences) with up to 25 hashtags |
language | string | No | ISO language code or auto |
Returns: { caption, hashtags, platform }
| Parameter | Type | Required | Description |
|---|---|---|---|
topic | string | No | Topic to write about. Auto-generated from brand context if omitted. |
contentType | string | No | Content type ID (default: blog-standard). See /api/v1/info for full list of 40+ types. |
wordCount | string | No | short (~300) | medium (~600) | long (~1000) | extended (~1500). Default: medium |
brandContext | string | No | Brand summary for tone and industry matching |
language | string | No | ISO language code or auto |
Returns: { title, content, topic, contentType, wordCount }
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Image description or marketing brief |
model | string | No | Image model ID (default: imagen-4.0-generate-001). See Image Models below. |
aspectRatio | string | No | 1:1 | 16:9 | 9:16 | 4:3 | 3:4 (default: 1:1). Imagen models only. |
numberOfImages | number | No | 1–4 images per request (default: 1). Imagen models only. |
brandContext | string | No | Brand context appended to prompt (first 500 chars) |
style | string | No | Visual style description appended to prompt |
Returns: { images: [{ base64, mimeType }], model, prompt }
| Model ID | Name | Notes |
|---|---|---|
imagen-4.0-generate-001 | Imagen 4 | Default. High quality, supports aspect ratio and multi-image. |
imagen-4.0-fast-generate-001 | Imagen 4 Fast | Faster generation, slightly lower quality. |
imagen-4.0-ultra-generate-001 | Imagen 4 Ultra | Highest quality. Best for hero images. |
gemini-2.5-flash-image | Gemini 2.5 Flash Image | Gemini-based. No aspect ratio or multi-image support. |
gemini-3-pro-image-preview | Gemini 3 Pro Image | Gemini-based. Preview model. |
brandContext in generation endpoints.| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Website URL to scrape (auto-prefixed with https:// if missing) |
existingContext | string | No | Existing brand context to merge with new scrape results |
Returns: { url, title, tagline, description, content }
content field in the response is an 800–1200 word brand summary. Pass it directly as brandContext to any generation endpoint for brand-aligned output. Scrape multiple pages and use existingContext to build a comprehensive brand profile.
Returns the full API schema including all 40+ content types, image models, word count options, platform list, rate limits, pricing, and agent skill references. Ideal for AI agent discovery.
An AI agent can chain these endpoints to generate branded content:
// Step 1: Extract brand context
POST /api/v1/scrape
{ "url": "https://coffeeshop.com" }
→ { "content": "Premium artisan coffee roaster...", "title": "...", ... }
// Step 2: Generate complete marketing post
POST /api/v1/generate/marketing
{
"prompt": "Instagram post for our new espresso blend",
"brandContext": "Premium artisan coffee roaster...",
"platform": "instagram"
}
→ {
"image": { "base64": "...", "mimeType": "image/png" },
"caption": "Every cup tells a story ☕...",
"hashtags": ["coffee", "espresso", ...],
"platform": "instagram",
"imagePrompt": "...",
"enhancedBrief": "..."
}
// Or generate individual pieces:
POST /api/v1/generate/caption
{ "prompt": "New espresso blend launch", "platform": "twitter" }
POST /api/v1/generate/content
{ "topic": "Why single-origin matters", "contentType": "blog-standard", "wordCount": "long" }
POST /api/v1/generate/image
{ "prompt": "Steaming espresso cup, morning light", "model": "imagen-4.0-generate-001" }
| Plan | API Access | Daily Quota | Cost |
|---|---|---|---|
| Subscription | Included | 1,000 req/day | $19.99/month |
| Lifetime License | Included | 1,000 req/day | $199 one-time |
| API-Only (x402) | Pay per request | Unlimited | $0.05 generation / $0.01 lightweight |
| Endpoint | Fee | Category |
|---|---|---|
/api/v1/generate/marketing | $0.05 | Generation |
/api/v1/generate/image | $0.05 | Generation |
/api/v1/generate/content | $0.05 | Generation |
/api/v1/generate/caption | $0.01 | Lightweight |
/api/v1/scrape | $0.01 | Lightweight |
30 requests per minute per token or IP. Responses include Retry-After header when limited. Plan holders have a separate 1,000 requests/day quota that resets at midnight UTC.
| Status | Meaning |
|---|---|
| 400 | Bad request — missing or invalid parameters |
| 401 | Authentication failed — invalid token or API key |
| 402 | Payment required — x402 payment needed (no plan token provided). Response includes X-PAYMENT-REQUIRED header with payment details. |
| 403 | Forbidden — inactive or expired license |
| 422 | Unprocessable — content filtered by safety systems |
| 429 | Rate limited — wait and retry (check Retry-After header) |
| 500 | Server error |
| 502 | Upstream error — external API (Gemini, Jina) failed |
MarketOS supports the x402 payment protocol for autonomous AI agent payments. No signup, no API keys, no merchant account needed.
1. Agent sends request without auth → Server responds 402 with X-PAYMENT-REQUIRED header 2. Agent reads payment requirements from header: - Amount (e.g., 0.05 USDC) - Wallet address - Network (Base mainnet) 3. Agent signs USDC payment on Base blockchain 4. Agent retries request with: - X-PAYMENT header (signed payment payload) - X-Api-Keys header (base64 Gemini key for BYOK) 5. Server verifies payment via Coinbase facilitator → Returns the generated content
Payments are in USDC on Base (Ethereum L2). The Coinbase facilitator verifies payments at no cost to either party. Agents using x402-compatible wallets can pay autonomously without human intervention.
GET /api/v1/info endpoint returns full payment details including the wallet address, network, and facilitator URL. Your agent can discover everything it needs programmatically.
All API endpoints use Google Gemini exclusively:
| Use Case | Model |
|---|---|
| Caption generation | gemini-flash-lite-latest |
| Content generation | gemini-flash-lite-latest |
| Intent parsing (marketing pipeline) | gemini-flash-lite-latest |
| Brand context summarization | gemini-flash-lite-latest |
| Image generation | Imagen 4 / Gemini image models (see table above) |
The scrape endpoint also uses Jina Reader API for web content extraction. A Jina API key is optional but recommended for higher rate limits.
MarketOS provides multiple discovery mechanisms for AI agents:
| Resource | URL | Purpose |
|---|---|---|
| llms.txt | /llms.txt | Concise API overview for LLMs |
| llms-full.txt | /llms-full.txt | Detailed API reference for LLMs |
| SKILL.md | /skills/marketos/SKILL.md | Agent skill definition (OpenClaw compatible) |
| API Info | /api/v1/info | Machine-readable JSON with full capabilities |