Skip to main content

Quickstart

Three steps from nothing to a model's answer. Base URL: https://api.oceantoken.ai/v1.

Using Claude Code?

Type these two commands in Claude Code to install the OceanToken plugin, then run /mcp to sign in. Details.

/plugin marketplace add OceanTokenAI/oceantoken-plugins
/plugin install oceantoken@oceantoken

1. Get an API key​

Sign up, then open API Keys in the console. A new account gets its first key there, named default: choose Copy key. Create key makes another one at any time. A key starts with sk- and is shown only once.

Personal accounts usually start with $1 of starter credit, valid for 14 days and given once per person, with no card needed, so your first requests run right away. Organization accounts do not get it. Without it, add credits or use a model whose ID ends in :free, which works even at a $0 balance. A paid model runs when your balance covers the most the request could cost. Each step has its own page if you want the details: create an account, create an API key.

2. Put the key in your shell​

export OCEANTOKEN_API_KEY=sk-...

The samples read the key from this variable, so it never sits in your code. On Windows PowerShell: $env:OCEANTOKEN_API_KEY = "sk-...".

3. Send a request​

# Chat completion with curl. Any OpenAI-compatible client works the same way:
# point it at the base URL and use your OceanToken key.
curl -sS "${OCEANTOKEN_BASE_URL:-https://api.oceantoken.ai/v1}/chat/completions" \
-H "Authorization: Bearer $OCEANTOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-v4.1-flash-1017",
"messages": [{"role": "user", "content": "Say hello in one short sentence."}]
}'

You get the standard chat completion object: the answer under choices[0].message.content, and usage with the token counts you were billed for. The request shows in the console under Logs, with its cost.

That is all an integration needs. The API is OpenAI-compatible, so any OpenAI SDK or tool works with the base URL and your key, and the model value is a name from the Models page. Every chat model, Claude included, also answers on the Anthropic Messages API: the Anthropic SDK adds /v1 itself, so it takes https://api.oceantoken.ai (below).

Every sample on this page is a file we run against the service before publishing. With OCEANTOKEN_API_KEY set, they run as-is.

Stream the answer​

For anything a person is waiting on, stream. Tokens arrive as they are generated, and long answers do not run into the request timeout described in Limits.

# Streaming: tokens arrive as they are generated. Use this for anything a person
# is waiting on, and for long answers, which would otherwise hit the request timeout.
import os
from openai import OpenAI

client = OpenAI(
base_url=os.getenv("OCEANTOKEN_BASE_URL", "https://api.oceantoken.ai/v1"),
api_key=os.environ["OCEANTOKEN_API_KEY"],
)

with client.chat.completions.create(
model="deepseek/deepseek-v4.1-flash-1017",
messages=[{"role": "user", "content": "Count from one to five, one number per line."}],
stream=True,
) as stream:
for chunk in stream:
delta = chunk.choices[0].delta.content if chunk.choices else None
if delta:
print(delta, end="", flush=True)
print()

Claude with the Anthropic SDK​

# pip install anthropic
# Claude models are served on /v1/messages. The Anthropic SDK works unchanged:
# give it the OceanToken host and your OceanToken key. It adds /v1 itself, so it
# takes the base URL without the /v1 that OpenAI SDKs need.
import os
import anthropic

client = anthropic.Anthropic(
base_url=os.getenv("OCEANTOKEN_BASE_URL", "https://api.oceantoken.ai/v1").removesuffix("/v1"),
api_key=os.environ["OCEANTOKEN_API_KEY"],
)

message = client.messages.create(
model="anthropic/claude-haiku-4.5",
max_tokens=64,
messages=[{"role": "user", "content": "Say hello in one short sentence."}],
)
print(message.content[0].text)

The same code works with any other chat model, such as deepseek/deepseek-v4.1-flash-1017: change model.

See what you can call​

# The models your key can call, in the standard list format.
curl -sS "${OCEANTOKEN_BASE_URL:-https://api.oceantoken.ai/v1}/models" \
-H "Authorization: Bearer $OCEANTOKEN_API_KEY"

The list reflects your key: if your account is limited to certain models, only those appear. Every model is on the Models page, and its price on its page on oceantoken.ai.

Next​