This document provides simple API usage examples, including OpenAI-compatible API, Gemini native API, and Anthropic-compatible API formats.
curl -X POST http://localhost:7860/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"model": "gemini-flash-lite-latest",
"messages": [
{
"role": "user",
"content": "Hello, how are you?"
}
],
"stream": false
}'curl -X POST http://localhost:7860/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"model": "gemini-flash-lite-latest",
"messages": [
{
"role": "user",
"content": "Write a short poem about autumn"
}
],
"stream": true
}'🖼️ Generate Image Official Docs
curl -X POST http://localhost:7860/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"model": "gemini-3.1-flash-lite-image",
"messages": [
{
"role": "user",
"content": "Generate a kitten"
}
],
"stream": false
}'curl -X POST http://localhost:7860/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"model": "gemini-3.1-flash-lite-image",
"messages": [
{
"role": "user",
"content": "Generate a kitten"
}
],
"stream": true
}'📐 Text Embeddings Official Docs
curl -X POST http://localhost:7860/v1/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"model": "gemini-embedding-001",
"input": "What is artificial intelligence?"
}'curl -X POST http://localhost:7860/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"model": "gemini-flash-lite-latest",
"input": "Summarize the main idea of functional programming in 3 sentences.",
"stream": false
}'curl -X POST http://localhost:7860/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"model": "gemini-flash-lite-latest",
"input": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "Write a short poem about autumn."
}
]
}
],
"stream": true
}'curl -X POST http://localhost:7860/v1beta/models/gemini-flash-lite-latest:generateContent \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Hello, how are you?"
}
]
}
]
}'curl -X POST http://localhost:7860/v1beta/models/gemini-flash-lite-latest:streamGenerateContent?alt=sse \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Write a short poem about autumn"
}
]
}
]
}'🖼️ Generate Image Official Docs
curl -X POST http://localhost:7860/v1beta/models/gemini-3.1-flash-lite-image:generateContent \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Generate a kitten"
}
]
}
]
}'curl -X POST http://localhost:7860/v1beta/models/gemini-3.1-flash-lite-image:streamGenerateContent?alt=sse \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Generate a kitten"
}
]
}
]
}'🎵 Lyria Music Generation Official Docs
curl -X POST http://localhost:7860/v1beta/models/lyria-3-clip-preview:generateContent \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"contents": [
{
"parts": [
{
"text": "Create a 30-second cheerful acoustic folk song with guitar and harmonica."
}
]
}
]
}'curl -X POST http://localhost:7860/v1beta/models/lyria-3.5:generateContent \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"contents": [
{
"parts": [
{
"text": "Create an epic cinematic orchestral piece about a journey home. Start with a solo piano, build through sweeping strings, and end with a powerful climax."
}
]
}
]
}'🎧 Audio Transcription Official Docs
curl -X POST http://localhost:7860/v1beta/models/gemini-3.5-transcribe:generateContent \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"contents": [
{
"parts": [
{
"fileData": {
"fileUri": "YOUR_FILE_URI",
"mimeType": "audio/mp3"
}
}
]
}
]
}'🎤 TTS (Text-to-Speech) Official Docs
curl -X POST http://localhost:7860/v1beta/models/gemini-3.8-flash-tts:generateContent \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Have a wonderful day!",
"speech_metadata": {
"style": "cheerful and friendly"
}
}
]
}
],
"generationConfig": {
"responseModalities": ["AUDIO"],
"speechConfig": {
"voiceConfig": {
"voice": "Kore"
}
}
}
}'For multi-speaker dialogue, place each speaker's text in a separate part and match speech_metadata.speaker to the voice configuration.
curl -X POST http://localhost:7860/v1beta/models/gemini-3.8-flash-tts:generateContent \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "How is it going today, Jane?",
"speech_metadata": {
"speaker": "Joe",
"style": "cheerful and friendly"
}
},
{
"text": "Not too bad. How about you? Ready to test these new voices?",
"speech_metadata": {
"speaker": "Jane",
"style": "calm and relaxed"
}
}
]
}
],
"generationConfig": {
"responseModalities": ["AUDIO"],
"speechConfig": {
"multiSpeakerVoiceConfig": {
"speakerVoiceConfigs": [
{
"speaker": "Joe",
"voiceConfig": {
"prebuiltVoiceConfig": {
"voiceName": "Puck"
}
}
},
{
"speaker": "Jane",
"voiceConfig": {
"prebuiltVoiceConfig": {
"voiceName": "Kore"
}
}
}
]
}
}
}
}'📐 Text Embeddings Official Docs
Use the embedContent or batchEmbedContents endpoint to generate text embedding vectors.
curl -X POST http://localhost:7860/v1beta/models/gemini-embedding-001:embedContent \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"model": "models/gemini-embedding-001",
"content": {
"parts": [
{
"text": "What is artificial intelligence?"
}
]
}
}'curl -X POST http://localhost:7860/v1beta/models/gemini-embedding-001:batchEmbedContents \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"requests": [
{
"model": "models/gemini-embedding-001",
"content": {
"parts": [
{
"text": "What is artificial intelligence?"
}
]
}
}
]
}'curl -X POST http://localhost:7860/v1beta/models/gemini-embedding-001:batchEmbedContents \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-1" \
-d '{
"requests": [
{
"model": "models/gemini-embedding-001",
"content": {
"parts": [
{
"text": "What is artificial intelligence?"
}
]
}
},
{
"model": "models/gemini-embedding-001",
"content": {
"parts": [
{
"text": "What is the difference between machine learning and deep learning?"
}
]
}
}
]
}'curl -X POST http://localhost:7860/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key-1" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "gemini-flash-lite-latest",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, how are you?"
}
],
"stream": false
}'curl -X POST http://localhost:7860/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key-1" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "gemini-flash-lite-latest",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Write a poem about autumn"
}
],
"stream": true
}'