Strands Agents
Run Strands Agents on APIKO chat models in Python or TypeScript
Overview
Strands Agents is an open-source SDK for building AI agents in Python and TypeScript. Its built-in OpenAI model provider works with APIKO: point it at the gateway and use any chat model id from the catalog, including Claude, GPT, Gemini and DeepSeek models. Tool calling works the same way it does against OpenAI.
Prerequisites
- Python 3.10 or later, or Node.js 22 or later
- An APIKO API Key from Console → API Keys, saved in the
APIKO_API_KEYenvironment variable
Step 1: Install Strands Agents
pip install 'strands-agents[openai]'Step 2: Point Strands at APIKO
import os
from strands import Agent
from strands.models.openai import OpenAIModel
model = OpenAIModel(
client_args={
"api_key": os.environ["APIKO_API_KEY"],
"base_url": "https://api.apiko.app/v1",
},
model_id="gpt-6.1-sol",
)
agent = Agent(model=model)
result = agent("Reply with the word ok")
print(result.metrics.accumulated_usage)Swap gpt-6.1-sol for any chat model id returned by GET /v1/models for your key.
Step 3: Verify Configuration
Run the script. You should see ok and the token counts, and the request in Console → Task Logs. A 401 means the key is wrong, a 403 usually means the balance is empty, and a 404 model_not_found means the model id is not available to your key.
Tool Calling
Tools are passed to the agent as usual. The model decides when to call them, and Strands runs the tool and sends the result back in the same loop.
from strands import Agent, tool
@tool
def word_count(text: str) -> int:
"""Count the words in a piece of text."""
return len(text.split())
agent = Agent(model=model, tools=[word_count])
agent("How many words are in 'the quick brown fox jumps'? Use the word_count tool.")Notes
- Strands streams responses by default; no extra setting is needed for APIKO.
- With reasoning models such as
deepseek-v4-pro, Strands does not send earlier reasoning back in multi-turn conversations over Chat Completions and logs a warning; answers and tool calls are unaffected. - Image and video models run as asynchronous tasks; call them through the task API instead of the chat model provider.
- Tested against the APIKO gateway on 2026-11-12 with strands-agents 1.64.0 (Python) and @strands-agents/sdk 1.24.0 (TypeScript), using gpt-6.1-sol, deepseek-v4-pro and gemini-3.8-flash, including tool calls.