DocumentationQuickstart
Quickstart

5-minute quickstart

Aiaimark provides an OpenAI-compatible API. Create a key, choose a model, and change the Base URL to use leading models in your existing application.

00
Prerequisites

Before you start

An active Aiaimark account Available account credit A development environment that can send HTTPS requests
01
Account

Create an account and sign in

Create an account, sign in to the console, and confirm that your account is active with enough available credit.

02
Authentication

Create an API key

Open API Key management in the console, create a key, and save it immediately. Store keys only in server-side environment variables, never in frontend code or source control.

Keep your key secure

Create a separate key for each project. If a key is exposed, revoke it in the console and create a new one immediately.

03
Model

Choose an available model

Open the model marketplace to review available models and pricing. Copy the exact model name and place it in the request’s model field.

Open model marketplace
04
API request

Send your first chat request

The API uses the OpenAI request format. Replace the example API key and model name with your values, then send the request.

Base URL
https://ai.aiaimark.com/v1
Endpoint
https://ai.aiaimark.com/v1/chat/completions
Authentication
Authorization: Bearer sk-your-api-key
cURLTerminal
curl https://ai.aiaimark.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-your-api-key" \
  -d '{
    "model": "YOUR_MODEL_NAME",
    "messages": [
      { "role": "user", "content": "Hello, please introduce yourself." }
    ]
  }'

The model response is returned in choices[0].message.content. If you receive a 401, check your API key. If the model is not found, copy its exact name from the model marketplace.

05
SDK

Integrate your application

With an existing OpenAI SDK, replace baseURL and the API key. Here is a Node.js example:

JavaScriptOpenAI SDK
import OpenAI from 'openai'

const client = new OpenAI({
  apiKey: process.env.AIAIMARK_API_KEY,
  baseURL: 'https://ai.aiaimark.com/v1',
})

const response = await client.chat.completions.create({
  model: 'YOUR_MODEL_NAME',
  messages: [{ role: 'user', content: 'Hello, please introduce yourself.' }],
})

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

You can now adjust the model, messages, and generation parameters. Before production, add request timeouts, retries, and error logging.

06
Codex

Use Aiaimark with Codex

Codex supports custom model providers. Configure Aiaimark as a provider to call compatible Responses API models from Codex CLI, desktop, or IDE extensions.

Choose either setup method

We recommend CC Switch: follow the screenshots to complete setup. Manual configuration is also available. Choose either method; there is no need to do both.

Recommended method · Graphical interface

Connect Codex with CC Switch

CC Switch is a third-party open-source tool for adding and switching Codex providers through a graphical interface. Follow the steps below to finish setup; no separate manual configuration is needed.

These are real screenshots of CC Switch 4.0.15 in Chinese. Numbered red boxes highlight the controls; click an image to enlarge it. The setup screenshots use a dummy key and model placeholders: replace them with your own values. Account balances are redacted.

  1. Install and open CC SwitchDownload the package for your operating system and processor from the CC Switch website: MSI or portable ZIP for Windows, DMG for macOS, or DEB, RPM, or AppImage for Linux. Make sure Codex is installed, and have your Aiaimark API key, available credit, and a model name that supports the Responses API and tool use ready.
macOSAlternative for users with Homebrew installed
brew install --cask cc-switch
  1. Add a custom providerSelect Codex in CC Switch, click “+ / Add provider” in the upper right, then choose “Custom configuration”. If Direct, Routing, and Aggregation tabs are available, use Direct mode for this guide. Button labels may vary by version.
Figure 1: Select Codex in the sidebar (1), open Add provider, then choose Custom configuration (2).
Figure 1: Select Codex in the sidebar (1), open Add provider, then choose Custom configuration (2). View full-size image
  1. Enter your Aiaimark connection detailsFill in the form using the values below. Use your actual API key from the console and copy a model name from the marketplace; do not use the example placeholder as a model name.
Figure 2: Enter the name (1), API key (2), API endpoint (3), and default model (4).
Figure 2: Enter the name (1), API key (2), API endpoint (3), and default model (4). View full-size image
Provider name
Aiaimark
Endpoint / Base URL
https://ai.aiaimark.com/v1
API Key
The key you created in the Aiaimark console
Default model
YOUR_CODEX_MODEL (replace with the actual model name)
Upstream format
Responses (native)

Enter Aiaimark as the name; notes are optional. The Website field is only a shortcut and can contain https://aiaimark.com; it does not replace the API endpoint. Paste your complete console API key into API Key without a Bearer prefix or quotation marks.

