Claude-skill-registry glif-integration-expert
Integrate Glif into apps, Discord bots, and web projects. Use when building Glif-powered features.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/glif-integration-expert" ~/.claude/skills/majiayu000-claude-skill-registry-glif-integration-expert && rm -rf "$T"
manifest:
skills/data/glif-integration-expert/SKILL.mdsource content
Glif Integration Expert
Embed Glif AI workflows into applications and services.
Integration Options
1. Direct API (Server-side)
Node.js/TypeScript:
async function runGlif(glifId: string, inputs: string[]) { const res = await fetch('https://simple-api.glif.app', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.GLIF_API_TOKEN}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ id: glifId, inputs }) }); const data = await res.json(); if (data.error) throw new Error(data.error); return data.output; }
Python:
import requests def run_glif(glif_id: str, inputs: list[str]) -> str: res = requests.post( 'https://simple-api.glif.app', headers={'Authorization': f'Bearer {GLIF_API_TOKEN}'}, json={'id': glif_id, 'inputs': inputs} ) data = res.json() if 'error' in data: raise Exception(data['error']) return data['output']
2. Cloudflare Worker (Serverless)
export default { async fetch(request, env) { const { glifId, inputs } = await request.json(); const res = await fetch('https://simple-api.glif.app', { method: 'POST', headers: { 'Authorization': `Bearer ${env.GLIF_API_TOKEN}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ id: glifId, inputs }) }); return new Response(await res.text(), { headers: { 'Access-Control-Allow-Origin': '*' } }); } };
3. Next.js API Route
// app/api/glif/route.ts export async function POST(request: Request) { const { glifId, inputs } = await request.json(); const res = await fetch('https://simple-api.glif.app', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.GLIF_API_TOKEN}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ id: glifId, inputs }) }); return Response.json(await res.json()); }
4. Discord Bot
client.on('messageCreate', async (message) => { if (message.content.startsWith('!generate ')) { const prompt = message.content.slice(10); await message.reply('Generating...'); const result = await runGlif('YOUR_GLIF_ID', [prompt]); await message.reply(result); // Image URL or text } });
Embedding Options
Iframe Embed
<iframe src="https://glif.app/glifs/GLIF_ID/embed" width="400" height="600" frameborder="0"> </iframe>
Custom Player
Use Glif's embed SDK for custom styling and callbacks.
n8n Integration
HTTP Request Node:
- Method: POST
- URL:
https://simple-api.glif.app - Headers:
Authorization: Bearer {{$credentials.glifApi.token}} - Body:
{"id": "GLIF_ID", "inputs": ["{{$json.prompt}}"]}
Best Practices
- Store tokens in env vars - Never commit API tokens
- Handle async properly - Glif calls can take 10-60s
- Cache results - Same inputs = same outputs
- Show loading states - Users need feedback
- Rate limit client-side - Prevent credit drain
- Validate inputs - Check before sending to API
Error Handling
const data = await res.json(); if (data.error) { // Glif-level error (bad inputs, model failure) console.error('Glif error:', data.error); } if (data.price === 0 && !data.output) { // Likely auth or quota issue console.error('Possible auth/quota issue'); }
Useful Glif IDs
Find popular glifs at https://glif.app/explore Copy ID from URL:
glif.app/glifs/{THIS_PART}