跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.metask.ai/llms.txt

Use this file to discover all available pages before exploring further.

An AI gateway sits between your application and the AI providers you want to use. Instead of integrating directly with each provider’s API — managing separate credentials, handling different response formats, and tracking usage across accounts — you send all your requests to one place. 元任务 AI 网关 (Metask AI Gateway) receives your request, routes it to the appropriate upstream provider, and returns the response to your application.

How the gateway works

When you make a request through the gateway, the flow looks like this:
Your Application

      │  POST /v1/chat/completions
      │  Authorization: Bearer <your-api-key>

元任务 AI 网关 (https://napi.origintask.cn/v1)

      │  Routes to the correct provider
      │  Authenticates on your behalf

AI Provider (OpenAI, Anthropic, etc.)

      │  Provider response

元任务 AI 网关

      │  Meters token usage, returns response

Your Application
Your application only ever talks to the gateway. The gateway handles authentication with upstream providers, so you never need to manage provider-specific API keys in your own infrastructure.

Benefits of using the gateway

Single endpoint, single API key. All requests go to https://napi.origintask.cn/v1 using the API key you generate in the 元任务 dashboard. You don’t need accounts or credentials with individual AI providers. No per-provider setup. Switching models — even across providers — requires only changing the model parameter in your request. There’s no code change to authentication, base URLs, or request structure. Unified usage tracking. All token consumption is metered centrally. You can monitor spending across every model you use from a single dashboard view. Centralized billing. Top up your balance once and use it across all available models, rather than maintaining separate billing relationships with each provider.

OpenAI compatibility

The gateway implements the OpenAI API specification. If your application already uses the OpenAI SDK or makes direct HTTP requests to the OpenAI API, you can switch to 元任务 AI 网关 by changing only the base URL — everything else stays the same.
from openai import OpenAI

client = OpenAI(
    api_key="your-metask-api-key",
    base_url="https://napi.origintask.cn/v1",
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
The gateway is a drop-in replacement for the OpenAI API base URL. Any library or tool that supports a configurable base_url works with 元任务 AI 网关 without modification.

Authentication

Every request to the gateway must include your API key as a Bearer token in the Authorization header:
Authorization: Bearer napi-xxxxxxxxxxxxxxxxxxxxxxxx
You generate API keys in the 元任务 dashboard. The gateway uses your key to identify your account, enforce your subscription limits, and meter your token usage. It then authenticates with upstream AI providers using its own credentials — you never need to provide or rotate provider-specific keys.
Keep your API key private. Do not commit it to source control or expose it in client-side code. Use environment variables or a secrets manager to inject it at runtime.