> ## Documentation Index
> Fetch the complete documentation index at: https://docs.geekai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini 兼容

除了 Anthropic 以外，极客智坊还提供了针对 Gemini API 兼容的接口服务，以便在 Gemini CLI 等编程工具中使用，该接口目前**仅支持 Gemini 系列模型**。

你可以通过 Gemini SDK 来调用这些模型，使用方法和调用 Anthropic 兼容模型类似，只需要将 Base URL 和 API KEY 替换成极客智坊的 Base URL 和 API KEY 即可，其他参数和调用方式与官方 Gemini API 保持一致：

<CodeGroup>
  ```bash curl theme={null}
  curl https://geekai.co/api/v1beta/models/gemini-3-flash-preview:generateContent \
  -H "content-type: application/json" \
  -H "x-goog-api-key: $GEEKAI_API_KEY" \
  -X POST \
  -d '{
      "contents": [
        {
          "parts": [
            {
              "text": "Hello, Gemini"
            }
          ]
        }
      ]
    }'
  ```

  ```bash python theme={null}
  from google import genai
  from google.genai import types

  client = genai.Client(
      http_options=types.HttpOptions(base_url='https://geekai.co/api'),
      api_key="$GEEKAI_API_KEY"
  )

  response = client.models.generate_content(
      model="gemini-3-flash-preview",
      contents="Hello, Gemini",
  )

  print(response.text)
  ```

  ```bash javascript theme={null}
  import { GoogleGenAI } from "@google/genai";

  const ai = new GoogleGenAI({
    apiKey: "$GEEKAI_API_KEY",
    httpOptions: {
      baseUrl: "https://geekai.co/api",
    },
  });

  async function main() {
    const response = await ai.models.generateContent({
      model: "gemini-3-flash-preview",
      contents: "Hello, Gemini",
    });
    console.log(response.text);
  }

  await main();
  ```

  ```bash go theme={null}
  package main

  import (
      "context"
      "fmt"
      "log"
      "google.golang.org/genai"
  )

  func main() {
      ctx := context.Background()
      httpOptions := genai.HTTPOptions{
        BaseURL:    "https://geekai.co/api",
        APIVersion: "v1beta",
      }
      client, err := genai.NewClient(ctx, 
        &genai.ClientConfig{
  				APIKey:      "$GEEKAI_API_KEY",
  				Backend:     genai.BackendGeminiAPI,
  				HTTPOptions: httpOptions,
  			},
      )
      if err != nil {
          log.Fatal(err)
      }

      result, err := client.Models.GenerateContent(
          ctx,
          "gemini-3-flash-preview",
          genai.Text("Hello, Gemini"),
          nil,
      )
      if err != nil {
          log.Fatal(err)
      }
      fmt.Println(result.Text())
  }
  ```
</CodeGroup>