Set the API endpoint to https://ai.aiaimark.com/v1. Keep /v1 and do not append /responses or /chat/completions. The auth.json and config.toml editors below update automatically from the form and usually need no manual editing.

  1. Set the model and API formatClick Add manually under Model list. Enter the exact marketplace name of a model that supports the Responses API and tool use in both Menu display name and Actual request model. YOUR_CODEX_MODEL in the screenshot is only a placeholder.
Figure 3: Enter the actual model name (1). In Advanced options, use native Responses (2) and leave Full URL off.
Figure 3: Enter the actual model name (1). In Advanced options, use native Responses (2) and leave Full URL off. View full-size image

The first row is the default model; the separate Default model field may disappear after adding a model list. Alternatively, click Fetch model list and select a model. If fetching fails, add it manually. Leave context window, reasoning level, and subagent model at their defaults if unsure.

Expand Advanced options, verify that Upstream format is native Responses, and leave Full URL off. A model with native Responses support can connect directly as described here; routing or aggregation is not required.

CC Switch stores your key and writes it to local configuration when you enable a provider. Do not share screenshots or exports containing real keys. Back up any existing manual configuration; if the editor retains env_key from the previous section, remove that field or ensure its environment variable matches the key entered here.

  1. Save the configuration firstCheck the name, key, endpoint, and model, then click the orange Add button at the bottom right. When editing an existing provider, it may say Save. Return to the list and find your Aiaimark card; use the search in the upper right if needed.
Figure 4: Add saves the provider. Return to the list afterward to switch to it.
Figure 4: Add saves the provider. Return to the list afterward to switch to it. View full-size image
Saved does not mean enabled

An Aiaimark card in the list only confirms that its configuration was saved. Complete the next step so Codex actually uses it.

  1. Enable Aiaimark in the provider listOpen the Direct tab for Codex and find Aiaimark. Hover over the plug icon on the right of its card, confirm the tooltip says Switch, and click it. Older versions may show Enable. The pencil icon edits the configuration; it does not enable it.
Figure 5: Direct tab (1) and provider switch control (2). This environment already uses routing, so Return to direct (3) also appears.
Figure 5: Direct tab (1) and provider switch control (2). This environment already uses routing, so Return to direct (3) also appears. View full-size image

If the notice says you are viewing Direct while Codex is using routing, as in Figure 5, selecting the tab has not changed the active mode. The plug on the Aiaimark card then means Return to direct and use this provider. Click it to change the mode and provider. New users already in Direct mode can skip this detail.

After switching, look for In use or the current-provider indicator on the Aiaimark card. Used in direct mode in Figure 5 refers to the saved direct configuration before routing was enabled; it does not mean Direct mode is currently active.

Already using routing? Check the active provider

If you choose to keep routing enabled, select Route here for Aiaimark in the Routing tab. Figure 6 shows a routing status example: Routing active → AIAIMark at the top and Routing on its card must identify the same provider. Direct-mode users do not need to enable routing to reproduce this screen.

Figure 6: An existing routing environment. The top provider (1) matches the Routing card (2); this does not show a direct connection.
Figure 6: An existing routing environment. The top provider (1) matches the Routing card (2); this does not show a direct connection. View full-size image

Keep CC Switch running when using routing. In Direct mode, requests go straight to Aiaimark. After changing a provider or model, restart Codex before verifying either mode.

  1. Restart Codex and verifyChanging configuration does not automatically reload an open Codex session. Restart your client as described below, then test in a new session.
Codex CLI
Exit the current Codex process and run codex again in your project directory. Use /model to check the selected model.
Codex desktop
Fully quit and reopen the app. On macOS, use ⌘Q; closing the window alone does not quit it. On Windows, use the app’s Quit command.
IDE extension
Close and reopen the IDE window, or use Reload Window, then open a new session in the Codex extension.

Send “Hello, please introduce yourself.” Confirm a reply, then check the matching request time and model name in the Aiaimark console. Both must match to verify the connection; a successful latency check or highlighted card is not enough.

CC Switch troubleshooting
  • 401 / Authentication failed: check that your API key is complete and valid, and that an environment variable from an older configuration is not overriding it.
  • 404 / Model unavailable: check the Base URL and model name, and confirm the model supports the Responses API and tool use.
  • Switch not taking effect: confirm you clicked Switch / Enable and restarted Codex. For WSL, custom configuration directories, or multiple Codex environments, verify that CC Switch manages the configuration used by your running environment.
Switch providers or restore your previous setup

To switch later, select another saved provider, click Switch / Enable, and restart Codex. Choose a previously saved provider to restore its configuration, or select the official OpenAI provider and follow the Codex sign-in prompts to return to official login.