Skip to content

AIMOWAY/aimoway-api-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AIMOWAY API Examples

OpenAI-compatible API examples for AIMOWAY LLM API access.

AIMOWAY provides affordable and reliable access to selected AI model services through a simple web platform and an OpenAI-compatible API. This repository shows how to call AIMOWAY using curl, Python, and Node.js.

Links

Resource URL
Website https://aimoway.com
Pricing https://aimoway.com/pricing
Documentation https://aimoway.com/docs
FAQ https://aimoway.com/faq

What is included

Example Location Description
curl This README Minimal Chat Completions request
Python examples/python/ OpenAI SDK example
Node.js examples/node/ OpenAI SDK example

Before you start

Create an AIMOWAY account, add service credits, and create an API key.

Do not hard-code your API key in source code. Use an environment variable instead:

export AIMOWAY_API_KEY="your_aimoway_api_key_here"

The AIMOWAY OpenAI-compatible API base URL is:

https://aimoway.com/v1

Example model

The examples below use:

DeepSeek-V3.2

You can replace it with another supported model from the AIMOWAY Pricing page.

curl example

curl https://aimoway.com/v1/chat/completions \
  -H "Authorization: Bearer $AIMOWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "DeepSeek-V3.2",
    "messages": [
      {
        "role": "system",
        "content": "You are a concise and helpful assistant."
      },
      {
        "role": "user",
        "content": "Give me one practical idea for testing an LLM API."
      }
    ],
    "temperature": 0.2,
    "max_tokens": 128
  }'

Python example

Install dependencies:

pip install -r examples/python/requirements.txt

Run the example:

python examples/python/chat_completions.py

The Python example uses the OpenAI SDK with the AIMOWAY API base URL:

from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["AIMOWAY_API_KEY"],
    base_url="https://aimoway.com/v1",
)

response = client.chat.completions.create(
    model="DeepSeek-V3.2",
    messages=[
        {"role": "system", "content": "You are a concise and helpful assistant."},
        {"role": "user", "content": "Give me one practical idea for testing an LLM API."},
    ],
    temperature=0.2,
    max_tokens=128,
)

print(response.choices[0].message.content)

Node.js example

Install dependencies:

cd examples/node
npm install

Run the example:

npm start

The Node.js example uses the OpenAI SDK with the AIMOWAY API base URL:

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AIMOWAY_API_KEY,
  baseURL: "https://aimoway.com/v1",
});

const response = await client.chat.completions.create({
  model: "DeepSeek-V3.2",
  messages: [
    {
      role: "system",
      content: "You are a concise and helpful assistant.",
    },
    {
      role: "user",
      content: "Give me one practical idea for testing an LLM API.",
    },
  ],
  temperature: 0.2,
  max_tokens: 128,
});

console.log(response.choices[0].message.content);

Notes

AIMOWAY uses service credits.

Model usage is billed based on token consumption. Input and output token pricing may differ by model. See the Pricing page for the current supported model list and pricing.

AIMOWAY does not use customer prompts, outputs, uploaded files, API request content, or other customer work data to train AI models.

Security

Never commit API keys, tokens, .env files, logs, or request data that may contain private information.

Recommended local environment file pattern:

# .env
AIMOWAY_API_KEY="your_aimoway_api_key_here"

If you use a .env file, make sure it is ignored by Git:

.env
.env.*
!.env.example

Troubleshooting

Problem Possible cause Suggested check
401 Unauthorized Missing or invalid API key Confirm AIMOWAY_API_KEY is set correctly
404 Not Found Wrong API base URL or endpoint Use https://aimoway.com/v1
Model error Unsupported or misspelled model name Check the current model list on the Pricing page
Quota or billing error Insufficient service credits Check your AIMOWAY account balance

License

MIT

Releases

No releases published

Packages

 
 
 

Contributors