Gate.AI Quick Start API Access with Python, Node.js, and curl
Gate.AI provides an OpenAI-compatible API interface that allows developers to send chat completion requests through Python, Node.js, curl, and compatible AI development tools. For developers who already use OpenAI-style SDKs or REST requests, Gate.AI API access mainly requires replacing the API key and base URL rather than changing the request structure. This quick start covers one required setup step, one access-path decision, and three mutually exclusive implementation paths for Python, Node.js, and curl; advanced topics such as streaming architecture, account permissions, production monitoring, and billing controls are outside the scope.
Prerequisites
- A Gate.AI API key.
- Python, Node.js, or curl installed, depending on the access path you choose.
What Will You Be Able to Do After This Guide?
After completing this Gate.AI quick start API guide, you will be able to send a working chat completion request to Gate.AI using one selected access method: Python, Node.js, or curl.
You do not need to complete all three language examples. Choose the path that matches your application environment. The examples use the Gate.AI OpenAI-compatible base URL and chat completions format as of June 2026. For product context, use the Gate.AI product page.
Step 1: Prepare Shared Gate.AI API Values
This step prepares the common API values required by every access path.
Action:
Use the following Gate.AI API configuration values before choosing your implementation path.
| Configuration item | Value |
|---|---|
| API key | YOUR_GATEAI_API_KEY |
| Base URL | https://api.gate.ai/openai/v1 |
| Chat completions endpoint | https://api.gate.ai/openai/v1/chat/completions |
| Example Python model value | auto |
| Example Node.js model value | auto |
| Example curl model value | deepseek/deepseek-v3.2 |
The API key authenticates the request, while the base URL routes OpenAI-compatible SDK calls to Gate.AI. The endpoint is used directly only in the curl path.
Step 2: Choose One API Access Path
This step prevents the Python, Node.js, and curl examples from being treated as a required sequence.
Action:
Choose one path from the table below.
| Access path | Use this path when | Required environment | Next step |
|---|---|---|---|
| Python | Your app, script, or backend uses Python | Python and OpenAI Python SDK | Step 3A |
| Node.js | Your app or service uses JavaScript or Node.js | Node.js and OpenAI Node.js SDK | Step 3B |
| curl | You want a direct terminal test or REST debugging request | curl | Step 3C |
Only one path is required to verify Gate.AI API access. Run multiple paths only if you want to test Gate.AI across different development environments.
Step 3A: Send a Python Chat Completion Request
This path uses the OpenAI Python SDK with the Gate.AI base URL.
Action:
Use this path only if your selected environment is Python.
from openai import OpenAIclient = OpenAI(api_key="YOUR_GATEAI_API_KEY",base_url="https://api.gate.ai/openai/v1",)completion = client.chat.completions.create(model="auto",messages=[{"role": "system", "content": "system prompt"},{"role": "user", "content": "how are you?"}],)print(completion.choices[0].message.content)
You should see an assistant response printed in the terminal, such as:
Hello! Nice to meet you. How can I help you?
This path keeps the OpenAI Python SDK request shape and changes the API key and base URL to Gate.AI.
Step 3B: Send a Node.js Chat Completion Request
This path uses the OpenAI Node.js SDK with the Gate.AI base URL.
Action:
Use this path only if your selected environment is Node.js.
const OpenAI = require("openai")const client = new OpenAI({apiKey: "YOUR_GATEAI_API_KEY",baseURL: "https://api.gate.ai/openai/v1",})async function main() {const completion = await client.chat.completions.create({model: "auto",messages: [{"role": "system", "content": "system prompt"},{"role": "user", "content": "how are you?"}],})console.log(completion.choices[0].message.content)}main()
You should see the assistant response in the console. If the script runs without output, print the full completion object once and confirm that choices[0].message.content exists.
Step 3C: Send a curl Chat Completion Request
This path calls the Gate.AI chat completions endpoint directly without an SDK.
Action:
Use this path only if you want a direct REST request from the terminal.
curl --location --request POST 'https://api.gate.ai/openai/v1/chat/completions' \--header 'Authorization: Bearer YOUR_GATEAI_API_KEY' \--header 'Content-Type: application/json' \--data-raw '{"model": "deepseek/deepseek-v3.2","stream": false,"messages": [{"role": "user","content": "how are you"}]}'
You should receive a JSON response with a choices array. The assistant reply is available at choices[0].message.content.
What Does a Successful Gate.AI API Response Look Like?
A successful Gate.AI chat completion response follows the OpenAI-compatible chat completion structure.
{"id": "243c850e-214c-431e-977f-ebaf4aa95f56","choices": [{"index": 0,"message": {"role": "assistant","content": "Hello! Nice to meet you. How can I help you?"},"finish_reason": "stop"}],"created": 1773408946,"model": "deepseek.v3-v1:0","object": "chat.completion","usage": {"prompt_tokens": 5,"completion_tokens": 15,"total_tokens": 20}}
| Response field | What to check |
|---|---|
| choices[0].message.content | The generated assistant response |
| finish_reason | Whether the model stopped normally |
| model | The model that served the request |
| usage.prompt_tokens | Tokens used by the input messages |
| usage.completion_tokens | Tokens used by the assistant response |
| usage.total_tokens | Total tokens used by the request and response |
The most important field for a quick start test is choices[0].message.content. The usage object helps confirm that Gate.AI processed both the prompt and completion.
Why Is the Gate.AI API Request Not Working? Troubleshooting Checklist
- Symptom: The request returns an authentication error.
- Cause: The API key is missing, expired, malformed, or not copied correctly from Gate.AI.
- Fix: Replace
YOUR_GATEAI_API_KEYwith a valid Gate.AI API key. For curl, keep theAuthorization: Bearer YOUR_GATEAI_API_KEYheader format.
- Symptom: The SDK request goes to the wrong service.
- Cause: The OpenAI SDK is still using its default base URL.
- Fix: Set Python
base_urlor Node.jsbaseURLtohttps://api.gate.ai/openai/v1before sending the request.
- Symptom: The response does not use the expected model.
- Cause: The request uses
auto, or the requested model ID is mapped differently by Gate.AI when automatic model selection is intended.
- Cause: The request uses
- Symptom: The script runs but prints nothing.
- Cause: The code may not be reading
completion.choices[0].message.content, or the request failed before the print statement.
- Cause: The code may not be reading
What Can You Configure or Build Next?
After one Gate.AI quick start API path works, connect the same Gate.AI base URL to your application backend, developer tool, internal automation, or testing workflow.
Suggested next topics:
- Gate.AI product overview for understanding Gate.AI in an AI development workflow.
- Gate.AI API documentation for supported API behavior, model details, and implementation reference.
FAQs
Do I need to run Python, Node.js, and curl?
No. Choose one access path based on your environment. Python, Node.js, and curl are alternative methods for sending a Gate.AI chat completion request.
Why does Python use base_url while Node.js uses baseURL?
The Python SDK uses snake_case configuration names, while the Node.js SDK uses camelCase names. Both fields point to the same Gate.AI base URL.
Can I use model="auto" for every request?
Use auto when automatic model selection is intended and supported by your Gate.AI setup. If your application requires a specific model, use a supported model ID from Gate.AI documentation.
Where is the assistant response in the JSON output?
The assistant response is in choices[0].message.content. Token usage is shown separately in the usage object.


