Appearance
Getting Started with Octagon Agents API
Quick Start
1. Get an API Key
To use the Octagon Agents API, you'll need a free API key. You can get one by:
- Signing up for an Octagon account
- Go to the Settings page
- Navigate to the API Keys section
- Create a new API key
2. Make Your First API Call
Here's how to analyze SEC filings using different programming languages:
Python
from openai import OpenAI
client = OpenAI(
# Note: Replace with your API key or use environment variables
api_key="your-octagon-api-key",
base_url="https://api-gateway.octagonagents.com/v1"
)
# Make the API call using the responses endpoint
response = client.responses.create(
model="octagon-sec-agent",
instructions="You analyze SEC filings and extract financial data.",
input="What were Apple's revenue numbers in Q3 2023?"
)
# Extract and print the analysis text
analysis_text = response.output[0].content[0].text
print("ANALYSIS:")
print(analysis_text)
# Extract and print citations
annotations = response.output[0].content[0].annotations
print("\nSOURCES:")
for annotation in annotations:
print(f"{annotation.order}. {annotation.name}: {annotation.url}")
# Example output:
# ANALYSIS:
# In the third quarter of 2023, Apple's total net sales were $81,797 million. This included $60,584 million from products and $21,213 million from services [1], [2].
# SOURCES:
# 1. Apple Inc. (10-Q) - 2023-Q3, Page: 10: https://octagon-sec-filings.s3.amazonaws.com/320193/0000320193-23-000077/aapl-20230701.pdf?response-content-disposition=inline&response-content-type=application%2Fpdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAYGEZZN2EGRGVN56Y%2F20250401%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250401T220525Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=783c748f003e66bbdb61b2da4b49e3a31da0213617ff2237d1316da2885ca515#page=10
# 2. Apple Inc. (10-Q) - 2023-Q3, Page: 4: https://octagon-sec-filings.s3.amazonaws.com/320193/0000320193-23-000077/aapl-20230701.pdf?response-content-disposition=inline&response-content-type=application%2Fpdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAYGEZZN2EGRGVN56Y%2F20250401%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250401T220525Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=783c748f003e66bbdb61b2da4b49e3a31da0213617ff2237d1316da2885ca515#page=4
JavaScript
import OpenAI from 'openai';
const client = new OpenAI({
// Note: Replace with your API key or use environment variables
apiKey: 'your-octagon-api-key',
baseURL: 'https://api-gateway.octagonagents.com/v1'
});
async function getAnalysis() {
// Make the API call using the responses endpoint
const response = await client.responses.create({
model: "octagon-sec-agent",
instructions: "You analyze SEC filings and extract financial data.",
input: "What were Apple's revenue numbers in Q3 2023?"
});
// Extract and print the analysis text
const analysisText = response.output[0].content[0].text;
console.log("ANALYSIS:");
console.log(analysisText);
// Extract and print citations
const annotations = response.output[0].content[0].annotations;
console.log("\nSOURCES:");
annotations.forEach(annotation => {
console.log(`${annotation.order}. ${annotation.name}: ${annotation.url}`);
});
}
getAnalysis();
// Example output:
// ANALYSIS:
// In the third quarter of 2023, Apple's total net sales were $81,797 million. This included $60,584 million from products and $21,213 million from services [1], [2].
// SOURCES:
// 1. Apple Inc. (10-Q) - 2023-Q3, Page: 10: https://octagon-sec-filings.s3.amazonaws.com/320193/0000320193-23-000077/aapl-20230701.pdf?response-content-disposition=inline&response-content-type=application%2Fpdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAYGEZZN2EGRGVN56Y%2F20250401%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250401T220525Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=783c748f003e66bbdb61b2da4b49e3a31da0213617ff2237d1316da2885ca515#page=10
// 2. Apple Inc. (10-Q) - 2023-Q3, Page: 4: https://octagon-sec-filings.s3.amazonaws.com/320193/0000320193-23-000077/aapl-20230701.pdf?response-content-disposition=inline&response-content-type=application%2Fpdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAYGEZZN2EGRGVN56Y%2F20250401%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250401T220525Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=783c748f003e66bbdb61b2da4b49e3a31da0213617ff2237d1316da2885ca515#page=4
cURL
curl -X POST https://api-gateway.octagonagents.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-octagon-api-key" \
-d '{
"model": "octagon-sec-agent",
"instructions": "You analyze SEC filings and extract financial data.",
"input": "What were Apple'\''s revenue numbers in Q3 2023?"
}'
Next Steps
- Learn about Authentication and security best practices
- Explore the Available Specialized Agents to find the right one for your research needs
- Understand how to Handle Streaming Responses for a better user experience
- Discover how to Use AI Coding Tools to generate integration code
- See the complete Investment Research API Reference for detailed endpoint documentation
- Learn how to create multi-agent workflows with the OpenAI Agents SDK
Support
If you need help with the Octagon Agents API, you can:
- Contact support at support@octagonai.co