API and SDKs

Modelway speaks the Anthropic and OpenAI APIs. Use the official SDKs or plain HTTP with Modelway’s base URL and your key.

Step 01

Get your Modelway key

Sign in, open API keys and click Create key. Copy it right away: it’s shown once. New to Modelway? Start with getting access.

Step 02

Keep the key in your environment

So it stays out of your code:

shell
export MODELWAY_API_KEY="<your Modelway API key>"

This lasts until you close the terminal. To keep it, add the line to ~/.zshrc or ~/.bashrc.

Step 03

Send a request

An Anthropic Messages request:

shell
1curl https://modelway.vip/v1/messages \
2 -H "Authorization: Bearer $MODELWAY_API_KEY" \
3 -H "anthropic-version: 2023-06-01" \
4 -H "content-type: application/json" \
5 -d '{"model": "claude-sonnet-5.5", "max_tokens": 256, "messages": [{"role": "user", "content": "Hello"}]}'

OpenAI’s Chat Completions and Responses work the same way at /v1/chat/completions and /v1/responses. Streaming works on all three.

Step 04

Use the Anthropic SDK

Pass Modelway’s URL, without /v1, as the base URL:

main.pypython
1import os
2from anthropic import Anthropic
3
4client = Anthropic(
5 base_url="https://modelway.vip",
6 api_key=os.environ["MODELWAY_API_KEY"],
7)
8message = client.messages.create(
9 model="claude-sonnet-5.5",
10 max_tokens=1024,
11 messages=[{"role": "user", "content": "Hello"}],
12)
13print(message.content[0].text)

The TypeScript SDK takes the same values as baseURL and apiKey.

Step 05

Use the OpenAI SDK

Pass Modelway’s URL with /v1:

main.pypython
1import os
2from openai import OpenAI
3
4client = OpenAI(
5 base_url="https://modelway.vip/v1",
6 api_key=os.environ["MODELWAY_API_KEY"],
7)
8response = client.responses.create(model="claude-sonnet-5.5", input="Hello")
9print(response.output_text)

client.chat.completions.create works too, with any model in the catalog, Claude included.

Step 06

List the models

The catalog, in OpenAI’s format:

shell
curl https://modelway.vip/v1/models -H "Authorization: Bearer $MODELWAY_API_KEY"

FAQ

Which header does the key go in?

Either one: Authorization: Bearer or x-api-key. The SDKs pick one for you.

Can I call GPT models through the Anthropic API?

Yes. Every endpoint serves every model in the catalog, so pick the API your code already uses.