Documents

Connecting Alchemyst AI with Gemini

Connecting Alchemyst AI with Gemini

This document provides comprehensive technical documentation for connecting Alchemyst AI with the Google Gemini API using Alchemyst AI's provided proxy endpoint. All information here is derived strictly from the provided OpenAPI v3 specification and context. No credential handling, implementation details, or configuration steps are included beyond the description in the API documentation.

Overview

Alchemyst AI provides proxy endpoints to integrate with various AI services, including a dedicated endpoint for the Google Gemini API. The integration is designed to validate and forward requests, as well as to handle responses, following the structure outlined by Gemini.

Authentication for these endpoints is handled via Bearer token.

Relevant Endpoint

POST /api/v1/proxy/{geminiUrl}/v1beta/models/{modelNameAndTask}

  • Summary: Proxy endpoint for Google Gemini API (coming soon)
  • Description: Forwards requests to the Google Gemini API with validation and error handling.
  • Authentication: Bearer token required (bearerAuth)

Path Parameters

  • geminiUrl (string): The base URL for the Google Gemini API.
  • modelNameAndTask (string): The Gemini model name and task. Follows structure as required by Gemini (for example: gemini-1.0-pro-vision:generateContent).

Request Body

  • Content-Type: application/json
  • Required: Yes
Schema
{

  "contents": [

    {

      "parts": [

        { "text": "string" }

      ]

    }

  ],

  "generationConfig": {

    "temperature": number (0-1, optional),

    "topK": number (>=1, optional),

    "topP": number (0-1, optional),

    "maxOutputTokens": number (>=1, optional)

  },

  "safetySettings": [

    {

      "category": "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_DANGEROUS_CONTENT",

      "threshold": "BLOCK_NONE" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_HIGH_AND_ABOVE"

    }

  ]

}

  • contents: Required. Array of message objects, each with a parts array of message parts (currently only text part is supported).
  • generationConfig: Optional. Settings for generation such as temperature, top-k, top-p, and maximum output tokens.
  • safetySettings: Optional. Array of safety category/threshold objects to enforce content rules on Gemini output.

Example Request

``` POST /api/v1/proxy/{geminiUrl}/v1beta/models/{modelNameAndTask} Authorization: Bearer {access-token} Content-Type: application/json

{ "contents": [ { "parts": [ { "text": "Generate a marketing summary" } ] } ], "generationConfig": { "temperature": 0.7, "topK": 30, "topP": 0.85, "maxOutputTokens": 512 }, "safetySettings": [ { "category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_MEDIUM_AND_ABOVE" } ] } ```

Responses

  • 200 OK: Success. Returns Gemini-compatible output structure: ``` { "candidates": [ { "content": { "parts": [ { "text": "Your generated content here" } ] }, "finishReason": "string", "safetyRatings": [ { "category": "string", "probability": "string" } ] } ], "promptFeedback": { "safetyRatings": [ { "category": "string", "probability": "string" } ] } } ```

  • 400 Bad Request: Invalid request format

  • 500 Internal Server Error: Internal processing error

Security

All calls to the proxy endpoint must be authenticated using a valid Bearer token.

Notes & Additional Considerations

  • The detailed integration implementation, credential handling (for Gemini), and setup are not included or specified in the current documentation. The actual forwarding to Gemini, error handling, and output formatting are performed by Alchemyst AI.
  • The Gemini proxy endpoint is marked as "coming soon"; availability may depend on API deployment status.
  • This endpoint is designed as a pass-through with validation, not as a native Gemini implementation.

Reference Links

  • No external or additional reference materials are provided. For credential setup or deeper Gemini documentation, refer to the Google Gemini official API docs.

If you require any specifics not provided by this API structure, context states: "Context not found."