@@ -615,6 +615,132 @@ curl -X POST "http://127.0.0.1:7861/v1/messages" \
615615- Supports all Claude standard parameters
616616- Response format follows Claude API specification
617617
618+ # ### 4. Antigravity API Endpoints
619+
620+ **Supports three formats: OpenAI, Gemini, and Claude**
621+
622+ # #### Antigravity OpenAI Format Endpoints
623+
624+ **Endpoint:** `/antigravity/v1/chat/completions`
625+ **Authentication:** `Authorization: Bearer your_api_password`
626+
627+ **Request Example:**
628+ ` ` ` bash
629+ curl -X POST "http://127.0.0.1:7861/antigravity/v1/chat/completions" \
630+ -H "Authorization: Bearer your_api_password" \
631+ -H "Content-Type: application/json" \
632+ -d '{
633+ "model": "claude-sonnet-4-5",
634+ "messages": [
635+ {"role": "user", "content": "Hello"}
636+ ],
637+ "stream": true
638+ }'
639+ ` ` `
640+
641+ # #### Antigravity Gemini Format Endpoints
642+
643+ **Non-streaming Endpoint:** `/antigravity/v1/models/{model}:generateContent`
644+ **Streaming Endpoint:** `/antigravity/v1/models/{model}:streamGenerateContent`
645+
646+ **Authentication Methods (choose one):**
647+ - `Authorization : Bearer your_api_password`
648+ - `x-goog-api-key : your_api_password`
649+ - URL parameter : ` ?key=your_api_password`
650+
651+ **Request Examples:**
652+ ` ` ` bash
653+ # Gemini format non-streaming request
654+ curl -X POST "http://127.0.0.1:7861/antigravity/v1/models/claude-sonnet-4-5:generateContent" \
655+ -H "x-goog-api-key: your_api_password" \
656+ -H "Content-Type: application/json" \
657+ -d '{
658+ "contents": [
659+ {"role": "user", "parts": [{"text": "Hello"}]}
660+ ],
661+ "generationConfig": {
662+ "temperature": 0.7
663+ }
664+ }'
665+
666+ # Gemini format streaming request
667+ curl -X POST "http://127.0.0.1:7861/antigravity/v1/models/gemini-2.5-flash:streamGenerateContent?key=your_api_password" \
668+ -H "Content-Type: application/json" \
669+ -d '{
670+ "contents": [
671+ {"role": "user", "parts": [{"text": "Hello"}]}
672+ ]
673+ }'
674+ ` ` `
675+
676+ # #### Antigravity Claude Format Endpoints
677+
678+ **Endpoint:** `/antigravity/v1/messages`
679+ **Authentication:** `x-api-key: your_api_password`
680+
681+ **Request Example:**
682+ ` ` ` bash
683+ curl -X POST "http://127.0.0.1:7861/antigravity/v1/messages" \
684+ -H "x-api-key: your_api_password" \
685+ -H "anthropic-version: 2023-06-01" \
686+ -H "Content-Type: application/json" \
687+ -d '{
688+ "model": "claude-sonnet-4-5",
689+ "max_tokens": 1024,
690+ "messages": [
691+ {"role": "user", "content": "Hello"}
692+ ]
693+ }'
694+ ` ` `
695+
696+ **Supported Antigravity Models:**
697+ - Claude series : ` claude-sonnet-4-5` , `claude-opus-4-5`, etc.
698+ - Gemini series : ` gemini-2.5-flash` , `gemini-2.5-pro`, etc.
699+ - Automatically supports thinking models
700+
701+ **Gemini Native Example:**
702+ ` ` ` python
703+ from io import BytesIO
704+ from PIL import Image
705+ from google.genai import Client
706+ from google.genai.types import HttpOptions
707+ from google.genai import types
708+ # The client gets the API key from the environment variable ` GEMINI_API_KEY`.
709+
710+ client = Client(
711+ api_key="pwd",
712+ http_options=HttpOptions(base_url="http://127.0.0.1:7861"),
713+ )
714+
715+ prompt = (
716+ " " "
717+ Draw a cat
718+ " " "
719+ )
720+
721+ response = client.models.generate_content(
722+ model="gemini-3.1-flash-image",
723+ contents=[prompt],
724+ config=types.GenerateContentConfig(
725+ image_config=types.ImageConfig(
726+ aspect_ratio="16:9",
727+ )
728+ )
729+ )
730+ for part in response.candidates[0].content.parts :
731+ if part.text is not None :
732+ print(part.text)
733+ elif part.inline_data is not None :
734+ image = Image.open(BytesIO(part.inline_data.data))
735+ image.save("generated_image.png")
736+
737+ ```
738+
739+ ** Notes:**
740+ - OpenAI endpoints return OpenAI-compatible format
741+ - Gemini endpoints return Gemini native format
742+ - Both endpoints use the same API password
743+
618744## 📋 Complete API Reference
619745
620746### Web Console API
0 commit comments