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.
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.
POST /api/v1/proxy/{geminiUrl}/v1beta/models/{modelNameAndTask}bearerAuth)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).application/json{
"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.``` 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" } ] } ```
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
All calls to the proxy endpoint must be authenticated using a valid Bearer token.
If you require any specifics not provided by this API structure, context states: "Context not found."