### Node.js / TypeScript Quick Start Source: https://docs.deapi.ai/openai-compatibility Example of how to initialize the OpenAI client with deAPI's baseURL and apiKey for image generation. ```APIDOC ## Node.js / TypeScript Quick Start ### Description Initialize the OpenAI client with deAPI's `baseURL` and `apiKey` to use deAPI's services. ### Method ```javascript import OpenAI from "openai"; const client = new OpenAI({ apiKey: "dpn-sk-your-token-here", baseURL: "https://oai.deapi.ai/v1", }); // Generate an image — same call as OpenAI const response = await client.images.generate({ model: "Flux1schnell", prompt: "A futuristic city at sunset, cinematic lighting", size: "1024x1024", n: 1, }); console.log(response.data[0].url); ``` ``` -------------------------------- ### Python Quick Start Source: https://docs.deapi.ai/openai-compatibility Example of how to initialize the OpenAI client with deAPI's base URL and API key for image generation. ```APIDOC ## Python Quick Start ### Description Initialize the OpenAI client with deAPI's `base_url` and `api_key` to use deAPI's services. ### Method ```python from openai import OpenAI client = OpenAI( api_key="dpn-sk-your-token-here", base_url="https://oai.deapi.ai/v1" ) # Generate an image — same call as OpenAI response = client.images.generate( model="Flux1schnell", prompt="A futuristic city at sunset, cinematic lighting", size="1024x1024", n=1 ) print(response.data[0].url) ``` ``` -------------------------------- ### Multi-Provider Setup with Separate Clients Source: https://docs.deapi.ai/openai-compatibility Instantiate separate clients for different providers when using multiple LLM services. This example shows how to set up clients for OpenAI and deAPI for different tasks. ```python import os from openai import OpenAI # OpenAI client for chat openai_chat_client = OpenAI( api_key=os.environ.get("OPENAI_API_KEY"), base_url=os.environ.get("OPENAI_BASE_URL"), ) # deAPI client for images and audio deapi_client = OpenAI( api_key=os.environ.get("DEAPI_API_KEY"), base_url="https://oai.deapi.ai/v1", ) ``` -------------------------------- ### Python Quick Start with OpenAI Compatibility Source: https://docs.deapi.ai/openai-compatibility Initialize the OpenAI client with your API key. This snippet demonstrates the basic setup for using the deAPI OpenAI-compatible API in Python. ```python from openai import OpenAI client = OpenAI( api_key="dpn-sk-your-token-here", ) ``` -------------------------------- ### Instantiate Separate Clients for Multi-Provider Setups Source: https://docs.deapi.ai/openai-compatibility When using multiple providers for different tasks (e.g., OpenAI for chat, deAPI for images), instantiate separate client objects. This example shows how to set up both an OpenAI client and a deAPI client using environment variables. ```python import os from openai import OpenAI openai_client = OpenAI( api_key=os.environ["OPENAI_KEY"]) deapi_client = OpenAI( api_key=os.environ["DEAPI_KEY"], base_url=os.environ["DEAPI_BASE_URL"] ) ``` -------------------------------- ### cURL Quick Start Source: https://docs.deapi.ai/openai-compatibility Example of how to make an image generation request using cURL to deAPI's endpoint. ```APIDOC ## cURL Quick Start ### Description Use cURL to send a POST request to the deAPI image generation endpoint, including your API key in the Authorization header. ### Method ```bash curl -X POST "https://oai.deapi.ai/v1/images/generations" \ -H "Authorization: Bearer dpn-sk-your-token-here" \ -H "Content-Type: application/json" \ ``` -------------------------------- ### LLM Text Generation Example Source: https://deapi.ai/playground/image-to-image Demonstrates text generation using a hypothetical LLM model. Requires LLM model setup and API access. ```python from deapi_llms import LLMClient client = LLMClient(api_key='YOUR_API_KEY') def generate_text(prompt: str, max_tokens: int = 100) -> str: """Generates text based on a prompt using the LLM.""" response = client.generate(prompt=prompt, max_tokens=max_tokens) return response.text ``` -------------------------------- ### Python Quick Start with deAPI Source: https://docs.deapi.ai/openai-compatibility This Python snippet demonstrates how to quickly integrate with deAPI's OpenAI-compatible API. Ensure you have the necessary libraries installed and configure the base URL and API key. ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.deapi.ai/v1", ) completion = client.chat.completions.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"} ] ) print(completion.choices[0].message.content) ``` -------------------------------- ### Basic Usage Example Source: https://docs.deapi.ai/openai-compatibility This example demonstrates a basic interaction with the deAPI service, mimicking an OpenAI API call. It shows how to set up the client and make a request. ```javascript import OpenAI from 'openai'; const openai = new OpenAI({ apiKey: 'YOUR_API_KEY', baseURL: 'https://api.deapi.ai/v1' }); async function main() { const completion = await openai.chat.completions.create({ model: 'gpt-4', messages: [{ role: 'user', content: 'Hello world' }] }); console.log(completion.choices[0].message.content); } main(); ``` -------------------------------- ### OpenAI TTS Example Source: https://docs.deapi.ai/openai-compatibility This example demonstrates how to use the OpenAI client to create an audio transcription. It specifies the audio file, the desired response format, and the model to use. ```python with open("audio.mp3", "rb") as audio_file: transcript = client.audio.transcriptions.create("whisper-1", audio_file) ``` -------------------------------- ### Example Response for Available Models Source: https://docs.deapi.ai/openai-compatibility This is an example of the JSON response format when listing available models, which follows the OpenAI specification. ```json { "object": "list", "data": [ { "id": "Flux1schnell", "object": "model", "created": 1700000000, "owned_by": "deapi" }, { "id": "Kokoro", "object": "model", "created": 1700000000, "owned_by": "deapi" } ] } ``` -------------------------------- ### Custom LLM Prompting Source: https://deapi.ai/playground/image-to-image Example of constructing and executing a custom prompt for an LLM. Ensure LLM client is configured. ```python from deapi_llms import LLMClient client = LLMClient(api_key='YOUR_API_KEY') def custom_llm_task(input_data: str, task_instruction: str) -> str: """Performs a custom task using the LLM based on instructions.""" prompt = f"{task_instruction}\n\nInput: {input_data}" response = client.generate(prompt=prompt, max_tokens=200) return response.text ``` -------------------------------- ### File Upload Example Source: https://docs.deapi.ai/openai-compatibility This example shows how to upload a file using the deAPI service. Note that the file upload endpoint is marked as 'Coming soon'. ```javascript import OpenAI from 'openai'; import fs from 'fs'; const openai = new OpenAI({ apiKey: 'YOUR_API_KEY', baseURL: 'https://api.deapi.ai/v1' }); async function main() { const file = await openai.files.create({ file: fs.createReadStream('my_file.txt'), purpose: 'fine-tune' }); console.log(file.id); } ``` -------------------------------- ### Sample Prompts Source: https://docs.deapi.ai/ Get sample prompts for AI inference tasks based on type. ```APIDOC ## GET /api/v1/client/prompts/samples ### Description Get sample prompts for AI inference tasks based on type and optional parameters. ### Method GET ### Endpoint /api/v1/client/prompts/samples ``` -------------------------------- ### Sample Prompts Source: https://docs.deapi.ai/openai-compatibility Get sample prompts for AI inference tasks based on type and optional topic. ```APIDOC ## GET /api/v1/client/prompts/samples ### Description Get sample prompts for AI inference tasks based on type and optional topic. ### Method GET ### Endpoint /api/v1/client/prompts/samples ``` -------------------------------- ### LLM API Call Example Source: https://deapi.ai/playground/image-to-image A basic example of how to call a hypothetical LLM API. Replace 'call_llm_api' with your actual API client function. ```python import requests def call_llm_api(prompt): api_url = "YOUR_LLM_API_ENDPOINT" headers = {"Authorization": "Bearer YOUR_API_KEY"} data = {"prompt": prompt, "max_tokens": 150} response = requests.post(api_url, headers=headers, json=data) response.raise_for_status() # Raise an exception for bad status codes return response ``` -------------------------------- ### Image Generation Example Source: https://docs.deapi.ai/openai-compatibility Demonstrates how to generate an image using the DALL-E model. It includes parameters for controlling the style and quality of the generated image. ```javascript import OpenAI from 'openai'; const openai = new OpenAI({ apiKey: 'YOUR_API_KEY', baseURL: 'https://api.deapi.ai/v1' }); async function main() { const image = await openai.images.generate({ model: 'dall-e-3', prompt: 'A cute baby sea otter', n: 1, size: '1024x1024', style: 'vivid' }); console.log(image.data[0].url); } ``` -------------------------------- ### Sample Text-to-Image Prompt Source: https://deapi.ai/models A detailed prompt for generating an image of a bioluminescent forest. Use this as a starting point for creating fantastical landscapes. ```text Ethereal bioluminescent forest at twilight, ancient massive trees with glowing cyan and purple fungi growing on bark, fireflies creating streams of golden light, misty atmosphere with rays of moonlight filtering through canopy, crystal-clear stream reflecting the magical lights, ultra-detailed fantasy landscape, cinematic composition, volumetric fog, dreamlike atmosphere ``` -------------------------------- ### LlamaIndex OpenAI Embeddings Setup Source: https://docs.deapi.ai/openai-compatibility Set up OpenAI embeddings within LlamaIndex. This example shows the import and instantiation of the `OpenAIEmbedding` class. ```python from llama_index.embeddings.openai import OpenAIEmbedding ``` -------------------------------- ### Quick Start: Initialize OpenAI Client (Node.js/TypeScript) Source: https://deapi.ai/llms.txt Set up the OpenAI client for Node.js or TypeScript, specifying your API key and the deAPI base URL. ```typescript import OpenAI from "openai"; const client = new OpenAI({ apiKey: "dpn-sk-your-token-here", baseURL: "https://oai.deapi.ai/v1", }); const response = await client.images.generate({ model: "Flux1schnell", prompt: "A futuristic city at sunset, cinematic lighting", size: "1024x1024", n: 1, }); ``` -------------------------------- ### Python Quick Start for Image Generation Source: https://docs.deapi.ai/openai-compatibility Initialize the OpenAI client with your deAPI key and base URL. Then, use the `images.generate` call, which is identical to the OpenAI SDK. ```python from openai import OpenAI client = OpenAI( api_key="dpn-sk-your-token-here", base_url="https://oai.deapi.ai/v1" ) # Generate an image — same call as OpenAI response = client.images.generate( model="Flux1schnell", prompt="A futuristic city at sunset, cinematic lighting", size="1024x1024", n=1 ) print(response.data[0].url) ``` -------------------------------- ### Generating Product Descriptions with LLM Source: https://deapi.ai/playground/image-to-image This example demonstrates using an LLM to generate compelling product descriptions. Provide key features and target audience for tailored results. ```python from deapi_ai_llms_txt import LLM llm = LLM() def generate_product_description(product_name, features): prompt = f"Generate a product description for '{product_name}' with the following features: {', '.join(features)}" response = llm.generate(prompt) return response product = "Smartwatch X" product_features = ["Heart rate monitor", "GPS tracking", "Water resistant", "Long battery life"] print(generate_product_description(product, product_features)) ``` -------------------------------- ### Initialize OpenAI Client Source: https://docs.deapi.ai/openai-compatibility Instantiate the OpenAI client with your API key and the deAPI base URL. ```APIDOC ## Initialize OpenAI Client ### Description Instantiate the OpenAI client with your API key and the deAPI base URL. ### Code ```python import openai client = openai.OpenAI( api_key="dpn-sk-your-token-here", # ← changed base_url="https://oai.deapi.ai/v1" # ← changed ) ``` ``` -------------------------------- ### Embeddings API Example Source: https://docs.deapi.ai/openai-compatibility Example of how to create embeddings using the deAPI AI service, compatible with OpenAI's API. ```APIDOC ## POST /v1/embeddings ### Description Creates embeddings for a given input text. This endpoint is compatible with OpenAI's embeddings API. ### Method POST ### Endpoint https://oai.deapi.ai/v1/embeddings ### Parameters #### Request Body - **model** (string) - Required - The model to use for generating embeddings. Example: "Bge_M3_FP16" - **input** (string or array of strings) - Required - The input text or array of texts to embed. - **encoding_format** (string) - Optional - The format for encoding the output. Example: "base64" ### Request Example ```json { "model": "Bge_M3_FP16", "input": "The quick brown fox" } ``` ### Response #### Success Response (200) - **data** (array) - An array of embedding objects. - **embedding** (array of floats) - The embedding vector. #### Response Example ```json { "data": [ { "embedding": [ 0.123, 0.456, ... ] } ] } ``` ``` -------------------------------- ### Initialize LLM Text Generation Source: https://deapi.ai/playground/image-to-image Demonstrates how to initialize a text generation model for AI-powered text creation. Ensure necessary libraries are imported. ```python from deapi.ai.llms.txt import LLMTextGeneration llm_text_generation = LLMTextGeneration() ``` -------------------------------- ### OpenAI Compatible API Response Example Source: https://docs.deapi.ai/openai-compatibility This is an example of the JSON response format you can expect from the API, which follows the OpenAI standard. ```json { "object": "list", "data": [ { "id": "Flux1schnell", "object": "model", "created": 1700000000, "owned_by": "organization-owner" } ] } ``` -------------------------------- ### Node.js/TypeScript Quick Start for Image Generation Source: https://docs.deapi.ai/openai-compatibility Initialize the OpenAI client with your deAPI key and base URL. Then, use the `images.generate` call, which is identical to the OpenAI SDK. ```javascript import OpenAI from "openai"; const client = new OpenAI({ apiKey: "dpn-sk-your-token-here", baseURL: "https://oai.deapi.ai/v1", }); // Generate an image — same call as OpenAI const response = await client.images.generate({ model: "Flux1schnell", prompt: "A futuristic city at sunset, cinematic lighting", size: "1024x1024", n: 1, }); console.log(response.data[0].url); ``` -------------------------------- ### Generate Text with Temperature, Top-P, and Stop Sequences Source: https://deapi.ai/playground/image-to-image This comprehensive example combines several parameters: 'temperature' for creativity, 'top_p' for sampling, and 'stop' sequences for controlling the output. It allows for fine-grained control over the text generation process. ```python from deapi_ai_llms_txt import TextGeneration text_generation = TextGeneration() response = text_generation.generate_text( "Write a short dialogue between a cat and a dog.", temperature=0.8, top_p=0.95, stop=["END"], max_tokens=120 ) print(response) ``` -------------------------------- ### Job Failed Webhook Payload Example Source: https://deapi.ai/llms.txt Example JSON payload received when a job fails. Includes error details such as error code and message. ```json { "data": { "job_request_id": "123e4567-e89b-12d3-a456-426614174000", "status": "error", "previous_status": "processing", "job_type": "txt2img", "failed_at": "2024-01-15T10:30:45.000Z", "error_code": "PROCESSING_ERROR", "error_message": "Error during inference processing" } } ``` -------------------------------- ### Initialize OpenAI Clients for Chat and Media Source: https://deapi.ai/use-cases/openai-api Instantiate two OpenAI clients within the same application: one for chat completions with OpenAI, and another for media tasks (image generation, audio, embeddings) pointed at deAPI's gateway. ```python from openai import OpenAI # Chat — OpenAI chat = OpenAI(api_key="sk-...") # Media — deAPI (same SDK, different base_url) media = OpenAI( api_key="dpn-sk-your-token-here", base_url="https://oai.deapi.ai/v1", ) reply = chat.chat.completions.create( model="gpt-5", messages=[{"role":"user", "content":"Describe this scene."} ], ) picture = media.images.generate( model="Flux_2_Klein_4B_BF16", prompt=reply.choices[0].message.content, ) voice_over = media.audio.speech.create( model="Kokoro", voice="af_bella", input=reply.choices[0].message.content, ) ``` -------------------------------- ### Image Generation Request Example Source: https://docs.deapi.ai/openai-compatibility This is an example of a request payload for image generation using deAPI, which is compatible with OpenAI's format but uses deAPI-specific model IDs. ```json -d '{ "model": "Flux1schnell", "prompt": "A futuristic city at sunset, cinematic lighting", "size": "1024x1024", "n": 1 }' ``` -------------------------------- ### Job Completed Webhook Payload Example Source: https://deapi.ai/llms.txt Example JSON payload received when a job is completed successfully. Includes job details, result URL, and processing time. ```json { "event": "job.completed", "delivery_id": "550e8400-e29b-41d4-a716-446655440001", "timestamp": "2024-01-15T10:30:45.000Z", "data": { "job_request_id": "123e4567-e89b-12d3-a456-426614174000", "status": "done", "previous_status": "processing", "job_type": "txt2img", "completed_at": "2024-01-15T10:30:45.000Z", "result_url": "https://storage.deapi.ai/...", "processing_time_ms": 4500 } } ``` -------------------------------- ### Configure OpenAI Client with deAPI Source: https://docs.deapi.ai/openai-compatibility Instantiate the OpenAI client, providing your API key and base URL. This example shows how to change these parameters for compatibility with deAPI. ```python from openai import OpenAI client = OpenAI( api_key="dpn-sk-your-token-here", # ← changed base_url="http://localhost:8000/v1", # ← changed model="gpt-3.5-turbo", # ← changed ) ``` -------------------------------- ### GET /api/v2/account/balance Source: https://deapi.ai/llms.txt Retrieves the current account balance. ```APIDOC ## GET /api/v2/account/balance Returns current account balance. ### Response #### Success Response (200) - **data** (object) - Contains the balance information. - **balance** (number) - The current account balance. ``` -------------------------------- ### Initialize OpenAI Client with API Key Source: https://docs.deapi.ai/openai-compatibility Instantiate the OpenAI client using your API key, which can be set as an environment variable. ```python openai_client = OpenAI(api_key=os.environ["OPENAI_KEY"]) ``` -------------------------------- ### Image Generation Source: https://docs.deapi.ai/openai-compatibility Example of how to generate an image using the OpenAI compatible API. ```APIDOC ## POST /v1/images/generations ### Description Generates an image based on the provided prompt. ### Method POST ### Endpoint https://oai.deapi.ai/v1/images/generations ### Parameters #### Request Body - **model** (string) - Required - The model to use for image generation (e.g., "Flux1schnell"). - **prompt** (string) - Required - The text prompt to generate an image from. - **size** (string) - Optional - The desired size of the image (e.g., "1024x1024"). - **n** (integer) - Optional - The number of images to generate. ### Request Example ```json { "model": "Flux1schnell", "prompt": "A futuristic city at sunset, cinematic lighting", "size": "1024x1024", "n": 1 } ``` ### Response #### Success Response (200) - **data** (array) - An array of image objects. - **url** (string) - The URL of the generated image. #### Response Example ```json { "created": 1678887000, "data": [ { "url": "https://oai.deapi.ai/images/generated/image1.png" } ] } ``` ``` -------------------------------- ### Get Results Source: https://docs.deapi.ai/openai-compatibility Check job status and retrieve results via polling. ```APIDOC ## GET /api/v1/client/request-status/{request_id} ### Description Check job status and retrieve results via polling. ### Method GET ### Endpoint /api/v1/client/request-status/{request_id} ### Parameters #### Path Parameters - **request_id** (string) - Required - The ID of the request to check the status for. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **field1** (type) - Description #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Configure OpenAI Client with deAPI Source: https://docs.deapi.ai/openai-compatibility After initializing deAPI, you can change `api_key`, `base_url`, and `model` to suit your needs. This example shows how to import and set up the client. ```python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="YOUR_BASE_URL", model="YOUR_MODEL" ) ``` -------------------------------- ### OpenAI Compatible API - Text-to-Speech Source: https://deapi.ai/llms.txt Example of using the OpenAI compatible endpoint for text-to-speech. ```APIDOC ## OpenAI Compatibility ### Supported endpoints | Endpoint | Status | Description | |---|---|---| | `POST /v1/audio/speech` | Supported | Text-to-speech. Output formats: `mp3`, `wav`, `flac`, `opus` | ### Quick start (Python) ```python from openai import OpenAI client = OpenAI( api_key="dpn-sk-your-api-key", base_url="https://oai.deapi.ai/v1", ) speech = client.audio.speech.create( model="Kokoro", voice="alloy", input="Hello world", ) speech.stream_to_file("output.mp3") ``` ``` -------------------------------- ### Go OpenAI Client Initialization and Usage Source: https://deapi.ai/use-cases/openai-api Initialize the OpenAI client in Go with deAPI's base URL and API key. This example shows image generation using the client. ```go package main import ( "context" openai "github.com/openai/openai-go" "github.com/openai/openai-go/option" ) func main() { client := openai.NewClient( option.WithAPIKey("dpn-sk-your-token-here"), option.WithBaseURL("https://oai.deapi.ai/v1"), ) img, _ := client.Images.Generate(context.TODO(), openai.ImageGenerateParams{ Model: openai.F("Flux_2_Klein_4B_BF16"), Prompt: openai.F("a neon-lit city at dusk"), }) _ = img } ``` -------------------------------- ### Get Job Results Source: https://docs.deapi.ai/ Retrieve the current status and result of a submitted inference job. ```APIDOC ## GET /api/v2/jobs/{job_request} ### Description Retrieve the current status and result of a submitted inference job. ### Method GET ### Endpoint /api/v2/jobs/{job_request} ### Parameters #### Path Parameters - **job_request** (string) - Required - The ID of the job request. ### Request Example (No request example provided in the source) ### Response #### Success Response (200) (No specific response details provided in the source) ``` -------------------------------- ### Initialize OpenAI Client with Base URL Source: https://docs.deapi.ai/openai-compatibility Instantiate the OpenAI client, specifying your API key and the custom base URL for the compatible API. This setup is crucial for directing requests to the correct endpoint. ```typescript import OpenAI from "openai"; const client = new OpenAI({ apiKey: "dpn-sk-your-token-here", baseURL: "https://oai.deapi.ai/v1", }); ``` -------------------------------- ### Image Generation (DALL-E → deAPI) - Before (OpenAI) Source: https://docs.deapi.ai/openai-compatibility This is an example of how to generate images using OpenAI's DALL-E API. It requires importing the OpenAI library and initializing the client with an API key. ```python from openai import OpenAI client = OpenAI(api_key="sk-...",) response = client.images.generate( model="dall-e-3", prompt="a cute baby sea otter wearing a beret", size="1024x1024", quality="standard", n=1, ) ``` -------------------------------- ### OpenAI Compatible API - Embeddings Source: https://deapi.ai/llms.txt Example of using the OpenAI compatible endpoint for text embeddings. ```APIDOC ## OpenAI Compatibility ### Supported endpoints | Endpoint | Status | Description | |---|---|---| | `POST /v1/embeddings` | Supported | Text embeddings. Supports single string and array input. Supports `encoding_format: "base64"` | ### Quick start (Python) ```python from openai import OpenAI client = OpenAI( api_key="dpn-sk-your-api-key", base_url="https://oai.deapi.ai/v1", ) response = client.embeddings.create( model="Bge_M3_FP16", input=["Hello world", "Embeddings are cool"], ) print(response.data[0].embedding) ``` ``` -------------------------------- ### Image Generation Migration (DALL-E to deAPI) Source: https://docs.deapi.ai/openai-compatibility This example shows how to migrate from using OpenAI's DALL-E for image generation to using deAPI. It includes the necessary imports and client initialization. ```python from openai import OpenAI client = OpenAI(api_key="sk-...") ``` -------------------------------- ### LangChain Integration Source: https://docs.deapi.ai/openai-compatibility Example of how to configure LangChain to use the deAPI AI service by specifying the base URL. ```APIDOC ## LangChain Integration Because deAPI uses the OpenAI API format, it works with any framework that accepts a `base_url` or `api_base` parameter. ### LangChain ```python from langchain_openai import OpenAIEmbeddings embeddings = OpenAIEmbeddings( model="Bge_M3_FP16", openai_api_base="https://oai.deapi.ai/v1", openai_api_key="sk-xxxxxxxx" ) response = embeddings.embed_query("Hello world") print(len(response)) # → 1024 ``` ``` -------------------------------- ### OpenAI Compatible API - Video Generation Source: https://deapi.ai/llms.txt Example of using the OpenAI compatible endpoint for video generation. ```APIDOC ## OpenAI Compatibility ### Supported endpoints | Endpoint | Status | Description | |---|---|---| | `POST /v1/videos` | Supported | Video generation (deAPI extension — not in OpenAI's official spec) | ### Quick start (Python) ```python from openai import OpenAI client = OpenAI( api_key="dpn-sk-your-api-key", base_url="https://oai.deapi.ai/v1", ) response = client.videos.generate( prompt="a cat floating in a nebula, photorealistic", n=1, size="1024x1024", ) print(response.data[0].url) ``` ``` -------------------------------- ### OpenAI Compatible API - Audio Transcription Source: https://deapi.ai/llms.txt Example of using the OpenAI compatible endpoint for audio transcription. ```APIDOC ## OpenAI Compatibility ### Supported endpoints | Endpoint | Status | Description | |---|---|---| | `POST /v1/audio/transcriptions` | Supported | Audio & video transcription. `response_format`: `json` (default), `text`, `verbose_json` | ### Quick start (Python) ```python from openai import OpenAI client = OpenAI( api_key="dpn-sk-your-api-key", base_url="https://oai.deapi.ai/v1", ) with open("audio.mp3", "rb") as audio_file: transcript = client.audio.transcriptions.create( model="WhisperLargeV3", file=audio_file, ) print(transcript.text) ``` ``` -------------------------------- ### Initialize OpenAI Client with deapi.ai Source: https://docs.deapi.ai/openai-compatibility This snippet shows how to initialize the OpenAI client, specifying your API key and the deapi.ai base URL for compatibility. ```APIDOC ## Initialize OpenAI Client ### Description Instantiate the OpenAI client, providing your API key and the specific base URL for the deapi.ai service. ### Method Python SDK ### Code ```python from openai import OpenAI client = OpenAI( api_key="dpn-sk-your-token-here", base_url="https://oai.deapi.ai/v1" ) ``` ```