Because 元任务 AI 网关 is fully OpenAI-compatible, you can use the officialDocumentation Index
Fetch the complete documentation index at: https://docs.metask.ai/llms.txt
Use this file to discover all available pages before exploring further.
openai Python and Node.js libraries without any additional packages or adapters. The only change required is setting base_url (Python) or baseURL (Node.js/TypeScript) to the gateway endpoint. Your existing prompts, model parameters, and response-handling code stay the same.
Installation
Basic usage
Streaming responses
Streaming works the same way as with the standard OpenAI API. Setstream=True (Python) or stream: true (Node.js) and iterate over the response chunks.
Setting the API key via environment variable
Rather than hardcoding your key, set it as an environment variable. Theopenai library reads OPENAI_API_KEY automatically, so you only need to set the base_url.
python
The
base_url must always be set explicitly because the library defaults to https://api.openai.com/v1. Environment variables cannot override the base URL in all SDK versions, so pass it in the constructor.